LAB#1
LAB#1
Electrical Engineering
Handout#01
Gate-Level Modelling and Simulation
Instructor: Engr Irsa Jan
Background Theory:
Gate-level Modelling:
Verilog is both a structural and behavioural language. Internals of each module can be
defined at four levels of abstraction, depending on the need of the design. There are four
levels of abstraction which include switch-level, gate-level, data flow, and behavioural or
algorithm level.
The switch-level is the lowest abstraction level, where module can be implemented
in terms of switches, storage nodes, and interconnections between them.
Verilog allows the designer to mix and match all four levels of design methodologies in
design. The modules behave identically to the external world identically irrespective of
the level of abstraction at which module is described. Therefore, internals of the module
can be changed without any change in the environment.
In the digital design community, the term register transfer level (RTL) is used for Verilog
description that uses a combination of behavioural and data flow modelling. Normally, the
higher level of abstraction, design will be more flexible and technology independent.
Although, the lower-level description provides high performance therefore as the design
matures, high level modules are replaced with the gate-level modelling.
Lab Activity:
We are going to use testbench listing 1.7 (2-bit comparator design and its test vector) you
have covered in chapter#1 of the textbook.
Steps:
1. Open https://www.edaplayground.com/.
2. Write your testbench code at the left and required modules on the right.
3. Add these two lines after initial begin
$dumpfile("eq2_tb.vcd"); // simulator generates output file for the waveforms data
$dumpvars;
Also, replace $stop with $finish.
Design a full adder circuit along with its test bench. You may give four input vectors (from
the table) in the test bench and observe the output from waveforms.
a b c_in sum c_out
1 0 0 1
2 1 1 0
3 1 0 1
4 1 1 1
Additionally, you are required to attach the input and output waveforms in your lab report.