This is an old revision of the document!


simulation

UNDER CONSTRUCTION

Learning digital logic design, Verilog and FPGA programming can be quite overwhelming at first, so much so that taking on another topic, such as simulation, is avoided. However, it well worth it to see how well your Verilog design will respond to external stimulus and in the process perhaps provide you with a better understanding of how Verilog code responds. So what is Simulation?

A simulation module, also known as a test-bench, produces fake signals used to see how a design module responds. The simulation environment itself is able to provide nanosecond timing and is much more than setting values to ones or zeroes. And, because the test code does not have to be synthesizable, we can use additional constructs provided by SystemVerilog.

In the following example, we will use Vivado 2022.1 Simulation to see how a design behaves to inputs. The design consists of a three input AND gate and a D-Flip-Flop to register the output. We will also take a look at a module designed to debounce mechanical switch closures and provide a slightly different approach to simulation.

We will start with the first design and its RTL Schematic diagram


We will start with the first design and its RTL Schematic diagram.


To begin, we need to add a simulation source file to our project. If you require a review of creating a simple design project, see Getting Started with Vivado for Hardware-Only Designs. Under the Project Manager section, choose Add Sources and create a simulation source file.


We want to create a SystemVerilog file instead of Verilog file. A SystemVerilog file exposes additional constructs that can be very helpful with our simulations. Give the simulation file a name. Our design module is called RegisterAndGate, so we will use Test_RegisterAndGate to indicate it is a simulation module. Press OK followed by Finish.


Before completing the process, the wizard will ask if our simulation module uses inputs and outputs. In general, test-bench modules do not use inputs or output, so press OK to continue followed by YES for confirmation.


The installation process may take quite a while. Find something else to work on until it completes.

I recommend making nachos. You definitely have time for it.