-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataMemory_fixture.v
54 lines (45 loc) · 1.13 KB
/
DataMemory_fixture.v
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
54
`include "DataMemory.v"
module DMFixture;
reg [15:0] addr_in, data_in;
wire [15:0] data_out;
reg clk, rst, WriteEnable;
integer i;
DM dm1(.addr_in(addr_in), .data_in(data_in), .data_out(data_out), .WriteEnable(WriteEnable), .clk(clk), .rst(rst));
initial begin
$display("Time\tdata_in\t\t\taddr_in\t\t\tWE\tdata_out \clk \rst");
$display("-------------------------------------------------------------------------------------------------------------");
$monitor("%0d\t%b\t%b\t%b\t%b\t%b\t%b", $time, data_in, addr_in, WriteEnable, data_out, clk, rst);
end
initial begin
rst = 0;
#10;
rst = 1;
for (i = 0; i < 16; i = i + 1) begin
addr_in = i;
#5;
end
for (i = 0; i < 16; i = i + 1) begin
addr_in = i;
#5;
end
end
initial begin
#80
WriteEnable = 1;
addr_in = 4'b0000;
data_in = 4'b1111;
#10
WriteEnable = 0;
end
// Setup the clock to toggle every 10 time units
initial
begin
clk = 1'b0;
forever #5 clk = ~clk;
end
// Finish the simulation at time 200
initial
begin
#200 $finish;
end
endmodule