uvm_objection¶
Title: Objection Mechanism
The following classes define the objection mechanism and end-of-test functionality, which is based on <uvm_objection>.
- uvm.base.uvm_objection.get_name_depth(curr_obj_name: str) int [source]¶
Returns the hier depth of the name
- class uvm.base.uvm_objection.UVMObjectionCallback(name)[source]¶
Bases:
UVMCallback
The UVMObjection is the callback type that defines the callback implementations for an objection callback. A user uses the callback type uvm_objection_cbs_t to add callbacks to specific objections.
class my_objection_cb extends uvm_objection_callback def __init__(self, name): super().__init__(name) def raised(objection, obj, source_obj, description, count): uvm_info("RAISED","{}: Objection {}: Raised for {}".format(sv.time(), objection.get_name(), obj.get_full_name()) ... @cocotb.test() async def initial_begin(dut): cb = my_objection_cb ("cb") uvm_objection_cbs_t.add(None, cb) # typewide callback
- class uvm.base.uvm_objection.UVMObjection(name='')[source]¶
Bases:
UVMReportObject
Class: UVMObjection
Objections provide a facility for coordinating status information between two or more participating components, objects, and even module-based IP.
Tracing of objection activity can be turned on to follow the activity of the objection mechanism. It may be turned on for a specific objection instance with <uvm_objection::trace_mode>, or it can be set for all objections from the command line using the option +UVM_OBJECTION_TRACE.
- m_objections = [<uvm.base.uvm_objection.UVMObjection object>, <uvm.base.uvm_objection.UVMObjection object>, <uvm.base.uvm_objection.UVMObjection object>, <uvm.base.uvm_objection.UVMObjection object>, <uvm.base.uvm_objection.UVMObjection object>, <uvm.base.uvm_objection.UVMObjection object>, <uvm.base.uvm_objection.UVMObjection object>, <uvm.base.uvm_objection.UVMObjection object>, <uvm.base.uvm_objection.UVMObjection object>, <uvm.base.uvm_objection.UVMObjection object>, <uvm.base.uvm_objection.UVMObjection object>, <uvm.base.uvm_objection.UVMObjection object>, <uvm.base.uvm_objection.UVMObjection object>]¶
- m_context_pool = []¶
- m_scheduled_list_not_empty_event = <Event for m_scheduled_list_not_empty_event>¶
- m_scheduled_list: List[UVMObjectionContextObject] = []¶
- trace_mode(mode=-1)[source]¶
Set or get the trace mode for the objection object. If no argument is specified (or an argument other than 0 or 1) the current trace mode is unaffected. A trace_mode of 0 turns tracing off. A trace mode of 1 turns tracing on. The return value is the mode prior to being reset.
- Parameters
mode (int) – 0=disable, 1=enable
Returns int:
- async classmethod m_execute_scheduled_forks_fork_join_none(c: UVMObjectionContextObject)[source]¶
- async all_dropped(obj, source_obj, description, count)[source]¶
Objection callback that is called when a
drop_objection
has reached ~obj~, and the total count for ~obj~ goes to zero. This callback is executed after the drain time associated with ~obj~. The default implementation callsUVMComponent.all_dropped
.
- get_objection_count(obj=None)[source]¶
Returns the current number of objections raised by the given ~object~.
- get_objection_total(obj=None)[source]¶
Returns the current number of objections raised by the given ~object~ and all descendants.
- convert2string()[source]¶
This virtual function is a user-definable hook, called directly by the user, that allows users to provide object information in the form of a string. Unlike
sprint
, there is no requirement to use a uvm_printer policy object. As such, the format and content of the output is fully customizable, which may be suitable for applications not requiring the consistent formatting offered by theprint
/sprint
/do_print
API.Fields declared in <Utility Macros> macros (`uvm_field_*), if used, will not automatically appear in calls to convert2string.
An example implementation of convert2string follows.
class Base(UVMObject): field = "foo" def convert2string(self): return "base_field=" + self.field class Obj2(UVMObject): field = "bar" def convert2string() convert2string = "child_field=" + self.field class Obj(Base): addr = 0x123 data = 0x456 write = 1 child = Obj2() def convert2string(self): convert2string = super().convert2string() + sv.sformatf(" write=%0d addr=%8h data=%8h ",write,addr,data) + child.convert2string() Then, to display an object, you could write: .. code-block:: python o = Obj() uvm_report_info("BusMaster", "Sending:
” + o.convert2string())
The output will look similar to:
UVM_INFO @ 0: reporter [BusMaster] Sending: base_field=foo write=1 addr=00000123 data=00000456 child_field=bar
- Returns:
str: Object converted into string.
- do_copy(rhs)[source]¶
The
do_copy
method is the user-definable hook called by thecopy
method. A derived class should override this method to include its fields in acopy
operation.A typical implementation is as follows:
class mytype (UVMObject): ... field_1 = 0 def do_copy(self, rhs): super.do_copy(rhs) # Optionanl type checking field_1 = rhs.field_1
The implementation must call
super().do_copy
, and can optionally do type checking before copying.- Parameters
rhs (UVMObject) – Object to be copied.