-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwdog_env.sv
71 lines (51 loc) · 1.88 KB
/
wdog_env.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
60
61
62
63
64
65
66
67
68
69
70
class wdog_env extends uvm_env;
`uvm_component_utils(wdog_env)
// Register model
wdog_reg_model reg_model;
// Agents
apb_agent apb_agnt;
wdog_agent wdog_agnt;
// Scoreboard
wdog_scoreboard wdog_scb;
// Reset Generator
wdog_reset_generator wdog_rst_gen;
// Functions
function reset_frc();
fork
wdog_rst_gen.reset_frc();
join_none
endfunction
function reset_module();
fork
wdog_rst_gen.reset_module();
join_none
endfunction
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction //new()
// Function: build_phase
extern function void build_phase(uvm_phase phase);
// Function: connect_phase
extern function void connect_phase(uvm_phase phase);
endclass //wdog_env extends uvm_env
function void wdog_env::build_phase(uvm_phase phase);
// Building reg model
reg_model = wdog_reg_model::type_id::create("res_model", this);
// Building agents
apb_agnt = apb_agent::type_id::create("apb_agnt", this);
wdog_agnt = wdog_agent::type_id::create("wdog_agnt", this);
// Building Scoreboard
wdog_scb = wdog_scoreboard::type_id::create("wdog_scb", this);
// Building Reset generator
wdog_rst_gen = wdog_reset_generator::type_id::create("wdog_res_gen", this);
endfunction: build_phase
function void wdog_env::connect_phase(uvm_phase phase);
super.connect_phase(phase);
// Initializing the ~seqr~ in reg_model with the ~seqr~ in apb agent
reg_model.seqr = apb_agnt.seqr;
// Connecting analysis port of ~apb_agnt~ to predictor of reg model
apb_agnt.ap.connect(reg_model.reg_predictor.bus_in);
// Connecting analysis port of ~apb_agnt~ to scoreboard
apb_agnt.ap.connect(wdog_scb.apb_ap_imp);
wdog_agnt.ap.connect(wdog_scb.wdog_ap_imp);
endfunction: connect_phase