// ---------------------------------------------------------------------- class axi_subordinate_driver extends axi_driver; `uvm_component_utils(axi_subordinate_driver) // -------------------------------------------------- // Constructor function new(string name = "axi_subordinate_driver", uvm_component parent = null); super.new(name, parent); endfunction // -------------------------------------------------- virtual task run_phase(uvm_phase phase); `uvm_info("run_phase", $sformatf("Running AXI subordinate driver: %s", get_full_name()), UVM_LOW) if (s_if == null) begin `uvm_error("run_phase", "subordinate interface is null, cannot respond to transactions") end forever begin @(posedge s_if.ARESETn); while (s_if.ARESETn != 0) begin @(posedge s_if.ACLK); // Following could happen on the same cycle if (s_if.AWVALID == 1'b1) begin respond_to_write_txn(); end if (s_if.ARVALID == 1'b1) begin respond_to_read_txn(); end @(negedge s_if.ACLK); end end endtask // ------------------------------------------------------------ task respond_to_write_txn(); axi_transaction req; req = axi_transaction::type_id::create("req"); req.txn_type = AXI_WRITE; req.addr = s_if.AWADDR; req.data = s_if.WDATA; req.strb = s_if.WSTRB; @(posedge s_if.ACLK); `uvm_info("respond_to_write_txn", $sformatf("Responding to AXI write transaction:\n%s", req.sprint()), UVM_LOW) s_if.AWREADY = 1'b1; endtask // ------------------------------------------------------------ task respond_to_read_txn(); axi_transaction req; req = axi_transaction::type_id::create("req"); req.txn_type = AXI_READ; req.addr = s_if.ARADDR; @(posedge s_if.ACLK); `uvm_info("respond_to_write_txn", $sformatf("Responding to AXI write transaction:\n%s", req.sprint()), UVM_LOW) s_if.ARREADY = 1'b1; endtask endclass : axi_subordinate_driver