ECE-255 Project #2
Objective: Learn how to program the FPGA using VHDL.
1. Design and implement a 4-bit comparator using VHDL and the BASYS boards. The inputs are
the 8 switches on the board. The outputs are the three rightmost LEDs. Specifically,
a. The first 4 switches will be and the right 4 will be
b. The left LED goes on when , the middle LED goes on when , and the right
LED goes on when
c. The inputs are unsigned numbers.
d. You must design the circuit from basic AND, OR, and NOT gates. You may not use an
adder.
2. Implement a BCD -to-7-segment display code converter. The inputs will be the first 4 switches
and the outputs will be the 7 segment LEDS.
Potential Problem:
a) A student who has completed this part of the lab noted the followng problem:
“when I do the pin out assignments,the 7 segment displays are wrong on the
card that Digilent gives you . On the card it says the 4 displays from left to
right are AN3, AN2, AN1 AND AN0 with the pinouts being P34, P26, P32,
AND P33, respectively. I found (at least with my board, don't know if its just
a defect in mine) that the pinouts are shifted by 1: P26, P32, P33, AND P34.”
b) On some of your boards a 0 signal will cause the LED segments to light up,
rather than a 1 signal. I suspect there is a configuration parameter that
controls which signal lights up the LED segments. Rather than trying to
figure out how to set this configuration parameter, simply invert your logic if
your board’s LEDs light up on a 0 signal.
3. Your documentation should include the following:
a. VHDL code
b. Circuit schematic showing switches, LED connections, etc. Specifically I would like to
see the following schematics:
i. A detailed AND/OR/NOT circuit for the a and b segments of the BCD-to-7-
segment display code converter. It is not necessary to show me the detailed
circuits for the c-g segments.
ii. A detailed AND/OR/NOT circuit for the comparator circuit.
iii. A black box schematic for the BCD and comparator circuits showing black
boxes for the circuits and the switches and LED connections as inputs and
outputs.
For the detailed schematics you can simply label the inputs and outputs with descriptive
names rather than showing the switches or LED connections. For example, you can label
the LED outputs for the BCD circuit as a and b and you can label the inputs for the
comparator circuit as a3, a2, a1, a0, b3, b2, b1, b0.
c. Truth table: For the comparator, it is not necessary to show me all 256 entries for the
truth table. Instead use the "x" wildcard character to minimize the number of entries in
your truth table. For example:
let y0 be A=B, y1 be A < B, and y2 be A > B