def shift_right(self, amount):
        """Right shift by constant amount.

        If :py:`amount < 0`, performs the same operation as :py:`self.shift_left(-amount)`.

        Returns
        -------
        :class:`Value`, :py:`unsigned(max(len(self) - amount, 0))`
            If :py:`self` is unsigned.
        :class:`Value`, :py:`signed(max(len(self) - amount, 1))`
            If :py:`self` is signed.
        """
        if not isinstance(amount, int):
            raise TypeError(f"Shift amount must be an integer, not {amount!r}")
        if amount < 0:
            return self.shift_left(-amount)
        if self.shape().signed:
            if amount >= len(self):
                amount = len(self) - 1
            return self[amount:].as_signed()
        else:
            return self[amount:] # unsigned
Right shift by constant amount.

        If :py:`amount < 0`, performs the same operation as :py:`self.shift_left(-amount)`.

        Returns
        -------
        :class:`Value`, :py:`unsigned(max(len(self) - amount, 0))`
            If :py:`self` is unsigned.
        :class:`Value`, :py:`signed(max(len(self) - amount, 1))`
            If :py:`self` is signed.
        
amaranth/hdl/_ast.py