hwt/hdl/types/arrayCast.py
def reinterptet_harray_to_bits(typeFrom, sigOrVal, bitsT):
    """
    Cast HArray signal or value to signal or value of type Bits
    """
    size = int(typeFrom.size)
    widthOfElm = typeFrom.elmType.bit_length()
    w = bitsT.bit_length()
    if size * widthOfElm != w:
        raise TypeConversionErr(
            "Size of types is different", size * widthOfElm, w)

    partT = Bits(widthOfElm)
    parts = [p._reinterpret_cast(partT) for p in sigOrVal]

    return Concat(*reversed(parts))._reinterpret_cast(bitsT)
def reinterptet_harray_to_bits(typeFrom, sigOrVal, bitsT):
    """
    Cast HArray signal or value to signal or value of type Bits
    """
    size = int(typeFrom.size)
    widthOfElm = typeFrom.elmType.bit_length()
    w = bitsT.bit_length()
    if size * widthOfElm != w:
        raise TypeConversionErr(
            "Size of types is different", size * widthOfElm, w)

    partT = Bits(widthOfElm)
    parts = [p._reinterpret_cast(partT) for p in sigOrVal]

    return Concat(*reversed(parts))._reinterpret_cast(bitsT)
def reinterptet_harray_to_bits ( typeFrom , sigOrVal , bitsT ) : size = int ( typeFrom . size ) widthOfElm = typeFrom . elmType . bit_length ( ) w = bitsT . bit_length ( ) if size * widthOfElm != w : raise TypeConversionErr ( "Size of types is different" , size * widthOfElm , w ) partT = Bits ( widthOfElm ) parts = [ p . _reinterpret_cast ( partT ) for p in sigOrVal ] return Concat ( * reversed ( parts ) ) . _reinterpret_cast ( bitsT )
Cast HArray signal or value to signal or value of type Bits
Cast HArray signal or value to signal or value of type Bits