-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathaxi_master.sv
50 lines (37 loc) · 1.71 KB
/
axi_master.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
class axi_master extends uvm_agent;
`uvm_component_utils(axi_master)
// Components
uvm_sequencer#(axi_transaction#(D_WIDTH, A_WIDTH)) w_seqr;
uvm_sequencer#(axi_transaction#(D_WIDTH, A_WIDTH)) r_seqr;
axi_m_driver drv;
axi_m_monitor mon;
uvm_analysis_port#(axi_transaction#(D_WIDTH, A_WIDTH)) ap;
// Variables
env_config env_cfg;
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 //axi_master extends uvm_agent
function void axi_master::build_phase(uvm_phase phase);
env_cfg = new("env_cfg");
assert (uvm_config_db#(env_config)::get(this, "", "config", env_cfg)) begin
`uvm_info(get_name(), "vif has been found in ConfigDB.", UVM_LOW)
end else `uvm_fatal(get_name(), "vif cannot be found in ConfigDB!")
drv = axi_m_driver::type_id::create("drv", this);
mon = axi_m_monitor::type_id::create("mon", this);
w_seqr = uvm_sequencer#(axi_transaction#(D_WIDTH, A_WIDTH))::type_id::create("w_seqr", this);
r_seqr = uvm_sequencer#(axi_transaction#(D_WIDTH, A_WIDTH))::type_id::create("r_seqr", this);
drv.vif = env_cfg.intf;
mon.vif = env_cfg.intf;
ap = new("ap", this);
endfunction: build_phase
function void axi_master::connect_phase(uvm_phase phase);
super.connect_phase(phase);
drv.seq_item_port.connect(w_seqr.seq_item_export);
drv.seq_item_port2.connect(r_seqr.seq_item_export);
mon.ap.connect(ap);
endfunction: connect_phase