Be a Hardware Hacker!
To ensure that your reports will be submitted correctly, besides sending them through e-mail also bring a hard copy in class.
Removed the link to verilog tutorial slides. Use the slides from class instead, they are consistent with our coding standards.
Send an email to the TA with a "code-name" of your choice to be used instead of your personal info for the Grade-sheet
(your code-name should not under any circumstances reveal your identity). The subject line of your email should read "[CSE141L] LastName, FirstName CODENAME: my_codename".
Part 1: Log into the discussion board
Due: October 7
There is a link to the course's discussion board on the course homepage.
Your login is your official UCSD user name (i.e., your @ucsd.edu email
address without the "@ucsd.edu" part). Password is the same as the one
you use to access your university email account(AD password).
Take some time to explore the discussion boards features.
Reading the blackboard is mandatory. It is the only place that all
announcement related to class will be posted.
Need an account? If you are
enrolled through concurrent enrollment or, for some other reason do not
have an account, email Vasileios with your preferred username and he will
create an account for you.
Post a reply under the "Welcome" message in the administrative forum.
You don't need to hand anything in. If you are enrolled in 141 as well,
you only need to post once.
Due: October 7
Due: October 7
Lab 1 is a preparation stage for future labs, and consists of two parts - Xilinx ISE and Verilog. In Lab 1, you will install Xilinx ISE and follow a step-by-step tutorial to learn essential concepts and working flow in hardware designs. For those who used Xilinx ISE in 140L, this lab should be very easy. Otherwise, you should START NOW - there might be many unexpected problems. If you have any question regarding this lab, please post it on the blackboard.
Get Xilinx WebPack 10.1. It should already be installed in the labs. For personal use (laptops, home desktops etc.):
On this link click on "Download ISE WebPACK" from the Quick links.
If you already have an account with Xilinx, put your username and password. Otherwise, click on Create Account. Enter a username, password, email of your choice. You will soon receive an email from Xilinx for the activation of your account. As soon as you get the email, follow the instructions and log in to the Xilinx website.
You will reach a webpage as the one shown below. YOU WANT VERSION 10.1, NOT 11.1 , so click on the link as instructed in the screen-shot.
Following you can click on "+ -- Download Files Individually" and then "Download". Your browser should allow the pop-up window to appear. The tool is about 2.25GB. Using the university wireless connection took ~40mins. You probably want to use high speed internet or leave it downloading for a few hours while you sleep. Also remember the Registration ID since you will need it later.
Extract the downloaded file and run setup to install the Webpack(we recommend Windows platforms). Enter the Registration ID and finish the installation.
MAKE SURE YOU DOWNLOAD THE LATEST UPDATES, otherwise you might run into some very weird tool behaviors. Note: you will be using version 10.1, but many of the screen-shots in this lab and other labs may be of a slightly older version--so what you see may be a little different than what is pictured here.
Xilinx Quick Tutorial
Xilinx provides a good step-by-step tutorial. With this tutorial, you will be able to learn how to perform various activities in the hardware design process. It should take less than two hours to follow the tutorial.
- Get Xilinx quick tutorial .
- Follow instructions in the tutorial. You will design a simple counter module in Verilog.
- Try to understand the Verilog source file used in the tutorial. Note: the counter Verilog code in the tutorial has a minor typo; see if you can spot it.
- Since we will use Verilog in this class, you should skip VHDL related sections.
- Also, you do not need to follow "Download Design to the Spartan-3 Demo Board". We will not be using a demo board for this assignment.
A Simple 8 bit Adder
Now that you know how to use Xilinx ISE, we will examine a few aspects of hardware design. For more information, I highly recommend you skim through chapter 2 and chapter 5 of Xilinx In-depth Tutorial.
- Suppose that you got a job from 'San Diego Chip Factory'. Your boss gave you an adder design written in Verilog - adder.v to implement it in a Xilinx FPGA 'Virtex4 - XC4VLX15' (note that this device is different from the one in the Xilinx Quick Start Tutorial). Your first assigned task is to understand the source file thoroughly, and make a project in Xilinx ISE.
- Question 1. Draw a schematic for adder.v. In your schematic, you should clearly show the function of the design by using flip-flops, various gates, a comparator, an adder, and wires. Try to infer a schematic from the Verilog source, but it is fine to use a generated schematic from Xilinx ISE as long as it is detailed enough.
- To see what is really going on, perform a behavioral simulation. You need to make a proper Testbench Waveform file as you did in the Xilinx tutorial. Use timing parameters in the figure below - it is equivalent to 500MHz. Does it behave as you expected?
- You might have noticed that output 'isOdd' is updated one cycle later than 'out'. (Stupid...who wrote this?) Modify the verilog file so that 'isOdd' is simultaneously updated with 'out'. Perform the same behavioral simulation you did in the previous step again.
Question 2. Draw a schematic for your modified adder.
- After you checked your adder is functionally correct, it is time to synthesize. In the synthesize stage, Xilinx ISE translates your Verilog design to what its backend stage(implementation stage) can understand. To synthesize a design, just double-click "Synthesize-XST" in the "processes" window. Xilinx ISE generates reports for each major stage. You can read them in the 'Design Summary' tab as shown in the figure below. Skim through the generated synthesis report.
Question 3. How many flip flops are used for the design? How many LUTs does XC4VLX15 have, and how many LUTs does your design use? What is the 'estimated' achievable maximum frequency? (Ignore numbers in the figure below.)
- To actually program your FPGA, you need to "implement" your design. "Implement" is the term the Xilinx tools use for the stage which decides how to configure LUTs and networks of FPGA. For implementation, first you need to specify your timing constraints. You are targeting 2ns cycle time and 50% duty cycle as in the figure below. (You do not need to set 'clock-to-pad' and 'pad to setup' constraints.) With these constraints, Xilinx will generate a clock signal which alternates between high and low every 1ns. Then double-click "Implement Design". After implementation, Xilinx will generate a few reports. Skim through them.
- You can see detailed timing information in 'static timing report'. To find this report select "View Design Summary" in the Processes section (or click on the icon in the toolbar with the green sigma), then select "Synthesis Report" under "Detailed Reports" in the FPGA Design Summary section. In the report, you should see a term 'slack'. Slack is the time delay difference from what you expected (your timing constraints) to the actual delay. If slack is positive, it means your timing constraints are met and you might be able to increase frequency. Otherwise, you need to relieve your timing constraints so that no negative slack exists.
Question 4. How many 4-input LUTs and IOBs are used? As you learned in class, combinational logic is implemented by using LUT (Look Up Table) in FPGA. IOB (IO Block)s provide interfaces to external worlds. There are only a limited number of LUTs and IOBs, so you should watch their usage carefully.
Question 5. Was your initial time constraint met? If not, what is the minimum achievable cycle time? Actually change timing constraints and implement your design again, making sure there is no negative slack in your implementation. In the figure below, the design has negative slack - which means it failed to meet timing constraints. What is the maximum operating frequency of your adder? Compare the frequency with 'estimated' maximum frequency you got in Question 3. What caused the difference between two values? (Hint: See how much time is used for logic and delay respectively.)
- To show your boss that your adder would work at a certain frequency, you need to do a post-route simulation with the same testbench in Question 2. Sometimes, post-route simulation is also used to verify the validity of your implementation. (The result of post-route simulation should tally with that of the behavioral simulation.) Running a post-route simulation is very similar to running a behavioral simulation. Select (Post-route simulation) instead of (Behavioral simulation) as shown in the following figure, then double-click (Simulate Post-Place and Route Model).
- Question 6. Put two simulation results(behavioral and post-route) in your report. Are they the same? If not, why are they different? Modify the test bench file, and make sure post-route simulation works correct. (Hint: Behavioral simulations do not have a sense of frequency while post-route simulations do.)
32 bit Adder
- Now that your adder works fine, your boss wants you to extend your adder to support 32bit additions. Modify your verilog source file, synthesize it, and implement it. (Hint: You can very easily extend the existing 8bit adder to 32bit.)
- Generally, the more complex and the bigger a design is, the slower it is. Two important causes are: (1) more complex logics usually use more LUTs, thereby increasing their logic delays, (2) as a design gets bigger, it is increasingly difficult to place and route LUTs in their optimal places.
- Question 7. After you reported to your boss that bigger designs tend to be slower and use more resources, he is concerned about your adder's resource usage and the maximum operational frequency. To relieve his worries, fill out the following table. To impress him even more, include 16bit and 64bit adders, too.
| Width ||Max Freq (synthesis report) ||Max Freq (post P and R report) ||# of used 4 input LUTs || # of used IOBs
8 bit || || || ||
16 bit || || || ||
32 bit || || || ||
64 bit || || || ||
- Your next assigned task is to design a multiplier. You can easily make one by modifying your adder. First try a 32bit multiplier. For multipliers, the width of output should be (2 * the width of input), and they have to have 'isOdd' output.
- After synthesis, skim through the generated synthesis report. You should notice that DSP48s, which you have not seen before, are used for your design. Since multipliers are frequently used in digital designs, most Xilinx FPGAs include a few highly optimized multipliers such as DSP48.
- Question 8. Fill out the following table for 32bit, 48bit, and 64bit multipliers. (8bit and 16bit multipliers had some problems in the implementation stage.) Note that some multipliers might not fit in XC4VLX15 due to their demands on resources. In such cases, explain the reason.
| Width ||Max Freq (synthesis report) ||Max Freq (post P and R report) ||# of used DSP48s || # of used IOBs
|32 bit || || || ||
|48 bit || || || ||
|64 bit || || || ||
- Question 9. Draw two graphs for adders and multipliers with bit width as x axis and frequency(MHz) as y axis.
Free Form Experiment
Question 10. Now that you have gotten your feet wet with the tool, it's time for some free exploration. Design an experiment that answers some kind of question you have about the tool, and report on the results.
- No lab interview for lab 1. In future labs, you will have
interview sessions with a TA to show your results.
- Submit your report for the questions above to the TA via e-mail
by the due date before the beginning of the class. Also bring a hard copy or your report in class.
- Answer all of the questions (10) found in the lab description.
- The report should be in a single PDF file (including answers to
questions, verilog source code, graphs, screen-shots, etc). There
are many tools out there capable of integrating text and graphics
and producing PDF files (OpenOffice does a pretty good job).
- Name your PDF file cse141L-lab1-LastName-FirstName.pdf
with your last name and first name substituted for LastName and
- The subject line of your email should read "[CSE141L] Lab 1
Submission - LastName, FirstName".
Due: October 7