-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestbench.v
More file actions
57 lines (45 loc) · 1.21 KB
/
testbench.v
File metadata and controls
57 lines (45 loc) · 1.21 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
54
55
56
57
// test bench
module ram_tb();
reg [9:0] addr;
reg [7:0] data_in;
reg wr, cs;
wire [7:0] data_out;
integer i, seed;
// instantiation of ram module
ram_3 ff(data_out, data_in, addr, wr, cs);
initial
begin
seed = 35;
wr = 0;
cs = 0;
end
initial
begin
$display("Helo lijin");
for(i=0; i<=1023; i=i+1)
begin
// $display("address = %b", addr);
// $display($time, " address = %5d | data_in = %4d | data_out = %4d", addr, data_in, data_out);
addr = i;
data_in = (i*3) % 256;
wr = 1;
cs = 1;
#2 ;
wr = 0;
cs = 0;
#2;
end
#2 ;
$display("hey mahn");
repeat(20)
begin
#2 addr = $random(seed) % 1024;
wr = 0;
cs = 1;
$display($time, " address = %5d | data_in = %4d | data_out = %4d", addr, data_in, data_out);
cs = 0;
#1;
end
$finish();
end
endmodule