Project 2: Double Sevens
Due Monday 23 September 2019
Purpose: to give you more experience with digital design components and introduce you to VHDL.
- 7-Segment Display Driver
Within your project2 directory, make a new subdirectory and a new Quartus project for this task (e.g. call it task1 or hexDisplay). Create a circuit that takes in four bits and drives a 7 segment display for the hexadecimal characters 0-9,A-F. Make sure you differentiate the 6 and the b. You can use either gate-level design or VHDL for this circuit. VHDL is recommended.
There are two 7-segment displays on the DE1 board (User Manual). Each one consists of seven individual bars which can be used to create numbers or letters. Your circuit should light up the proper segments to display a hexadecimal number when given the corresponding 4-bit binary integer value as input.
Demonstrate the 7-segment driver circuit using an 8-bit counter that drives two seven segment displays. This will require you to include two of your 7-segment display drivers into your top level design. Download this circuit onto the board and test it. To see the numbers, you may want to use a 24-bit counter and use the highest 8-bits as the input to your 7-segment driver.
Test this circuit using the board. Don't worry about testing using ghdl.
Take a screen capture of your circuit designs.
- Add Two Numbers
Within your project2 directory, make a new subdirectory and a new Quartus project for this task (e.g. call it task2 or addIt). Using either VHDL or graphic design, create a circuit that takes in two 4-bit binary numbers and outputs their sum as a 5-bit binary number. If you use the graphic design tool, you are free to use standard design elements from the Altera library. If you use VHDL, make use of the ieee.numeric_std.all package and make your inputs the type UNSIGNED.
Use the 8 switches on the board to control the two inputs. Display the output on the board's 7-segment display as two hexadecimal digits. Note that the most significant digit will always be a 0 or 1, since the output of the circuit is only a 5-bit number.
Note that you will probably want to convert the two 4-bit inputs into 5-bit signals prior to executing the addition in VHDL. Then the result of the addition is a 5-bit signal you can assign to the output signal variable. The concatenation operator in VHDL is the ampersand: &. The following expression concatenates the bit '1' with the bit string "0010". The result would be the bit string "10010".
'1 & "0010"
Given two vector signals A and B that are type UNSIGNED (3 downto 0), you could make them 5-bit numbers, add them together, and assign them to a signal of type UNSIGNED (4 downto 0) using the following signal assignment statement.
C <= ('0' & A) + ('0' & B);
Note that the above statement does not correctly handle the case where A and B are regarded as 2s complement numbers. How would you change the circuit to work for 2's complement instead of unsigned?
Test your final circuit. You can use either the board or GHDL. Make sure you describe your testing procedure in your project report.
- Adjust your circuit and demonstrate it works for 2's complement numbers.
- Create a circuit that takes in an 8-bit binary integer and returns three 4-bit values that represent the appropriate decimal representation. For example, the input 10100011 (hex A3) would return as 0001 0110 0011 (163 decimal).
- Add functionality to your second circuit so it can execute operations other than addition. Use the push buttons to control the operation.
- Make creative use of the board's inputs/outputs.
Create a wiki page with your report. For each task, write a short description of the task, in your own words.
- Include a picture of your final design.
- Include a picture of your simulation, if this is reasonable
- Describe the hardware testing you undertook to prove the circuit works.
- Include a description, and pictures, of any extensions.
Give your wiki page the label cs232f19project2.
Put your bdf/VHDL files in a folder called project2 in your private subdirectory on Courses/CS232.