1 module hwscan;
2 integer fd;
3 initial
4 begin
5 fd = $fopen("data2o.txt", "w");
6 end
7 always @(posedge tb.clk) begin
8 $fwrite(fd,"hw: (int=%d,reg=%d) ",tb.Count,tb.rcnt);
9 end
10 endmodule
2 integer fd;
3 initial
4 begin
5 fd = $fopen("data2o.txt", "w");
6 end
7 always @(posedge tb.clk) begin
8 $fwrite(fd,"hw: (int=%d,reg=%d) ",tb.Count,tb.rcnt);
9 end
10 endmodule
hwsan
1 `timescale 1ns/100ps;
2 module tb;
3 reg clk;
4
5
6 integer Count;
7 reg [7:0] rcnt;
8 /////////////////////
9 integer fdt;
10 ////////////////
11
12 initial
13 begin
14 fdt = $fopen("datat.txt", "w");
15 clk=0;
16 Count=0;
17 rcnt = 8'h0;
18 #10;
19 forever
20 #5 clk =~clk;
21 end
22 always@(posedge clk)
23 begin
24 $fwrite(fdt, "tb: (integer=%d,reg=%d) ", Count,rcnt);
25 Count=Count+1;
26 rcnt<=rcnt+1;
27 $fwrite(fdt, " <+1> [integer=%d,reg=%d]", Count,rcnt);
28 if (Count==124)
29 begin
30 $fwrite(fdt, " if {integer=%d,reg=%d} ", Count,rcnt);
31 Count=0;
32 rcnt<=0;
33 $fwrite(fdt, "<=0> |integer=%d,reg=%d| ", Count,rcnt);
34 end
35 $fwrite(fdt, " ");
36 end
37 endmodule
2 module tb;
3 reg clk;
4
5
6 integer Count;
7 reg [7:0] rcnt;
8 /////////////////////
9 integer fdt;
10 ////////////////
11
12 initial
13 begin
14 fdt = $fopen("datat.txt", "w");
15 clk=0;
16 Count=0;
17 rcnt = 8'h0;
18 #10;
19 forever
20 #5 clk =~clk;
21 end
22 always@(posedge clk)
23 begin
24 $fwrite(fdt, "tb: (integer=%d,reg=%d) ", Count,rcnt);
25 Count=Count+1;
26 rcnt<=rcnt+1;
27 $fwrite(fdt, " <+1> [integer=%d,reg=%d]", Count,rcnt);
28 if (Count==124)
29 begin
30 $fwrite(fdt, " if {integer=%d,reg=%d} ", Count,rcnt);
31 Count=0;
32 rcnt<=0;
33 $fwrite(fdt, "<=0> |integer=%d,reg=%d| ", Count,rcnt);
34 end
35 $fwrite(fdt, " ");
36 end
37 endmodule
tb
you will see the difference