Given Below is a test module with extended transaction class,
- $test$plusargs ("TEST1") arguments are applied run-time through Makefile e.g +TEST1 with vsim command.
- For TEST2, After building all transactors, we need to assign child/extended transaction handle to transaction handle in Generator Class, so as to create extended transaction using parent/base class handle.
- Package File
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
| import counter_pkg::*;
class counter_trans_load extends counter_trans;
randc logic [3:0] data;
constraint r1 {rst inside {0, 1};}
constraint l1 {load inside {0, 1};}
constraint d1{super.data == data;}
endclass
class test;
virtual counter_if.WR_BFM wr_if;
virtual counter_if.WR_MON wrmon_if;
virtual counter_if.RD_MON rdmon_if;
counter_env env;
counter_trans_load trans_ld_h;
function new( virtual counter_if.WR_BFM wr_if,
virtual counter_if.WR_MON wrmon_if,
virtual counter_if.RD_MON rdmon_if);
this.wr_if = wr_if;
this.wrmon_if = wrmon_if;
this.rdmon_if = rdmon_if;
env = new(wr_if, wrmon_if, rdmon_if);
endfunction
task build_and_run;
if($test$plusargs("TEST1"))
begin
no_of_transaction = 250;
env.build();
env.run();
$finish;
end
if($test$plusargs("TEST2"))
begin
trans_ld_h = new();
no_of_transaction = 250;
env.build();
env.gen_h.trans_h = trans_ld_h;
env.run();
$finish;
end
endtask
endclass :test
|