37 class apb_driver extends uvm_driver #(apb_seq_item, apb_seq_item);
60 extern function int
sel_lookup(logic[31:0] address);
66 extern function
new(string name = "apb_driver", uvm_component parent = null);
80 function
apb_driver::new(string name = "apb_driver", uvm_component parent = null);
81 super.
new(name, parent);
92 @(posedge APB.PRESETn);
99 seq_item_port.get_next_item(req);
102 psel_index = sel_lookup(req.addr);
103 if(psel_index >= 0) begin
104 APB.PSEL[psel_index] <= 1;
105 APB.PADDR <= req.addr;
106 APB.PWDATA <= req.data;
107 APB.PWRITE <= req.we;
114 req.data = APB.PRDATA;
118 `uvm_error("RUN", $sformatf("Access to addr %0h out of APB address range", req.addr))
121 seq_item_port.item_done();
126 function void apb_driver::build_phase(uvm_phase phase);
127 if(!uvm_config_db #(apb_agent_config)::get(this, "", "apb_agent_config", m_cfg)) begin
128 `uvm_error("build_phase", "Unable to get apb_agent_config")
130 endfunction: build_phase
132 function int apb_driver::sel_lookup(logic[31:0] address);
133 for(int i = 0; i < m_cfg.no_select_lines; i++) begin
134 if((address >= m_cfg.start_address[i]) && (address <= (m_cfg.start_address[i] + m_cfg.range[i]))) begin
139 endfunction: sel_lookup
int sel_lookup(logic< 31:0 > address)
Looks up the address and returns PSEL line that should be activated.
apb_agent_config m_cfg
Driver configuration. Normally this aliases with the parent agent configuration.
Encapsulates APB agent configuration settings.
void build_phase(uvm_phase phase)
Merely obtains the driver configuration from the UVM Configuration DB.
interface apb_if(input PCLK, input PRESETn)
APB bus interface with very simple property checking.
new(string name="apb_driver", uvm_component parent=null)
Conventional UVM component constructor.
Implements an APB bus master acting as the driver of an APB agent.
task run_phase(uvm_phase phase)
Forks off a forever loop in which the driver pulls transactions and drives them on the APB bus...
uvm_component_utils(apb_driver) virtual apb_if APB
Reference to the APB interface.