def sext(self, n):
        ''' Sign-extend the variable to n bits.
        
        n bits must be stricly larger than the actual number of bits, or a
        ValueError is thrown
        '''

        if n <= self.nbits:
            raise ValueError("n must be > %d bits" % self.nbits)

        mba_ret = self.__new_mba(n)
        ret = mba_ret.from_cst(0)
        for i in range(self.nbits):
            ret.vec[i] = self.vec[i]
        last_bit = self.vec[self.nbits-1]
        for i in range(self.nbits,n):
            ret.vec[i] = last_bit
        return mba_ret.from_vec(ret)
Sign-extend the variable to n bits.
        
        n bits must be stricly larger than the actual number of bits, or a
        ValueError is thrown