-
Notifications
You must be signed in to change notification settings - Fork 3
/
wdog_reg_model.sv
66 lines (47 loc) · 2.23 KB
/
wdog_reg_model.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
/* ~wdog_reg_model~ is top level register environment which consists
of REGISTER BLOCK, REGISTER ADAPTER AND REGISTER PREDICTOR. It is
extended from UVM_ENV and thus is a uvm_component which makes it
visible in component tree. */
class wdog_reg_model extends uvm_env;
`uvm_component_utils(wdog_reg_model)
// ~seqr~ which will be connected with reg_block. Will be passed
// from top class
uvm_sequencer#(apb_seq_item) seqr;
// Register block and adapter
wdog_reg_block reg_block;
wdog_reg_adapter reg_adapter;
// Predictor for reg
uvm_reg_predictor#(apb_seq_item) reg_predictor;
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);
// Function: start_of_simulation_phase
extern function void start_of_simulation_phase(uvm_phase phase);
endclass //wdog_reg_model extends uvm_object
// *************************************************************
// Funciton Implementation
// *************************************************************
function void wdog_reg_model::build_phase(uvm_phase phase);
// Build the register block
reg_block = wdog_reg_block::type_id::create("reg_block",this);
reg_block.build();
// Build adapter and predictor for reg model
reg_adapter = wdog_reg_adapter::type_id::create("reg_adapter", ,get_full_name);
reg_predictor = uvm_reg_predictor#(apb_seq_item)::type_id::create("reg_predictor", this);
endfunction: build_phase
function void wdog_reg_model::connect_phase(uvm_phase phase);
super.connect_phase(phase);
// set address map and adapter for PREDICTOR
reg_predictor.map = reg_block.default_map;
reg_predictor.adapter = reg_adapter;
endfunction: connect_phase
function void wdog_reg_model::start_of_simulation_phase(uvm_phase phase);
super.start_of_simulation_phase(phase);
// set sequencer and base address for the address map
reg_block.default_map.set_sequencer(seqr, reg_adapter);
reg_block.default_map.set_base_addr('h00);
endfunction: start_of_simulation_phase