

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


You will be given a non-pipelined Verilog model of a MIPS R3000 microprocessor with some bugs and a few instructions missing. You will be asked to fix the problems and to add the missing instructions. Remember to submit your project once you are finished.
The Verilog model is able to execute real MIPS code generated by our MIPS gcc cross-compiler, including emulation of all syscall (operating system call) instructions. The Verilog code is broken down into 10 files with the top-level file called mips.v. The mips.v file handles the interface between the processor and the memory system (load and stores) and also instantiates cpu.v. cpu.v in turn instantiates the various processor components which roughly follow the 5-stages of the execution of a MIPS instruction: Instruction Fetch (IF), Register Decode (RD), Execution (EX), Memory (MEM), and Writeback (WB).
This will compile and cross-assemble some C files inside the test directory. Once you are asked for a file name, enter test/hello. The vbs simulator is somewhat slow (it is simulating in detail!), so be patient when running larger C programs. In the directory ~/cda4150/lab1/test/ you will find a file called Makefile. Take a look at this file using a text editor; when you write a new C program of your own, this is the file that must be modified to make make work.
There is a useful script called vcheck that checks the syntax of your Verilog code. For instance, vcheck checks whether all the RHS variables used inside of an always combinational block appear in the sensitivity list. vcheck also checks whether you used <= in always blocks (and checks for the ‘TICK delay). Run vcheck on your design, and fix the problems that it reports. Use this script frequently on your code and you will avoid many common Verilog bugs! Your submitted design should be vcheck ”clean”. You can run vcheck manually (e.g. vcheck *.v or vcheck file.v) or you can check your whole design with make check.
(^1) The project was designed by Prof. Mark Heinrich for CDA4150 Fall 2004.
Inside the test directory there is a file called problem.c.
alias dis ‘mips-sgi-irix5-objdump -D’
alias less ‘more’
And then the disassemble command can just be: dis file.ld | more.
Your MIPS model is currently missing the sh (store signed half word), the lh (load signed half word), and the lhu (load unsigned half word) instructions (a half word is 16 bits). Implement those instructions, and use the test programs in the test directory to test your instructions. The names of the test programs are loadh.c, loadhu.c, and storeh.c. The opcodes for the three instructions can be found in the file mips.h.
Submit your files electronically once you have finished. This procedure will be used in all the labs. IMPORTANT: To correctly process your group submission, you must have in your lab1 directory a file called README with the first four lines as follows: (suppose your login IDs are turing and maxwell)
GROUP: turing maxwell
Full name of Alan Turing
Full name of James Clerk Maxwell
LAB XX (where XX is the number of the lab)
If you have special instructions for the graders, or wish to denote the use of your Freebie, you must inform us in the README file (after the header). To submit your files, make sure you are in your lab1 directory and type:
submit4150 lab Only one person in each group should submit. You may submit several times if you wish, but the newest submit will completely overwrite the previous one. The timestamp on the submission will determine the exact time of submission and determine whether it is on time or late. Late submissions are ignored in the grading process unless it is your Freebie. If for some reason your design is not completely functional, describe what does work, what the known problems are, and what you think is causing them. If your design is working properly, you do not need to put anything in the README file other than the header above. NOTE: The submission script is not finished now. Please check course website for the announcement about it when it works (should be earlier than Oct 8th).