-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_write_read_diff.sv
61 lines (42 loc) · 1.16 KB
/
test_write_read_diff.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
//A program block that creates the environment and initiate the stimulus
`include "environment.sv"
program test(mem_intf vif);
class my_trans extends transaction;
constraint con_haddr { } ;
bit [1:0] cnt;
int count;
function void pre_randomize(); //read-write at same addresses
HWRITE.rand_mode(0);
// HADDR.rand_mode(0);
HSIZE.rand_mode(0);
HTRANS.rand_mode(0);
HTRANS=2; //NON-SEQ
HSIZE=1; //half-word
if(cnt %2 ==0) begin //0 ,2,4,6,8
HWRITE = 1;
// HADDR = count;
end
else begin //1,3,5,7,9
HWRITE = 0;
//HADDR = count;
end
cnt++;
endfunction
endclass
//declare environment handle
environment env;
my_trans my_tr;
initial begin
//create environment
env=new(vif);
my_tr = new();
//initiate the stimulus by calling run of env
env.gen.count = 10;
env.gen.trans = my_tr;
env.run();
end
initial begin
$display (" LOADING FILE IN TEST ");
$readmemh( "memfile.txt", env.scb.mem_array , 0, 255);
end
endprogram