Belle II Software development
|
Public Member Functions | |
def | __init__ (self, file, timescale='1 us', date=None, comment='', version='', default_scope_type='module', scope_sep='.', check_values=True, init_timestamp=0) |
def | set_scope_type (self, scope, scope_type) |
def | register_var (self, scope, name, var_type, size=None, init=None, ident=None) |
def | dump_off (self, timestamp) |
def | dump_on (self, timestamp) |
def | change (self, var, timestamp, value) |
def | __enter__ (self) |
def | __exit__ (self, exc_type, exc_val, exc_tb) |
def | close (self, timestamp=None) |
def | flush (self, timestamp=None) |
Static Public Attributes | |
list | SCOPE_TYPES = ['begin', 'fork', 'function', 'module', 'task'] |
Valid VCD scope types. | |
list | VAR_TYPES |
Valid VCD variable types. | |
list | TIMESCALE_NUMS = [1, 10, 100] |
Valid timescale numbers. | |
list | TIMESCALE_UNITS = ['s', 'ms', 'us', 'ns', 'ps', 'fs'] |
Valid timescale units. | |
Protected Member Functions | |
def | _dump_off (self, timestamp) |
def | _dump_values (self, keyword) |
def | _get_scope_tuple (self, scope) |
def | _check_timescale (cls, timescale) |
def | _gen_header (self) |
def | _finalize_registration (self) |
Protected Attributes | |
_ofile | |
output file | |
_header_keywords | |
header keywords | |
_default_scope_type | |
set default_scope_type | |
_scope_sep | |
set scope_sep | |
_check_values | |
set check_values | |
_registering | |
set registering | |
_closed | |
set closed | |
_dumping | |
set dumping | |
_next_var_id | |
set next_var_id | |
_scope_var_strs | |
set scope_var_strs | |
_scope_var_names | |
set scope_var_names | |
_scope_types | |
set scopr_types | |
_ident_values | |
set ident_values | |
_timestamp | |
set time_stamp | |
Value Change Dump writer. A VCD file captures time-ordered changes to the value of variables. :param file file: A file-like object to write the VCD data. :param timescale: Scale of the VCD timestamps. The timescale may either be a string or a tuple containing an (int, str) pair. :type timescale: str, tuple :param str date: Optional `$date` string used in the VCD header. :param str comment: Optional `$comment` string used in the VCD header. :param str version: Optional `$version` string used in the VCD header. :param str default_scope_type: Scope type for scopes where :meth:`set_scope_type()` is not called explicitly. :param str scope_sep: Separator for scopes specified as strings. :param int init_timestamp: The initial timestamp. default=0 :raises ValueError: for invalid timescale values
def __init__ | ( | self, | |
file, | |||
timescale = '1 us' , |
|||
date = None , |
|||
comment = '' , |
|||
version = '' , |
|||
default_scope_type = 'module' , |
|||
scope_sep = '.' , |
|||
check_values = True , |
|||
init_timestamp = 0 |
|||
) |
Initialization of VCDWriter
Definition at line 79 of file writer.py.
def __enter__ | ( | self | ) |
def __exit__ | ( | self, | |
exc_type, | |||
exc_val, | |||
exc_tb | |||
) |
|
protected |
check time scale function of the VCDWrite
Definition at line 325 of file writer.py.
|
protected |
Stop dumping to VCD file.
Definition at line 238 of file writer.py.
|
protected |
Dump values to VCD file.
Definition at line 259 of file writer.py.
|
protected |
finalize registration of VCDWriter
Definition at line 444 of file writer.py.
|
protected |
generate header for VCDWriter
Definition at line 404 of file writer.py.
|
protected |
get scope tuple function of the VCDWrite
Definition at line 315 of file writer.py.
def change | ( | self, | |
var, | |||
timestamp, | |||
value | |||
) |
Change variable's value in VCD stream. This is the fundamental behavior of a :class:`VCDWriter` instance. Each time a variable's value changes, this method should be called. The *timestamp* must be in-order relative to timestamps from previous calls to :meth:`change()`. It is okay to call :meth:`change()` multiple times with the same *timestamp*, but never with a past *timestamp*. .. Note:: :meth:`change()` may be called multiple times before the timestamp progresses past 0. The last value change for each variable will go into the $dumpvars section. :param Variable var: :class:`Variable` instance (i.e. from :meth:`register_var()`). :param int timestamp: Current simulation time. :param value: New value for *var*. For :class:`VectorVariable`, if the variable's *size* is a tuple, then *value* must be a tuple of the same arity. :raises ValueError: if the value is not valid for *var*. :raises VCDPhaseError: if the timestamp is out of order or the :class:`VCDWriter` instance is closed.
Definition at line 267 of file writer.py.
def close | ( | self, | |
timestamp = None |
|||
) |
Close VCD writer. Any buffered VCD data is flushed to the output file. After :meth:`close()`, no variable registration or value changes will be accepted. :param int timestamp: optional final timestamp to insert into VCD stream. .. Note:: The output file is not automatically closed. It is up to the user to ensure the output file is closed after the :class:`VCDWriter` instance is closed.
Definition at line 365 of file writer.py.
def dump_off | ( | self, | |
timestamp | |||
) |
def dump_on | ( | self, | |
timestamp | |||
) |
Resume dumping to VCD file.
Definition at line 251 of file writer.py.
def flush | ( | self, | |
timestamp = None |
|||
) |
Flush any buffered VCD data to output file. If the VCD header has not already been written, calling `flush()` will force the header to be written thus disallowing any further variable registration. :param int timestamp: optional timestamp to insert into VCD stream.
Definition at line 386 of file writer.py.
def register_var | ( | self, | |
scope, | |||
name, | |||
var_type, | |||
size = None , |
|||
init = None , |
|||
ident = None |
|||
) |
Register a VCD variable and return function to change value. All VCD variables must be registered prior to any value changes. .. Note:: The variable `name` differs from the variable's `ident` (identifier). The `name` (also known as `ref`) is meant to refer to the variable name in the code being traced and is visible in VCD viewer applications. The `ident`, however, is only used within the VCD file and can be auto-generated (by specifying ``ident=None``) for most applications. :param scope: The hierarchical scope that the variable belongs within. :type scope: str or sequence of str :param str name: Name of the variable. :param str var_type: One of :const:`VAR_TYPES`. :param size: Size, in bits, of the variable. The *size* may be expressed as an int or, for vector variable types, a tuple of int. When the size is expressed as a tuple, the *value* passed to :meth:`change()` must also be a tuple of same arity as the *size* tuple. Some variable types ('integer', 'real', 'realtime', and 'event') have a default size and thus *size* may be ``None`` for those variable types. :type size: int or tuple(int) or None :param init: Optional initial value; defaults to 'x'. :param str ident: Optional identifier for use in the VCD stream. :raises VCDPhaseError: if any values have been changed :raises ValueError: for invalid var_type value :raises TypeError: for invalid parameter types :raises KeyError: for duplicate var name :returns: :class:`Variable` instance appropriate for use with :meth:`change()`.
Definition at line 136 of file writer.py.
def set_scope_type | ( | self, | |
scope, | |||
scope_type | |||
) |
Set the scope_type for a given scope. The scope's type may be set to one of the valid :const:`SCOPE_TYPES`. VCD viewer applications may display different scope types differently. :param scope: The scope to set the type of. :type scope: str or sequence of str :param str scope_type: A valid scope type string. :raises ValueError: for invalid `scope_type`
Definition at line 119 of file writer.py.
|
static |
|
static |
|
static |
|
static |