CSE369 Lab1&2 Wi22
CSE369 Lab1&2 Wi22
CSE369 Lab1&2 Wi22
Lab Objectives
The first lab will introduce you to the Altera’s Terasic DE1-SoC development board and our primary
design tool this quarter, Intel’s Quartus Prime. Both of these components are very important for all
future labs so please pay attention.
We have combined the first two labs into one (with the later due date) to account for delays in
picking up lab kits. As this is the first lab, we strongly recommend that you treat this as two
separate labs (i.e., complete Tasks 1-3 around Lecture 2 and then Tasks 4-5 by the due date) so
that you have sufficient time to deal with any setup issues you may encounter. Even without
your lab kit, you can complete Tasks 1, 3, 4, and part of 5.
You will perform steps from the tutorial MANY times in subsequent labs, so taking notes on how
to do important tasks will save you lots of time later.
Open from the course website and complete Sections 0 through 8. You will
simulate two designs: and . Be sure to do all of the steps and ask the course staff for
help when you encounter issues. During your lab demo, you will need to show your simulation of
and give a brief verbal explanation of what actually does.
1) Which logical value (0 = FALSE = GND, 1 = TRUE = VDD) turns the red LEDs on?
1
Figure 1: Starter code for top-level module that defines the inputs and outputs that we will use in Lab 1.
2) Use a second inverter to connect the output of the first inverter to LEDR5.
3) Place a two-input NOR gate between two unused switches and an unused LED (your choice).
Recompile your modified project and load it onto your board to make sure that it behaves as you would
expect. Don’t forget to upload your modified alongside your lab report.
2
Task #4 – Digit Recognizer (Design)
Electronics can be cold and impersonal so let’s change that by having your DE1 recognize you! We want
to design a circuit that will light up an LED only when you input the last digit of your student ID
number. Your goal is to design the circuit out of NOT, NAND, and NOR gates using the fewest number of
gates possible.
To make it fair to those with more “difficult” student ID numbers, inverters hooked directly to a
switch output are not counted towards the “gates used” total (see Figure 2).
1) Find the last digit of your student ID number in the “Digit” column of Table 1 below – this is
known as Binary-coded decimal ( https://en.wikipedia.org/wiki/Binary-coded_decimal ).
2) Design the circuit by hand that will output a 1 only when the switch code matches your
particular Digit. Be sure that it also outputs a 0 for invalid inputs (e.g., all switches are 1).
Note that the testbench uses an “ ” statement to generate the input patterns, with
delays and a statement. However, the testbench is non-synthesizable (i.e., the code
doesn’t compile to hardware and is therefore only useful/meaningful in simulation).
3) In , implement the logic for a circuit that recognizes the last two digits of your student ID
number. will be the rightmost digit, encoded as in Task #4, and will be the
next digit, using a similar code (e.g., the digit 8 is encoded as , , , ).
Make sure to test your design in simulation BEFORE mapping it to the FPGA.
3
Lab Grading
Working Design: 90 points for correctness, style, and testing.
Logic Minimization: Up to 10 points for using as few logic gates as possible in Task #4.
Each gate (NOT, NAND, NOR) counts the same, though any NOT gates connected directly to
a switch input are not counted. The fewer gates, regardless of the number of chips, the
better the grade.
Note that we do not care about the number of gates in Part II (Verilog) – we’ll start worrying
about FPGA efficiency in later labs.
Be prepared to demo circuits from separate projects. Compile the bit files for both projects
ahead of time so that you don’t need to wait during your demo. In order to switch, close your
current Quartus project, open the next project, open , and then
load onto the DE1-SoC.
4
Lab 1 & 2 Rubric
Grading Criteria Points
100 pts