Be a Hardware Hacker!
Send an email to the TA (Meenakshi Sundaram) 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: January 10
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 Vikram 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: January 10
Due: January 10
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 . It should already be installed in the labs. For personal use (laptops, home desktops etc.):
Go to this link.
You will reach a webpage as the one shown below. YOU WANT VERSION 11.5, NOT 12.4 , so click on the link as instructed in the screen-shot.
Following you can click on "All Platforms (WebPACK)" under "ISE - 11.1 Full Product Installation" to download the tar file. Do NOT download the 11.5 directly, it is just an update download and not a full package.
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.
The link in the same page "Obtain a v10.1 Registration ID" will get you a registration ID which you will need during installation.
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.
Extract the downloaded file and run setup to install the Webpack(we recommend Windows platforms). Enter the Registration ID (Obtain the Registration ID if you dont have it already, the link in the installation window will take you to the right page) and finish the installation.
MAKE SURE YOU DOWNLOAD THE LATEST UPDATES (THIS WILL MAKE SURE YOU GET VERSION 11.5. THE 11.5 VERSION IN DOWNLOADS LINK IS JUST AN UPDATE DOWNLOAD, NOT FULL PACKAGE), otherwise you might run into some very weird tool behaviors. Note: you will be using version 11.5, 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 create a proper Verilog Testbench Fixture as you did in the Xilinx tutorial.
- You need to modify the Testbench Fixture generated by the tool to give proper stimulus and make sure the clock will run at 500MHz (Hint : t=[1/f] and clock toggles every t/2). A sample Testbench with stimulus is shown in the tutorial.
- Simulate for below set of Inputs :
- One input is consecutive 8 bit odd numbers and other is consecutive 8 bit even numbers. For example, 1+2, 3+4, 5+6 etc. Your testbench should generate such pair at every clock cycle. Try a pattern which can give you both even and odd numbers as sum. 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 (Make sure you have selected 'Implementation' in your 'Sources'. 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: January 10