hwt/hdl/types/bitsCast.py
def reinterpret_bits_to_hstruct(sigOrVal, hStructT):
    """
    Reinterpret signal of type Bits to signal of type HStruct
    """
    container = hStructT.fromPy(None)
    offset = 0
    for f in hStructT.fields:
        t = f.dtype
        width = t.bit_length()
        if f.name is not None:
            s = sigOrVal[(width + offset):offset]
            s = s._reinterpret_cast(t)
            setattr(container, f.name, s)

        offset += width

    return container
def reinterpret_bits_to_hstruct(sigOrVal, hStructT):
    container = hStructT.fromPy(None)
    offset = 0
    for f in hStructT.fields:
        t = f.dtype
        width = t.bit_length()
        if f.name is not None:
            s = sigOrVal[(width + offset):offset]
            s = s._reinterpret_cast(t)
            setattr(container, f.name, s)

        offset += width

    return container
def reinterpret_bits_to_hstruct ( sigOrVal , hStructT ) : container = hStructT . fromPy ( None ) offset = 0 for f in hStructT . fields : t = f . dtype width = t . bit_length ( ) if f . name is not None : s = sigOrVal [ ( width + offset ) : offset ] s = s . _reinterpret_cast ( t ) setattr ( container , f . name , s ) offset += width return container
Reinterpret signal of type Bits to signal of type HStruct
Reinterpret signal of type Bits to signal of type HStruct