Introduction to FPGA Part 7 - Verilog Testbenches and Simulation | Digi-Key Electronics

preview_player
Показать описание
A field-programmable gate array (FPGA) is an integrated circuit (IC) that lets you implement custom digital circuits. You can use an FPGA to create optimized digital logic for things like digital signal processing (DSP), machine learning, and cryptocurrency mining. Because of the FPGA’s flexibility, you can often implement entire processors using its digital logic. You can find FPGAs in consumer electronics, satellites, and in servers used to perform specialized calculations.

In this series, we will see how an FPGA works and demonstrate how to create custom digital logic using the Verilog hardware description language (HDL).

Uploading your design to a real FPGA can sometimes take a while (especially for larger designs and denser FPGAs). Additionally, to check the timing and operation for fast-changing signals (think RAM bus or USB signals), you would need other specialized test equipment, such as a logic analyzer. Connecting all of the FPGA pins to a logic analyzer can also be a time-consuming processor.

To save us time, we can write Verilog code that tests our design (known as a “testbench”). We use a special simulation program (Icarus Verilog, in our case) to run the testbench code. The testbench code should instantiate the module(s) under test (often called a “unit under test” or “uut”) and toggle the necessary input lines.

The simulation will run our testbench, and it will log all how and when the various signals/wires change in the design. It will store this log in a “value change dumpfile” (.vcd). We can use a waveform viewer, such as GTKWave, to visualize these changes. The waveforms should look similar to what you might find on a logic analyzer.

Product Links:

Related Videos:

Related Project Links:

Related Articles:

Learn more:
Рекомендации по теме
Комментарии
Автор

This is an amazingly helpful series! Thank you for making the internet a more knowledgeable place.

theomacphail
Автор

Shawn you got me started with your class on Udemy. Then I stumbled upon this Digi-Key. I like your clear and clean instructions and explanations. Glad I found it.

Icr
Автор

Muito Obrigado por democratizar esse conhecimento ❤

vaniaeli
Автор

At some point can you cover clock networks/PLLs? Nearly every FPGA has a huge section of their datasheet discussing clock networks, clock pins, buffers, and a half dozen other things I'm never quite sure how they act together, if I need them, when I would need them, and how I use/interact with them in verilog.

CrimsonTide
Автор

And also a quick note:
the # delay command needs to be terminated with semicolon ; or have a command with semicolon after it.
So for example in the code:
#10
rst_btn = 0;
the #10 line is using the semicolon after the rst_btn=0

radekhladik
Автор

I looked at the solution for the challenge verses what was shown in the video for creating test benches and you would be hard pressed to come the final solution with out additional help and resources. The video covers a binary counter and challenge a FSM, I am not sure for a beginner how would solve it on your own.

johningram
Автор

Am i understand right, the simulation goes Only on the PC and not on the chip itself. Then how we can be sure that the simulator and the real chip will work the same?!
Thanks for vids.

aleXelaMec
Автор

Any pointers for automation of tests ?

sami-pl
Автор

How to display the value of parameters and localparamereters in the verilog code in gtkwave?

ze
Автор

To the ones not very familiar with HDLs, I suggest using VHDL instead of Verilog. Much more features, very good structure and easier in simulation

Ali-wfef