hwt/hdl/types/bitsVal.py
def _concat(self, other):
        """
        Concatenate this with other to one wider value/signal
        """
        w = self._dtype.bit_length()
        try:
            other_bit_length = other._dtype.bit_length
        except AttributeError:
            raise TypeError("Can not concat bits and", other._dtype)

        other_w = other_bit_length()
        resWidth = w + other_w
        resT = Bits(resWidth)

        if areValues(self, other):
            return self._concat__val(other)
        else:
            w = self._dtype.bit_length()
            other_w = other._dtype.bit_length()
            resWidth = w + other_w
            resT = Bits(resWidth)
            # is instance of signal
            if isinstance(other, InterfaceBase):
                other = other._sig
            if isinstance(other._dtype, Bits):
                if other._dtype.signed is not None:
                    other = other._vec()
            elif other._dtype == BOOL:
                other = other._auto_cast(BIT)
            else:
                raise TypeError(other._dtype)

            if self._dtype.signed is not None:
                self = self._vec()

            return Operator.withRes(AllOps.CONCAT, [self, other], resT)\
                           ._auto_cast(Bits(resWidth,
                                            signed=self._dtype.signed))
def _concat(self, other):
        """
        Concatenate this with other to one wider value/signal
        """
        w = self._dtype.bit_length()
        try:
            other_bit_length = other._dtype.bit_length
        except AttributeError:
            raise TypeError("Can not concat bits and", other._dtype)

        other_w = other_bit_length()
        resWidth = w + other_w
        resT = Bits(resWidth)

        if areValues(self, other):
            return self._concat__val(other)
        else:
            w = self._dtype.bit_length()
            other_w = other._dtype.bit_length()
            resWidth = w + other_w
            resT = Bits(resWidth)
            # is instance of signal
            if isinstance(other, InterfaceBase):
                other = other._sig
            if isinstance(other._dtype, Bits):
                if other._dtype.signed is not None:
                    other = other._vec()
            elif other._dtype == BOOL:
                other = other._auto_cast(BIT)
            else:
                raise TypeError(other._dtype)

            if self._dtype.signed is not None:
                self = self._vec()

            return Operator.withRes(AllOps.CONCAT, [self, other], resT)\
                           ._auto_cast(Bits(resWidth,
                                            signed=self._dtype.signed))
def _concat ( self , other ) : w = self . _dtype . bit_length ( ) try : other_bit_length = other . _dtype . bit_length except AttributeError : raise TypeError ( "Can not concat bits and" , other . _dtype ) other_w = other_bit_length ( ) resWidth = w + other_w resT = Bits ( resWidth ) if areValues ( self , other ) : return self . _concat__val ( other ) else : w = self . _dtype . bit_length ( ) other_w = other . _dtype . bit_length ( ) resWidth = w + other_w resT = Bits ( resWidth ) # is instance of signal if isinstance ( other , InterfaceBase ) : other = other . _sig if isinstance ( other . _dtype , Bits ) : if other . _dtype . signed is not None : other = other . _vec ( ) elif other . _dtype == BOOL : other = other . _auto_cast ( BIT ) else : raise TypeError ( other . _dtype ) if self . _dtype . signed is not None : self = self . _vec ( ) return Operator . withRes ( AllOps . CONCAT , [ self , other ] , resT ) . _auto_cast ( Bits ( resWidth , signed = self . _dtype . signed ) )
Concatenate this with other to one wider value/signal
Concatenate this with other to one wider value / signal