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.classmethod_named(func)[source]
class uvm.base.uvm_objection.UVMObjectionEvents[source]

Bases: object

uvm.base.uvm_objection.get_name_depth(curr_obj_name: str) int[source]

Returns the hier depth of the name

uvm.base.uvm_objection.get_leaf_name(curr_obj_name: str) str[source]
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:

m_report(obj, source_obj, description: str, count: int, action: str) None[source]
m_get_parent(obj)[source]
m_propagate(obj, source_obj, description, count, raise_, in_top_thread)[source]
get_propagate_mode() int[source]
raise_objection(obj=None, description='', count=1)[source]
m_raise(obj, source_obj, description='', count=1)[source]
drop_objection(obj=None, description='', count=1)[source]
m_drop(obj, source_obj, description='', count=1, in_top_thread=0)[source]
clear(obj=None)[source]
async classmethod m_execute_scheduled_forks()[source]
async classmethod m_execute_scheduled_forks_fork_join_none(c: UVMObjectionContextObject)[source]
async m_forked_drain(obj, source_obj, description='', count=1, in_top_thread=0)[source]
async classmethod m_init_objections()[source]
set_drain_time(obj=None, drain=0)[source]
raised(obj, source_obj, description, count)[source]
dropped(obj, source_obj, description, count)[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 calls UVMComponent.all_dropped.

Parameters
async wait_for(objt_event, obj=None)[source]
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.

m_display_objections(obj=None, show_header=1)[source]
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 the print/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.

display_objections(obj=None, show_header=1)[source]
do_copy(rhs)[source]

The do_copy method is the user-definable hook called by the copy method. A derived class should override this method to include its fields in a copy 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.

class uvm.base.uvm_objection.UVMObjectionContextObject[source]

Bases: object

clear()[source]

Clears the values stored within the object, preventing memory leaks from reused objects