OVM Open Verification Methodology: Prepared By: Saurabh Jain
OVM Open Verification Methodology: Prepared By: Saurabh Jain
OVM Open Verification Methodology: Prepared By: Saurabh Jain
Introduction to OVM
OVM Overview
Transaction Level Modeling(TML)
Example:XBUS
Benefit of OVM
Agenda
Introduction to OVM
Thinking about verification
OVM Overview
Example:XBUS
Thinking About Verification
Start with a Plan
The design specification states
Relax
purpose of CDV
• Eliminate the effort and time spent creating hundreds of
tests.
• Ensure thorough verification using up-front goal setting.
• Receive early error notifications and deploy run-time
checking and error analysis to simplify debugging
Overview of OVC
An OVM testbench is composed of reusable verification
environments called OVM verification components
(OVCs).
Features of OVC
used
A TLM export supplies the implementation of
the methods
Connections are between ports/exports, not
components
Transactions are objects
Components with the same interfaces can be
swapped transparently
No changes to parent connect()
Basic TLM Communication
class producer extends
ovm_component;
ovm_blocking_put_port
#(simple_trans) put_port; // 1
parameter
function new( string name,
ovm_component parent);
put_port = new(“put_port”, this); class consumer extends ovm_component;
... ovm_blocking_put_imp #(simple_trans,
endfunction consumer) put_export; // 2 parameters
virtual task run(); ...
simple_trans t; task put(simple_trans t);
for(int i = 0; i < N; i++) begin case(t.kind)
// Generate t. put_port.put(t); READ: // Do read.
end WRITE: // Do write.
endtask endcase
endtask
endclass
Communication Between Processes:
using tlm fifo
red my_a;
my_a = new(“a”,this); // hard-coded instantiation/allocation
ovm_component cmp;
cmp = create_component(“red”, “a”); // flexible instantiation
$cast(my_a,cmp);
The advantage of using the class factory is that it may be overridden
to customize the environment.
ovm_factory::set_type_override(“red”, “blue”);
ovm_factory::set_inst_override(“top.a”, “red”, “green”);
Top Module
Environment
DUT
22
XBUS Demo Architecture
XBUS Transfer
typedef enum { NOP,
READ,
WRITE
} xbus_read_write_enum;
constraint c_read_write {
read_write inside { READ, WRITE };
}
constraint c_size {
size inside {1,2,4,8};
}
Xbus_demo_tb0.xbus0.master0.driver
class xbus_master_driver extends ovm_driver
#(xbus_transfer);
Xbus_transfer trans;
// The virtual interface used to drive and view HDL
signals.
protected virtual xbus_if xmi;
// OVM automation macros for general
components
`ovm_component_utils(xbus_master_driver)
// Constructor
function new (string name , ovm_component
parent);
super.new(name, parent);
endfunction : new
// assign_vi
function void assign_vi(virtual interface xbus_if
xmi);
this.xmi = xmi;
endfunction : assign_vi
task run();
...
@(negedge xmi.sig_reset);
forever begin // Repeat the following forever.
@(posedge xmi.sig_clock);
seq_item_port.get_next_item(trans); // Pull item
from sequencer.
...
drive_transfer(trans); // Drive item onto signal-
level bus.
...
seq_item_port.item_done(); // Indicate we are
done.
end
endtask
task drive_item (input xbus_transfer trans);
... // Add your logic here.
endtask : drive_item
endclass : xbus_master_driver
XBUS Sequencer
Xbus_demo_tb0.xbus0.master0.sequencer
class xbus_master_sequencer extends ovm_sequencer #(xbus_transfer);
`ovm_sequencer_utils_begin(xbus_master_sequencer)
//
`ovm_sequencer_utils_end
// new - constructor
function new (string name, ovm_component parent);
super.new(name, parent);
`ovm_update_sequence_lib_and_item(xbus_transfer)
endfunction : new
// assign_vi
function void assign_vi(virtual interface xbus_if xmi);
this.xmi = xmi;
endfunction
endclass : xbus_master_sequencer
`endif // XBUS_MASTER_SEQUENCER_SV
XBUS Agent
class xbus_master_agent extends ovm_agent;
protected ovm_active_passive_enum is_active = OVM_ACTIVE;
xbus_master_driver driver;
xbus_master_sequencer sequencer;
xbus_master_monitor monitor;
// Provide implementations of virtual methods such as get_type_name and
create
`ovm_component_utils_begin(xbus_master_agent)
`ovm_field_enum(ovm_active_passive_enum, is_active, OVM_ALL_ON)
`ovm_component_utils_end
function void build();
super.build();
monitor = xbus_master_monitor::type_id::create("monitor", this);
if (is_active == OVM_ACTIVE) begin
sequencer = xbus_master_sequencer::type_id::create("sequencer", this);
driver = xbus_master_driver::type_id::create("driver", this);
end
endfunction : build
function void connect();
if (is_active == OVM_ACTIVE) begin
driver.seq_item_port.connect(sequencer0.seq_item_export);
end
endfunction
// assign the virtual interfaces of the agent's children
function void assign_vi(virtual interface xbus_if xmi);
monitor.assign_vi(xmi);
if (is_active == OVM_ACTIVE) begin
sequencer.assign_vi(xmi);
driver.assign_vi(xmi);
end
endfunction : assign_vi
End class
XBUS Environment
class xbus_env extends ovm_env;
// Virtual Interface variable
protected virtual interface xbus_if xi0;
// Control properties
protected bit has_bus_monitor = 1;
protected int unsigned num_masters = 0;
protected int unsigned num_slaves = 0;
// The following two bits are used to control whether checks and coverage are
// done both in the bus monitor class and the interface.
bit intf_checks_enable = 1;
bit intf_coverage_enable = 1;
`include "xbus_demo_tb.sv"
class xbus_demo_base_test extends ovm_test;
`ovm_component_utils(xbus_demo_base_test)
xbus_demo_tb xbus_demo_tb0; // XBus verification
environment
function new(string name = "xbus_demo_base_test",
ovm_component parent=null);
super.new(name, parent);
endfunction
// OVM build() phase
virtual function void build();
super.build();
// Enable transaction recording.
set_config_int("*", "recording_detail", OVM_FULL);
// Create the testbench.
xbus_demo_tb0 =
xbus_demo_tb::type_id::create("xbus_demo_tb0",
this);
endfunction
// Built-in OVM phase
function void end_of_elaboration();
// Set verbosity for the bus monitor.
endfunction : end_of_elaboration();
// OVM run() phase
task run();
#2000;
// Call global_stop_request() to end the run phase.
global_stop_request();
endtask
endclass
OVM Benefits
Bringing in the best of URM and AVM
Structuring the Verification Environment for Reuse
Separating Tests from Testbench
Pure SystemVerilog
Apache License
Runs under Cadence Incisive & Mentor QuestaSim
Runs under any ‘SystemVerilog Simulator’
Thank you