2020-10-11 23:44:14 +00:00
|
|
|
|
.. _HDLs:Verilog:
|
|
|
|
|
|
2019-12-25 23:10:01 +00:00
|
|
|
|
Verilog on Fomu
|
|
|
|
|
---------------
|
|
|
|
|
|
2020-01-03 01:58:02 +00:00
|
|
|
|
“Hello world!” - Blink a LED
|
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2019-12-25 23:10:01 +00:00
|
|
|
|
|
2021-05-20 11:14:47 +00:00
|
|
|
|
The canonical “Hello, world!” of hardware is to blink a LED.
|
|
|
|
|
The directory :repo:`hdl/verilog/blink <hdl/verilog/blink>` contains a Verilog example of a blink project.
|
|
|
|
|
This takes the 48 MHz clock and divides it down by a large number so you get an on/off pattern.
|
2019-12-25 23:10:01 +00:00
|
|
|
|
|
2021-05-20 11:14:47 +00:00
|
|
|
|
Enter the :repo:`hdl/verilog/blink <hdl/verilog/blink>` directory and build the demo by using ``make``:
|
2019-12-25 23:10:01 +00:00
|
|
|
|
|
2020-10-05 06:38:33 +00:00
|
|
|
|
**Make sure you set the** ``FOMU_REV`` **value to match your hardware!** See :ref:`required-hardware`.
|
2019-12-25 23:10:01 +00:00
|
|
|
|
|
2020-03-06 22:42:23 +00:00
|
|
|
|
.. session:: shell-session
|
2019-12-25 23:10:01 +00:00
|
|
|
|
|
|
|
|
|
$ make FOMU_REV=$FOMU_REV
|
|
|
|
|
...
|
2020-01-11 12:34:08 +00:00
|
|
|
|
Info: Max frequency for clock 'clk': 73.26 MHz (PASS at 12.00 MHz)
|
2019-12-25 23:10:01 +00:00
|
|
|
|
|
2020-01-11 12:34:08 +00:00
|
|
|
|
Info: Max delay posedge clk -> <async>: 3.15 ns
|
2019-12-25 23:10:01 +00:00
|
|
|
|
|
|
|
|
|
Info: Slack histogram:
|
|
|
|
|
Info: legend: * represents 1 endpoint(s)
|
|
|
|
|
Info: + represents [1,1) endpoint(s)
|
2020-01-11 12:34:08 +00:00
|
|
|
|
Info: [ 69683, 70208) |**
|
|
|
|
|
Info: [ 70208, 70733) |
|
|
|
|
|
Info: [ 70733, 71258) |**
|
|
|
|
|
Info: [ 71258, 71783) |**
|
|
|
|
|
Info: [ 71783, 72308) |**
|
|
|
|
|
Info: [ 72308, 72833) |**
|
|
|
|
|
Info: [ 72833, 73358) |
|
|
|
|
|
Info: [ 73358, 73883) |**
|
|
|
|
|
Info: [ 73883, 74408) |*
|
|
|
|
|
Info: [ 74408, 74933) |**
|
|
|
|
|
Info: [ 74933, 75458) |**
|
|
|
|
|
Info: [ 75458, 75983) |*
|
|
|
|
|
Info: [ 75983, 76508) |*
|
|
|
|
|
Info: [ 76508, 77033) |**
|
|
|
|
|
Info: [ 77033, 77558) |**
|
|
|
|
|
Info: [ 77558, 78083) |*
|
|
|
|
|
Info: [ 78083, 78608) |
|
|
|
|
|
Info: [ 78608, 79133) |*************************
|
|
|
|
|
Info: [ 79133, 79658) |**
|
|
|
|
|
Info: [ 79658, 80183) |***
|
|
|
|
|
22 warnings, 0 errors
|
|
|
|
|
icepack blink.asc blink.bit
|
|
|
|
|
cp blink.bit blink.dfu
|
|
|
|
|
dfu-suffix -v 1209 -p 70b1 -a blink.dfu
|
|
|
|
|
dfu-suffix (dfu-util) 0.9
|
|
|
|
|
|
|
|
|
|
Copyright 2011-2012 Stefan Schmidt, 2013-2014 Tormod Volden
|
|
|
|
|
This program is Free Software and has ABSOLUTELY NO WARRANTY
|
|
|
|
|
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
|
|
|
|
|
|
|
|
|
|
Suffix successfully added to file
|
2019-12-25 23:10:01 +00:00
|
|
|
|
$
|
|
|
|
|
|
2021-05-20 11:14:47 +00:00
|
|
|
|
You can then load ``blink.dfu`` onto Fomu by using the same ``dfu-util -D`` command we’ve been using so far.
|
|
|
|
|
You should see a blinking pattern of varying color on your Fomu, indicating your bitstream was successfully loaded.
|
2019-12-25 23:10:01 +00:00
|
|
|
|
|
2020-01-11 12:34:08 +00:00
|
|
|
|
|
|
|
|
|
Reading Input
|
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
2021-05-20 11:14:47 +00:00
|
|
|
|
There is another small example in :repo:`hdl/verilog/blink-expanded <hdl/verilog/blink-expanded>` which shows how to read
|
|
|
|
|
out some given pins.
|
|
|
|
|
Build and flash it like described above and see if you can enable the blue and red LED by shorting pins 1+2 or 3+4 on
|
|
|
|
|
your Fomu (the pins are the exposed contacts sticking out of the USB port).
|