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
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
def _getvalue(self): return simulator.get_signal_val_long(self._handle)