-
Notifications
You must be signed in to change notification settings - Fork 0
/
TopLevel_tb.sv
60 lines (47 loc) · 872 Bytes
/
TopLevel_tb.sv
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
55
56
57
58
59
module TopLevel_tb ();
logic clk,rst;
integer f;
reg [1023:0] mcd;
TopLevel TOPLevel (.clk(clk),.rst(rst));
initial
begin
clk<=0;
forever begin
#1 clk<=~clk;
end
end
initial
begin
if ($value$plusargs ("sig=%s", mcd))
begin
$display("STRING with FS has a value %0s", mcd);
f = $fopen(mcd,"w");
end
end
always_ff @(posedge clk)
begin
if((~TOPLevel.Dmem.wr)&(TOPLevel.ALUResult == 32'h00000F00))
//if(~TOPLevel.Dmem.wr)
begin
$fwrite(f,"%h\n", TOPLevel.data_wr);
end
if((~TOPLevel.Dmem.wr)&(TOPLevel.ALUResult == 32'hcafebeef))
begin
$finish;
end
end
initial
begin
rst<=1;
#20
rst<=0;
end
parameter count = 20000;
reg [31:0] loop;
initial begin
for (loop=0 ; loop < count ; loop = loop +1) begin
repeat (1) @ (posedge clk);
end
$finish;
end
endmodule