Lab 1 is due Monday 9/15. Be prepared to explain your debugging techniques to your TA during section. You will also have to checkoff your multiplier during your section on Friday, 9/12. Your lab report must be submitted by 11:59pm (Monday night) using the submit program (see below).
This lab is to be done in pairs. It is QUITE long, with a STEEP LEARNING CURVE, so get started early!!!
Lab Policy: Labs (including final reports) must be submitted by 11:59pm
on the day that the lab is due.. To Submit your lab report,
run m:\bin\submit.exe or at command prompt, type "submit" then follow the
instructions. Make sure you input the correct section number, and directory to submit.
Remember that you can only submit once, so make sure to submit only when you're
ready. Otherwise
your lab/project grade will NOT be correctly recorded. The required format
for lab reports is shown on the handouts page.
In this lab, you will create a 32 bit multiplier based on what you have learned in class. You will also be mapping your multiplier down to the Calinx boards. This will provide you experience in using the Xilinx CAD tools, as well as teaching you that sometimes hardware won't behave as your simulation would lead you to believe! Hopefully, your experience in this lab will prepare you for the remainder of the semester, when your designs are significantly more complex, and correct design techniques and debugging in simulation are essential.
This lab will be done in partners. Your partner needs to be from the same discussion section.
The most important part of this lab is to become acquainted with the CAD tools that you will be using for the rest of the semester. The tutorial in M:\lab2 will guide you through the Xilinx ECS Schematic Editor, Modelsim, Xilinx Project Navigator, and Synopsis Synplify. Note that all of these tools will be available in 119 Cory and 125 Cory. If you choose to work at home for future labs, and do not have this software, please talk it over with your TA before beginning work, to ensure that your software is compatible and will allow us to grade your assignments.
It is absolutely essential that you go through this tutorial before attempting the rest of this lab. We will be going over the tutorial during the demo on Friday, 9/4, from 3-4pm. If you have not taken EECS150, you are strongly encouraged to attend.
Part 2: 32 bit Multiplier
As part of this lab, we want you to keep an on-line notebook as discussed in lecture. Be sure to follow these steps:
1. Open the editor of your choice (notepad, word, emacs, etc.) and keep it running while you work. This editor should only be used to maintain your online notebook.
2. When starting a new entry, be sure to record the time and date of that entry. You may type "date" at a unix prompt and copy and paste that in.
3. Write down your goal for that entry.
4. Make notes of any accomplishments, bugs, or insights you may develop as you work. MAKE SURE YOU CAN UNDERSTAND YOUR OWN NOTES!! Students will often write an entry that makes sense to them as they write it, but are incomprehensible a few days later. Write your entry so that you will still be able to understand it in a month. This will be important in later labs as you may want to reference back to old labs.
5. You may want to copy and/or save key waveforms that you get from simulation.
6. At the end of the session, record the time and date. Again, you may type "date" at a unix prompt and copy and paste that in.
Problem 1: Verilog components
In this problem, you will be designing the components that you will need for your multiplier in Verilog. We would like you to implement the 3rd version of the sequential multiplier as shown in lecture. You will be using Xilinx's Project Navigator to manage your project. The toolflow tutorial you have gone through showed you how to open and create Verilog and schematic files.
1a) Implement the components you will need for your multiplier. Specifically, you will need an adder, a product register, and a multiplicand register. Each component should be its own Verilog module. You are allowed to use behavioral Verilog for these components. Be sure to give an overview of how your components are designed in your report. We have included skeleton modules in the M:\lab2 directory. You may add or remove signals to these skeleton modules as you wish. Also, include your Verilog code as appendices in your report.
1b) Test each of your components individually. This is a part of the technique known as incremental testing. By verifying that each of your components works independently, it will make debugging a lot easier later when all the components are put together. We would like you to build test benches for each of your components and run simulation using Modelsim. Include these test benches and relevant Modelsim output in your report. What is your testing methodology?
1c) Assemble your finished components using the Xilinx ECS schematics editor to build your datapath. To do this, you need to create schematic symbols for you Verilog module. First, make sure that the file containing your module is selected in the "Sources in Project" window. Under the "Processes for Current Sources" window, expand the item that says "Design Entry Utilities." Double click on the "Create Schematic Symbol line. Now, you can open up the schematics editor by going to Project -> New Source, and choosing Schematic. Name your datapath multiplier.sch. You will notice that your symbols are ugly rectangle. Learning how to change the appearance of schematic symbols will make your datapath a lot easier to read. To do this, right click on your symbol, highlight the item that says symbol, and then choose edit symbol. Modify your symbols so that your datapath looks like the one in the lecture slides. Note that you cannot connect all of the wire just yet; you still have to do control. Turn in a copy of your datapath after the control is connected (after part 2c).
Problem 2: Control
Now that your datapath is finished, you can give yourself a pat on the back. However, a working datapath is useless without control. Remember the 5 components of a computer?
2a) Hint! Read part 2b and 2c before attempting 2a!! Using Verilog, build a controller for your multiplier. As shown and discussed in lecture, your controller should take in the LSB of the product as input, and produce 3 control signals, one for the adder, one for shifting, and one for the write enable into the product register. Your controller must control your datapath according to the algorithm given in lecture. Look carefully at the skeleton controller we have provided.
2b) Typically in a processor, the values into the multiplicand and multiplier register are placed the register file, but since we don't have a processor (yet!), our controller will have to be able to do this task as well. Therefore, your controller must take in two 32 bit values and a reset signal as well. These will be used to actually give your multiplier something useful to do! The two 32 bit values are the multiplier and the multiplicand. Upon receiving a reset high, your controller will put the multiplier and multiplicand into their respective registers (this means that you may have to add additional outputs from your controller to the datapath that aren't shown in the lecture slide diagrams). Once the reset signal drops back to low, your controller is to begin executing the algorithm.
2c) Write a testbench to test your controller. You may choose to either test parts 2a and 2b separately or all at once after you've finished both parts. Please explain which way you chose, and why.
Problem 3: Tying it all together
3a) Now that we have a functional datapath and control unit, we can finally put them together. The simplest way to do this would be to do this would be to create a schematic for the control unit, and just add the control unit into the datapath you created before. What are the input and output signals (signals to go to or come from the outside world) of your multiplier? What signals are internal to your multiplier? Take your entire multiplier datapath (with the controller), and create a single module. You can do this by creating a seperate module that instantiates your datapath. For example:
module finalMultiplier(value1, value2, answer, clk);
input [31:0] value1, value2;
input clk;
output [63:0] answer;
datapath myDatapath(....);
endmodule
Call this file multiplier.v
3b) Simulate your multiplier with a set of judiciously chosen test vectors in a test bench. Explain your criteria for choosing numbers. Turn in a log of your simulation.
3c) Build a top-level Verilog module to take your multiplier through its paces. This top-level module should include your multiplier module, and should apply pseudo-random 32-bit numbers to the multiplier and check that the result is correct, and print out the results in the following form:
1: number1 * number2 = result
2: number3 * number4 = result
3: number5 * number6 = result
4: number7 * number8 = result
.
.
.
If there is ever a failure, you should flag it, like this:
>>>ERROR<<<
>>>5: number9 * number10 = result
>>>
Should be: realresult
If you tested well in the previous two parts, you should probably find little, if any, error messages. You should be able to run this random vector test for a long time, but try a small number of results first. Turn in a trace from a 100-number loop. Turn in a list of your code and a trace of your output.
Hint: here you will want to use Verilog system functions. There is the $random function to get random values and the $display function to print results. There is an online Verilog manual under the handouts sections. Look at chapter 17 (17.1 talks about $display and 17.9 talks about $random).
Problem 4: Going to board!
Now we get to the exciting part!
4a) In this part, you will be pushing your multiplier down to the Calinx board. This involves using the Synplify tool to create a netlist, the Xilinx tools to place and route the design, and finally the Xilinx iMPACT tool to send the created bitstream to the board. Please note that this is a very complicated process, especially for people who have never done it before. Follow the steps in the tutorial and during the demo, and ask your TAs or fellow students who have taken EECS150 recently for help.
4b) We have provided you with a top-level wrapper module, called top_level.v. The top_level module will connect your multiplier to the input/output pins of the FPGA, which will allow you to take in actual inputs from the board, and display your results on the hex LEDs.We will be using the dipswitches on the board as input to the multiplier, one of the push buttons to be the reset button, and the hex LED as output. Look inside the top_level.v, there are a lot of comments inside that tell you what to do.
4c) Look at your Xilinx reports. How many LUTs did your multiplier use? How many Slices?
4c) You will need to demo your completed multiplier on the board to your TA during your section, so save all of your files.