
Also add the following instruction before compil-
ing your code:
• select Project > Add/Remove Files in Project... and
add the file clock.vhd to your project.
Test your design and demonstrate it to the instruc-
tor to get credit for completing the lab.
Lab Report
Submit a report to the appropriate dropbox with your
working VHDL code.
Hints and FAQs
Q: How do I reset the state machine?
A: is is up to you. You can use the fact that the
FPGA’s registers power up in the all-zeros state, you
can detect invalid states, or you can use one of the
pushbuttons on the FPGA board (e.g. KEY(0)) as a
reset input.
Q: How do I implement the “combinational logic”?
A: One way is to use a selected assignment with 9
choices plus a default. Perhaps something like:
with row_q & col select
led(3 downto 0) <=
x"1" when "011011",
...
x"0" when others ;
where row_q and col are the row output and column
input respectively.
Q: How do I detect if a button is not pushed?
A: col = "111"?
Q: How do I troubleshoot my design?
A: You can (temporarily) connect signals to the
LEDs. You can also use the SignalTap II logic ana-
lyzer (see Appendix).
Connector Pinouts
e following diagrams show the connector pinouts:
1
2
39
40
cable connector
red stripe
keypad
pins
8 1
13 27
1
2
39
40
DE0-Nano PCB header
... ...
e following table shows the correspondence be-
tween the keypad row or column, the ribbon cable
connector pin and the corresponding GPIO-0 con-
nector pin:
GPIO FPGA keypad cable VHDL
name pin pin pin signal
GPIO_08 A5 8 13 row(3)
GPIO_010 B6 7 15 row(2)
GPIO_012 B7 6 17 row(1)
GPIO_016 C8 4 21 col(3)
GPIO_018 E7 3 23 col(2)
GPIO_020 E8 2 25 col(1)
Using the SignalTap II Logic Analyzer
is tool adds logic to your design that allows you to
capture the real-time behaviour of signals inside the
FPGA.
• select Tools -> Signal Tap II Logic Analyzer
• under JTAG Chain Configuration -> Setup... select
USB Blaster
• under SOF Mananger click on ... and select the cor-
rect .sof (FPGA serial programming) file in the
output_files folder
• click on the download (“Program Device”) icon to
make sure the device is recognized and can be pro-
grammed.
3