Computer Architecture Lab
This course is a hands-on introduction into computer architecture. The main target is to build a simple, pipelined microprocessor and run it in an FPGA. This course is associated with a real course at the Technical University of Denmark.
Have you ever thought to build your own microprocessor?
In this course you will design and develop your own, very individual microprocessor and implement it in an FPGA.
There are only two rules for your design:
- The processor has to be pipelined
- The processor has to run in an FPGA
Everything else is up to you. Be creative!
Several assignments will help you to get started for the processor design. We will start on a weekly basis and loosen it up at the end when the main activity is designing your own processor.
As a first action add a template for your project and your name at the Student page.
Instruction Set I
Find three different microprocessors and write a short summary (about 3 pages) about the instruction sets. Compare those three architectures.
Hint: describe simpler (older) architectures as found in processors for embedded systems.
Instruction Set II
Hint: You don't have to go fancy with macros or several file linking with your assembler. Use a simple single file assembler and let the C preprocessor do the work. The command line options for the GNU C compiler are:
gcc -x c -E -C -P infile.asm > outfile.asm
High Level Simulation (optional)
Write a simulator that interprets the instructions of your processor. Write a few example programs to verify that your instruction set is complete.
If you are sure that your ISA is well designed and you want to jump right into the implementation you can skip this step.
FPGA Design Flow
To get started using an FPGA start with following small projects:
A simple blinking LED
The FPGA Hello World Example describes the FPGA design flow with Quartus.
A UART will enable you to communicate between a PC and your processor. Therefore, this is our first real VHDL example. For this experiment, connect a serial cable between the FPGA board and the serial port on your PC. Start a terminal program (Hyperterm) with baud rate 115000 and no handshake.
Extend the blinking LED example with a UART and write 0 and 1 to the serial line when the LED is off and on. The VHDL code for a UART is available here: sc_uart.vhd and fifo.vhd. The UART is connected via the SimpCon interface. With the slow output of characters (two per second) you can just write the data to the UART transmit register (offset 1).
Extend the example by writing repeated numbers 0-9 as fast as the baud rate allows. In this case you have to extend your state machine to poll the UART status register (at offset 0) to check if the transmit buffer is free.
Implement a state machine that receives characters from the UART. Switch the LED on and off with two different commands received on the serial line.
ModelSim UART print out
There is a faster simulation version of the UART available that prints the output to the ModelSim concole: sim_sc_uart.vhd.
Having mastered this UART examples gives you a great tool to debug your processor design. The UART output will probably be the only way to communicate with your processor.
For further tips see HOWTO.
You can earn additional points by providing support to the lab group. Examples are:
- Tools e.g., VHDL/.mif ROM generation
- Common design files (VHDL code)
- for the DSPIO board (pin information)
- Design flow tips
Now you should be prepared to do the real thing - your processor.
- ALU design
- Instruction decoding
- Memory and IO interface
- A final presentation
- Instruction set architecture
- Addressing modes
- Special instructions
- Pipeline stages
- Assembler syntax
- Example program
Either in a PDF file or (preferably) within Wikiversity.
Run simple programs on an FPGA boards. Some examples are:
- Blink a LED
- Write Hello World to the console (serial line)
- Read a text line from the serial line and write it out reverse ordered
- Add two numbers bigger than your register size
- Bubble sort
To implement your processor you can use any decent FPGA board. A serial interface (UART) will help for debugging. If you need more memory than the few KB on-chip the board should contain memory chips connected to the FPGA. I suggest using a board with SRAMs as they are easy to connect to the processor.
The following is outdated and shall be updated (including the pin assignments with the blinking LED)
The following boards are directly supported:
Direct support means that I can help with those boards as I have them around.
We use only freely available software during this course. A description what is needed can be found in build.pdf.
Add yourself to this list for this semester. It is strongly suggested for the students from DTU.
The former student pages:
- CA at Wikipedia
- Microprocessors at opencores.org
- b: Microprocessor Design
- b: VHDL for FPGA Design
- b: Embedded Systems/Particular Microprocessors
a short list of open issues:
- nothing open at the moment