|
OVM Monitor class and example
|
OVM Monitor :
The monitor is responsible for extracting signal information from the bus and translating it into events, structs, and status information. This information is made available to other components using the TLM interface. Monitors should be configureable mean they can be enabled or disabled.
- The monitor collects bus information through a virtual interface
- The collected data is used in coverage collection and checking
- The collected data is exported on an analysis port (item_collected_port).
OVM Monitor Class example :
class mem_master_monitor extends ovm_monitor;
protected virtual interface mem_if m_if;
protected int master_id;
`ovm_object_utils_begin (mem_master_monitor)
`ovm_field_int (master_id, OVM_ALL_ON)
`ovm_object_utils_end
// Analysis ports for the item_collected and state notifier
ovm_analysis_port #(mem_transfer) item_collected_port;
protected mem_transfer trans_collected;
covergroup CovByteEnable;
option.goal = 100;
option.per_instance = 1;
c_addr : coverpoint trans_collected.addr {
bins ll = {[0:1]};
bins lo = {[2:`BOUNDRY_VAL]};
bins mid = {[`BOUNDRY_VAL+1 : 2**`ADDR_SIZE-`BOUNDRY_VAL]};
bins hi = {[2**`ADDR_SIZE-`BOUNDRY_VAL+1:2**`ADDR_SIZE-2]};
bins hl = {[2**`ADDR_SIZE-2:2**`ADDR_SIZE-1]};
}
c_read_write : coverpoint trans_collected.read_write;
c_data : coverpoint trans_collected.data;
c_chip_enable : coverpoint trans_collected.chip_enable;
// READ WRITE CROSS on boundry values
c_rw_cross_addr : cross c_addr, c_read_write;
// READ/WRITE Cross coverage
c_rw_cross_rw : cross c_read_write, c_read_write;
endgroup
function new (string name = "mem_master_monitor", ovm_component parent=null);
super.new (name, parent);
item_collected_port = new("item_collected_port", this);
trans_collected = new ();
CovByteEnable = new;
endfunction : new
// Assign the virtual interface variable
function void assign_vi(virtual interface mem_if if_in);
m_if = if_in;
endfunction
task run ();
fork
collect_transactions ();
join
endtask : run
virtual protected task collect_transactions();
forever
begin
@( posedge m_if.CLK iff (( m_if.WX === 1) || (m_if.WX === 0)) && (m_if.EX == 0) )
case (m_if.WX)
1'b0 : trans_collected.read_write = WRITE;
1'b1 : trans_collected.read_write = READ;
endcase
trans_collected.addr = m_if.A;
trans_collected.write_enable = m_if.WRENX;
trans_collected.chip_enable = m_if.EX;
// Latch Data in the next clock cycle
@ (posedge m_if.CLK);
trans_collected.data = m_if.Q;
CovByteEnable.sample();
$display ("ITEM COLLECTED AND SENT TO SCOREBOARD \n");
item_collected_port.write (trans_collected);
end
endtask : collect_transactions
endclass : mem_master_monitor
|
| Keywords :
ovm_monitor
|
|
This Articles is written/submitted by puneet (Puneet Aggarwal). You can also contribute to Asicguru.com. Click here to start
|
Prev << OVM sequencer
|
Next >> OVM Sequences
|