-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsample.txt
More file actions
executable file
·53 lines (46 loc) · 1.5 KB
/
sample.txt
File metadata and controls
executable file
·53 lines (46 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Test bench for myFIFO..
`include "myFIFO.v"
module myFIFO_tb(); // this has no in/out ports..
// to drive the input of the myFIFO module
// declare the registers...
reg [3:0] data_in;
reg reset, clock;
// to tap the output from the module..
// declare the wire..
wire [3:0] data_out;
// initiaize all the variables..
initial begin
$dumpfile("myfifo.vcd");
$dumpvars(0, myFIFO_tb); // dumps everything...
reset <= 0;
clock <= 0;
data_in <= 0;
#5 reset <= 1; // assert the reset
#7 reset <= 0; // de-assert the reset
#8 data_in <= 4'b1011;
#10 data_in <= 4'b1010;
#12 data_in <= 4'b1000;
// #14 $display("+--------------------------------------------------------------------------+");
#15 $finish; // terminate the simulation...
end
always begin
#1 clock = ~clock; // Toggle the clock every 2 ticks...
$display("+---------------------------------------------+");
end
// Connect DUT to test bench...
// Explicit port declaration...
myFIFO fifo(
.data_in (data_in),
.clk (clock),
.rst (reset),
.data_out (data_out)
);
// print out the result of tb here....
initial begin
$display("+--------------------------------------------------------------------------+");
$display("|clock|reset|data_in|first|second|third|data_out|");
$display("+--------------------------------------------------------------------------+");
$monitor("| %h | %h | %h | %h | %h | %h | %h |",
clock, reset, data_in, myFIFO_tb.fifo.first, myFIFO_tb.fifo.second, myFIFO_tb.fifo.third, myFIFO_tb.fifo.data_out);
end
endmodule