Ejemplo n.º 1
0
    def value(self):
        """The value of this simulation object.

        .. note::
            When setting this property, the value is stored by the :class:`~cocotb.scheduler.Scheduler`
            and all stored values are written at the same time at the end of the current simulator time step.

            Use :meth:`setimmediatevalue` to set the value immediately.
        """
        binstr = simulator.get_signal_val_binstr(self._handle)
        result = BinaryValue(binstr, len(binstr))
        return result
Ejemplo n.º 2
0
 def __init__(self, handle, path, handle_type):
     NonHierarchyObject.__init__(self, handle, path)
     if handle_type in [simulator.INTEGER, simulator.ENUM]:
         self._value = simulator.get_signal_val_long(self._handle)
     elif handle_type == simulator.REAL:
         self._value = simulator.get_signal_val_real(self._handle)
     elif handle_type == simulator.STRING:
         self._value = simulator.get_signal_val_str(self._handle)
     else:
         val = simulator.get_signal_val_binstr(self._handle)
         self._value = BinaryValue(n_bits=len(val))
         try:
             self._value.binstr = val
         except:
             self._value = val
Ejemplo n.º 3
0
 def __init__(self, handle, path, handle_type):
     """
     Args:
         handle (int): The GPI handle to the simulator object.
         path (str): Path to this handle, ``None`` if root.
         handle_type: The type of the handle
             (``simulator.INTEGER``, ``simulator.ENUM``,
             ``simulator.REAL``, ``simulator.STRING``).
     """
     NonHierarchyObject.__init__(self, handle, path)
     if handle_type in [simulator.INTEGER, simulator.ENUM]:
         self._value = simulator.get_signal_val_long(self._handle)
     elif handle_type == simulator.REAL:
         self._value = simulator.get_signal_val_real(self._handle)
     elif handle_type == simulator.STRING:
         self._value = simulator.get_signal_val_str(self._handle)
     else:
         val = simulator.get_signal_val_binstr(self._handle)
         self._value = BinaryValue(n_bits=len(val))
         try:
             self._value.binstr = val
         except Exception:
             self._value = val
Ejemplo n.º 4
0
 def _getvalue(self):
     binstr = simulator.get_signal_val_binstr(self._handle)
     result = BinaryValue(binstr, len(binstr))
     return result
Ejemplo n.º 5
0
 def _getvalue(self):
     result = BinaryValue()
     result.binstr = simulator.get_signal_val_binstr(self._handle)
     return result
Ejemplo n.º 6
0
 def _getvalue(self):
     result = BinaryValue()
     result.binstr = simulator.get_signal_val_binstr(self._handle)
     return result
Ejemplo n.º 7
0
 def _get_value_str(self):
     return simulator.get_signal_val_binstr(self._handle)
Ejemplo n.º 8
0
 def _get_value_str(self):
     return simulator.get_signal_val_binstr(self._handle)