def reinterpretBits__val(self: Bits, val: HValue, toType: HdlType): if isinstance(toType, Bits): if self.signed != toType.signed: val = val._convSign__val(toType.signed) return fitTo_t(val, toType) elif isinstance(toType, HStruct): return reinterpret_bits_to_hstruct__val(val, toType) elif isinstance(toType, HUnion): raise NotImplementedError() elif isinstance(toType, HArray): return reinterpret_bits_to_harray(val, toType) return default_auto_cast_fn(self, val, toType)
def is_suitable_for_const_extract(self, val: HValue): # full valid values can be represented as int and do not have any # constructor overhead, entirely invalid values can be represented by None return not val._is_full_valid() and not isinstance(val._dtype, HEnum)
def _auto_cast(self, dtype): return HValue._auto_cast(self, dtype)
def __copy__(self): v = HValue.__copy__(self) v.val = copy(v.val) return v