Apbbexxx
Apbbexxx
`define APB_AGENT__SV
apb_sequencer sqr;
apb_master drv;
apb_monitor mon;
apb_vif vif;
`uvm_component_utils_begin(apb_agent)
`uvm_field_object(sqr, UVM_ALL_ON)
`uvm_field_object(drv, UVM_ALL_ON)
`uvm_field_object(mon, UVM_ALL_ON)
`uvm_component_utils_end
`endif
-----------------------------------------------------------------------------------
-------------------------------------------------------
`uvm_object_utils(apb_config)
virtual apb_if vif;
endclass
-----------------------------------------------------------------------------------
---------------------------------------------------------
`ifndef APB_IF__SV
`define APB_IF__SV
`timescale 1ns/1ns
sequence at_posedge;
1;
endsequence : at_posedge
endclocking: mck
endinterface: apb_if
`endif
-----------------------------------------------------------------------------------
---------------------------------------
`ifndef APB_MASTER__SV
`define APB_MASTER__SV
`uvm_component_utils(apb_master)
event trig;
apb_vif sigs;
apb_config cfg;
forever begin
apb_rw tr;
@ (this.sigs.mck);
seq_item_port.get_next_item(tr);
// TODO: QUESTA issue with hier ref to sequence via modport; need
workaround?
`ifdef VCS
if (!this.sigs.mck.at_posedge.triggered)
`endif
`ifdef XCELIUM
// FIXME if (!this.sigs.mck.at_posedge.triggered) // this is wrong
and has to be reviewed
`endif
`ifdef QUESTA
if (!this.sigs.mck.triggered)
`endif
@ (this.sigs.mck);
this.trans_received(tr);
`uvm_do_callbacks(apb_master,apb_master_cbs,trans_received(this,tr))
case (tr.kind)
apb_rw::READ: this.read(tr.addr, tr.data);
apb_rw::WRITE: this.write(tr.addr, tr.data);
endcase
this.trans_executed(tr);
`uvm_do_callbacks(apb_master,apb_master_cbs,trans_executed(this,tr))
seq_item_port.item_done();
->trig ;
end
endtask: run_phase
`endif
-----------------------------------------------------------------------------------
--------------------------------------------------
`ifndef APB_MONITOR__SV
`define APB_MONITOR__SV
uvm_analysis_port#(apb_rw) ap;
apb_config cfg;
`uvm_component_utils(apb_monitor)
tr = apb_rw::type_id::create("tr", this);
@ (this.sigs.pck);
if (this.sigs.pck.penable !== 1'b1) begin
`uvm_error("APB", "APB protocol violation: SETUP cycle not followed by
ENABLE cycle");
end
tr.data = (tr.kind == apb_rw::READ) ? this.sigs.pck.prdata :
this.sigs.pck.pwdata;
trans_observed(tr);
`uvm_do_callbacks(apb_monitor,apb_monitor_cbs,trans_observed(this,tr))
ap.write(tr);
end
endtask: run_phase
endclass: apb_monitor
`endif
-----------------------------------------------------------------------------------
--------------------------------------------------
`ifndef APB_RW__SV
`define APB_RW__SV
`uvm_object_utils_begin(apb_rw)
`uvm_field_int(addr, UVM_ALL_ON | UVM_NOPACK);
`uvm_field_int(data, UVM_ALL_ON | UVM_NOPACK);
`uvm_field_enum(kind_e,kind, UVM_ALL_ON | UVM_NOPACK);
`uvm_object_utils_end
endclass: apb_rw
`uvm_object_utils(reg2apb_adapter)
endclass
`endif
-----------------------------------------------------------------------------------
------------------------------------------------
`ifndef APB_SEQUENCER__SV
`define APB_SEQUENCER__SV
`uvm_component_utils(apb_sequencer)
endclass : apb_sequencer
`endif
-----------------------------------------------------------------------------------
-------------------------------------------------
`ifndef APB__SV
`define APB__SV
`include "apb_if.sv"
package apb_pkg;
import uvm_pkg::*;
`include "uvm_macros.svh"
`include "apb_rw.sv"
`include "apb_config.sv"
`include "apb_master.sv"
`include "apb_monitor.sv"
`include "apb_sequencer.sv"
`include "apb_agent.sv"
endpackage
`endif