Due: Friday, March 4 (before spring
break).
You will do this lab alone
This will be the shortest lab of the semester. In this lab you will create some of the storage components for your R372 processor. Specifically, you will create the register file and the instruction and data memory modules. For this assigment you will use a combination of both structural and behavioral Verilog.
Exercise 1: 8-entry 16-bit register file (50 points)
Use structural Verilog to design a 8-entry register file component regfile8_16_2r1w with the following interface.
The register file should have the following behavior:
You may design the internals of the register file as you wish but it would probably help if you used hierarchical design and reused some of the components you built in previous assignments, like decoders and muxes.
Create test inputs and a gtkwave timing diagram that show that your register file meets specifications. In the first 8 cycles, write the values 8-15 in registers 0-7, respectively. In the next 6 cycles, read the following register combinations: 0/1, 2/3, 4/5, 6/7, 7/6, and 2/2. Finally, show simultaneous reads and writes in the same cycle. First, write the value 16 into register 0, while simultaneously reading registers 2/3. Then, write the value 17 into register 1, while simultaneously reading registers 0/1. Show your design to the TA so that he/she can ask you some questions about it. Turn in your Verilog code, a labeled schematic for the register file (but not for the muxes, decoders, etc.) and the gtkwave timing diagram.
Exercise 2: 16-bit Memory Blocks (50 points)
Use behavioral Verilog to create instruction and data memory modules with the following interfaces. See this tutorial for help with behavioral verilog. The instruction memory module imem_16 should contain 215 16-bit words and have the following interface:
The instruction memory module should implement the following behavioral "task" (see the tutorial for how to implement these).
The instruction memory module should have the following behavior:
Use the R372 assembler to create an imem.in hex file from the code ~amir/cse371/homeworks/hw1/btree/btree.a. Write a test script that shows your design works by reading the following addresses from instruction memory: 0000, 0001, 0002, 0100, and 8000. Turn in your Verilog code and a simulation output.
Create a 215 16-bit word data memory module dmem_16 with the following interface:
The data memory module implements the following two tasks:
It also has the following interface:
Show that your data memory module works by first writing the following data into the corresponding addresses: aaaa into 8000, bbbb into 80ff, cccc into 8100, dddd into 0000, eeee into ff00, and ffff into ffff and then reading the following addresses. Turn in your Verilog code and a simulation output. Show your design to a TA so that he/she can ask you some questions about it.