uvm_barrier¶
- class uvm.base.uvm_barrier.UVMBarrier(name='', threshold=0)[source]¶
Bases:
UVMObject
The
UVMBarrier
class provides a multiprocess synchronization mechanism. Note that this is only for cocotb-based simulation, not real multiprocessing. It enables a set of processes to block until the desired number of processes get to the synchronization point, at which time all of the processes are released.- type_name = 'UVMBarrier'¶
- create(name='')[source]¶
Group: Creation
The
create
method allocates a new object of the same type as this object and returns it via a base uvm_object handle. Every class deriving from uvm_object, directly or indirectly, must implement the create method.A typical implementation is as follows:
class mytype (UVMObject): ... def create(self, name=""): mytype t = mytype(name) return t
- Parameters
name (str) – Name of the created object.
- Returns
New object.
- Return type
obj
- get_type_name()[source]¶
This function returns the type name of the object, which is typically the type identifier enclosed in quotes. It is used for various debugging functions in the library, and it is used by the factory for creating objects.
This function must be defined in every derived class.
A typical implementation is as follows:
class mytype (UVMObject): ... type_name = "mytype" def get_type_name(self): return my_type.type_name
We define the
type_name
static variable to enable access to the type name without need of an object of the class, i.e., to enable access via the scope operator, ~mytype::type_name~.- Returns
Type name of the object.
- Return type
- do_print(printer)[source]¶
The
do_print
method is the user-definable hook called byprint
andsprint
that allows users to customize what gets printed or sprinted beyond the field information provided by the `uvm_field_* macros, <Utility and Field Macros for Components and Objects>.The
printer
argument is the policy object that governs the format and content of the output. To ensure correctprint
andsprint
operation, and to ensure a consistent output format, theprinter
must be used by alldo_print
implementations. That is, instead of using ~$display~ or string concatenations directly, ado_print
implementation must call through the ~printer’s~ API to add information to be printed or sprinted.An example implementation of
do_print
is as follows:class mytype (UVMObject): data_obj data int f1 virtual function void do_print (uvm_printer printer) super.do_print(printer) printer.print_field_int("f1", f1, $bits(f1), UVM_DEC) printer.print_object("data", data) endfunction
Then, to print and sprint the object, you could write:
t = mytype() t.print() uvm_report_info("Received",t.sprint())
See
UVMPrinter
for information about the printer API.- Parameters
printer (UVMPrinter) – Printer that is used in printing.
- 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.