Lab 5

horizontal rule

ece533 | doering | ece labs | ece | rhit

Home
Course Documents
Homework
Labs
Resources

Hybrid FPGA and Microcontroller System

Introduction

 

Objectives

bullet

Learn how to design a hybrid microcontroller/FPGA system

bullet

Design a system using memory-mapped I/O interfacing

bullet

Learn how to compile a C program for 8031 microcontroller

bullet

Experience design re-use

Software

bullet

Keil C51 C compiler for 8031 microcontroller

bullet

Silos 2001 Verilog behavioral simulator

bullet

Xilinx ISE 4.2i FPGA implementation tools

bullet

XSTOOLS (GXSPORT, GXSLOAD, GXSSETCLK)

Equipment

bullet

AT-style keyboard with PS/2 interface connector

bullet

XStend board and XS-40 board combination

bullet

Parallel port cable

bullet

9V 500mA DC power supply

Documents

bullet

Winbond W78C32B datasheet (very close to the W78C31B on the XS40 board; I have not been able to find the datasheet for the W78C31BP-24 device on the XS40, so perhaps it is obsolete)

bullet

Keil's "Device Database" entry for Winbond W78C32B; includes software examples.

bullet

C51 compiler documentation: look in "C:\Keil\C51\HLP" installation folder on your computer and find the "C51.pdf" file.

bullet

Keil tech support pages: Writing to an output port and reading from an input port (the latter is not needed for this project, but it's nice to know how)

"Get Acquainted" Activities

  1. Study the Verilog file 8031template.v (the corresponding UCF file is 8031.ucf; the testbench 8031template_TB.v is available, too, should you need it). This file contains an interface "shell" for your FPGA system as well as numerous examples of readable and writeable registers. The Verilog file contains documentation that is designed to be read, and contains a variety of useful information you need to know.
     

  2. Study the C file 8031template.c. This file shows an example of an 8031 program that can interact with the memory-mapped registers in the 8031template.v system. In particular, note the use of "XBYTE" to refer to specific memory addresses.
     

  3. Study the Keil C compiler instructions.
     

  4. In order to ensure that you understand the hardware described in 8031template.v, draw the register-level diagrams of the following (be sure to include bus widths on your diagram):
    bullet

    Interconnections between the board-level components: 8031, FPGA, RAM, oscillator, and LED display

    bullet

    Hardware described in "Basic 8031-SRAM-FPGA Interface" section

    bullet

    Hardware described in "Examples: 8031-Writable Registers"

    bullet

    Hardware described in "Examples: 8031-Readable Registers"

    bullet

    Hardware described in "Example: 8031-Controllable Process in FPGA"
     

  5. Implement 8031template.v to a .bit file, and compile 8031template.c to a .hex file. Use GXSLOAD to download both the .hex file and the .bit file to the XStend board (drag the .hex file to the center panel called "RAM"). Use GXSPORT Bit 0 to operate the active-low master reset).
     

System Design

The system to be designed is illustrated below:

[ insert diagram ]

The system will operate as follows:

bullet

Look for scan codes for keypad 0 to 7

bullet

Activate the corresponding Port 1 bit when the key is pressed, and deactivate the bit when the key is released. For example, pressing keypad 2 will cause Bit 2 of Port 1 to go to a high level, and releasing the key will cause the bit to go low again.

bullet

Use the XS40 LED to display the number of keys that are currently pressed.

The FPGA will implement the PS/2 interface, memory-mapped registers, and font generator for the LED display. The remaining processing tasks will take place on the 8031.

NOTES:

  1. Do not press the SPARE button at any time (it interferes with Port 1 Bit 7)

  2. Ensure that all DIP switches remain in the OFF position (these interfere with the remaining Port 1 bits)

  3. Observe the Port 1 activity using eight digital inputs on the mixed-signal oscilloscope

  4. Use the C preprocessor directive "#include <reg51.h>" (omit the quotation marks) to declare names for the "special function registers" (sfr data type). You can then set all eight Port 1 bits using a statement such as "P1 = 0x45;" (this statement will cause Port 1 bits 7 down to 0 to become 01000101).

  5. The C program should use a polling technique to continually check the PS/2 status register in your FPGA design.

  6. The PS/2 status register should automatically clear itself when the PS/2 data register is read. This will ensure that the micro does not accidentally re-read the same PS/2 data register value.

Deliverables

  1. Hardcopy of all Verilog code produced

  2. Hardcopy of all 8031 C code produced

  3. Memo detailing your design process and results. Describe the algorithms you implemented on the 8031, and also describe the technique you used for your PS/2 status and data register behavior.

  4. Demonstration of your design to instructor (obtain initials)

Due Date

Beginning of lab two week's from today

 

horizontal rule

Home | Course Documents | Homework | Labs | Resources

 ECE533: Programmable Logic Systems Design (S 2004-05)
Department of Electrical and Computer Engineering
Rose-Hulman Institute of Technology


For questions or comments regarding this web contact:
Last updated: 03/10/05.