Verilog Test-Bench
Verilog Test-Bench
Digital Design
(ECE/EEE/INSTR F215)
Dr. Anita Agrawal
Test Bench Creation
Why test benches are required at all?
module test_bench;
Test Verilog ➢Declare local reg and wire identifiers
bench module ➢Instantiate the design module under test
➢Specify a stopwatch, using $finish to terminate the
reg input
simulation
wire output ➢Generate stimulus using initial and always
statements
endmodule
For details2023
16 November on keywords with $, refer Section 4.12, Fourth Edition, M. Morris Mano et al.
Ruma Ghosh 2
Example
wire S;
wire C; // Outputs
initial begin
A = 0;
B = 0;
#100 A = 0;
#100 B = 1;
#100 A = 1;
#100 B = 0;
#100 A = 1;
#100 B = 1;
end
endmodule
Your Exercise
(a)Full adder
(b)4-bit Odd parity checker
Behavioral Model
✓Highest level of abstraction in HDL
✓Here any function or behavior of any digital system/gate is defined