Belle II Software development
ScalarVariable Class Reference
Inheritance diagram for ScalarVariable:
Variable

Public Member Functions

def format_value (self, value, check=True)
 

Static Private Attributes

tuple __slots__ = ()
 variables
 

Detailed Description

One-bit VCD scalar.

This is a 4-state variable and thus may have values of 0, 1, 'z', or 'x'.

Definition at line 481 of file writer.py.

Member Function Documentation

◆ format_value()

def format_value (   self,
  value,
  check = True 
)
Format scalar value change for VCD stream.

:param value: 1-bit (4-state) scalar value.
:type value: str, bool, int, or None
:raises ValueError: for invalid *value*.
:returns: string representing value change for use in a VCD stream.

Reimplemented from Variable.

Definition at line 491 of file writer.py.

491 def format_value(self, value, check=True):
492 """Format scalar value change for VCD stream.
493
494 :param value: 1-bit (4-state) scalar value.
495 :type value: str, bool, int, or None
496 :raises ValueError: for invalid *value*.
497 :returns: string representing value change for use in a VCD stream.
498
499 """
500 if isinstance(value, str):
501 if check and (len(value) != 1 or value not in '01xzXZ'):
502 raise ValueError(f'Invalid scalar value ({value})')
503 return value + self.ident
504 elif value is None:
505 return 'z' + self.ident
506 elif value:
507 return '1' + self.ident
508 else:
509 return '0' + self.ident
510
511

Member Data Documentation

◆ __slots__

tuple __slots__ = ()
staticprivate

variables

Definition at line 489 of file writer.py.


The documentation for this class was generated from the following file: