cse141L Lab 1: Be a Hardware Hacker!


April 01

Added a link to our google site with tips and tricks for using the tools. It'll be updated throughout the quarter. It's here. The page includes the course coding standards.

April 02

Complete this form 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).

April 03

Added clarification about LUTs. See Question 3 for details.

Part 1: Log into the discussion board

Due: April 08

There is a link to the course's discussion and announcement board on the course homepage. Sign up for them.

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.


  • Post a reply under the "Welcome" message in the forum. You don't need to hand anything in.
  • Due: April 08

    Part 2:

    Due: April 08

    Lab 1 is a preparation stage for future labs, and consists of two parts - Altera Quartus and Verilog. In Lab 1, you will install the Altera tools and follow a step-by-step tutorial to learn essential concepts and working flow in hardware designs. For those who used Altera Quartus 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.

    Remember to follow the coures coding standards for verilog. They are here.


    The main verilog development tools we use in this class are Altera's Quartus II Web Edition (version 12.0sp2) and ModelSim-Altera Starter. Both of these tools should already be on the lab machine. If you would like to install them for personal use (laptops, home desktops, etc.) here some instructions for downloading the tools:

    Altera Quick Tutorial

    Altera 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.

    A Simple 8 bit Adder

    Now that you know how to use Altera Quartus II, we will examine a few aspects of hardware design.

    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 Quartus as long as it is detailed enough.
    Question 2. Draw a schematic for your modified adder.
    Question 3. How many flip flops (a.k.a. registers) are used for the design? How many LUTs does the Cyclone II EP2C20F484C7 have, and how many LUTs does your design use? How many IO Pins are used? (Note: The number of LUTs in your design is not necessarily equivalent to the number of logic elements. Check out the schematic for a Cyclone II logic element here. You'll notice that a logic element contains a variety of things that may or may not be used, including a LUT, a register, some MUXes, and a carry chain. To see what the number of LUTs that you are actually using in your design are, go to "Fitter"->"Resource Selection"->"Resource Usage Summary" and add up the number of 4-input, 3-input, and <= 2-input LUTs.)
    Question 4. What is the minimum achievable cycle time and maximum frequency? What is the slack? Since we didn't specify a target clock cycle, what period and frequency did the tools use as a default target?
    Question 5. 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 correctly. (Hint: Behavioral simulations do not have a sense of frequency while post-route simulations do.)

    32 bit Adder

    Question 6. 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 3 input LUTs # of used IO Pins
    8 bit
    16 bit
    32 bit
    64 bit


    Question 7. Fill out the following table for 8bit, 16bit, 32bit, 48bit, and 64bit multipliers. Note that some multipliers might not fit in the Cyclone II 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 multipliers used # of used IO Pins
    8 bit
    16 bit
    32 bit
    48 bit
    64 bit
    Question 8. Draw two graphs for adders and multipliers with bit width as x axis and frequency(MHz) as y axis.

    Free Form Experiment

    Question 9. 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.

    Useful Resources


    • No lab interview for lab 1. In future labs, you will have interview sessions with a TA to show your results.
    • Submit your report as a single pdf file at ted.ucsd.edu. The link to upload the file is available under "Assignments"->"Lab 1: Be a hardware hacker". The deadline for submitting your report is Monday 8th 3PM . Do not send softcopies to TAs email ids
      • Answer all of the questions (9) 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 FirstName, respectively.

    Due: April 08