Separated manager and subordinate drivers

Other clean up and changes
This commit is contained in:
2025-08-23 17:03:40 -07:00
parent 3e82cd5455
commit 8d8ea4443c
9 changed files with 252 additions and 116 deletions

View File

@@ -5,14 +5,15 @@
typedef axi_sequencer;
class axi_agent extends uvm_agent;
axi_agent_type_t agent_type;
virtual `AXI_INTF.MANAGER m_if;
virtual `AXI_INTF.SUBORDINATE s_if;
axi_agent_type_t agent_type;
virtual `AXI_INTF.MANAGER m_if;
virtual `AXI_INTF.SUBORDINATE s_if;
virtual `AXI_INTF mon_if;
// Declare the sequencer and driver
axi_sequencer sequencer;
axi_driver driver;
axi_monitor monitor;
axi_sequencer sequencer;
axi_driver driver;
axi_monitor monitor;
`uvm_component_utils_begin(axi_agent)
`uvm_field_enum(axi_agent_type_t, agent_type, UVM_DEFAULT)
@@ -35,13 +36,23 @@ class axi_agent extends uvm_agent;
// Build phase
virtual function void build_phase(uvm_phase phase);
sequencer = axi_sequencer::type_id::create("sequencer", this);
driver = axi_driver::type_id::create("driver", this);
if (agent_type == MANAGER) begin
// TODO: Additional variable md should not be needed. We should
// able to use the 'driver' variable directly. But in Verilator
// it results in an error: "No common base class exists"
axi_manager_driver md = axi_manager_driver::type_id::create("driver", this);
driver = md;
end else begin // if (agent_type == SUBORDINATE) begin
axi_subordinate_driver sd = axi_subordinate_driver::type_id::create("driver", this);
driver = sd;
end
monitor = axi_monitor::type_id::create("monitor", this);
// Propagete the agent type to driver and monitor
driver.set_agent_type(agent_type);
monitor.set_agent_type(agent_type);
// Acquire the virtual interfaces from the configuration database
if (agent_type == MANAGER) begin
if (!uvm_config_db#(virtual `AXI_INTF.MANAGER)::get(this, "", "axi_dvr_vif", m_if)) begin
`uvm_fatal("axi_agent", "AXI agent MANAGER interface not configured")
@@ -54,8 +65,15 @@ class axi_agent extends uvm_agent;
`uvm_info("axi_agent", $sformatf("Using AXI agent SUBORDINATE interface: axi_dvr_vif"), UVM_LOW)
end
driver.set_virtual_intefaces(m_if, s_if);
monitor.set_virtual_intefaces(m_if, s_if);
if (!uvm_config_db#(virtual `AXI_INTF)::get(this.get_parent(), "", "axi_mon_vif", mon_if)) begin
`uvm_fatal("axi_agent", "AXI monitor interface not configured")
end
`uvm_info("axi_agent", $sformatf("Using AXI monitor interface: axi_mon_vif"), UVM_LOW)
// Propagate the virtual interfaces to driver and monitor
driver.set_virtual_interfaces(m_if, s_if);
monitor.set_virtual_interfaces(m_if, s_if);
monitor.set_monitor_virtual_interface(mon_if);
endfunction
// --------------------------------------------------