def shift_right_arithmetic(bits_to_shift, shift_amount):
    """ Shift right arithmetic operation.

    :param bits_to_shift: WireVector to shift right
    :param shift_amount: WireVector specifying amount to shift
    :return: WireVector of same length as bits_to_shift

    This function returns a new WireVector of length equal to the length
    of the input `bits_to_shift` but where the bits have been shifted
    to the right.  An arithemetic shift is one that treats the value as
    as signed number, meaning the sign bit (the most significant bit of
    `bits_to_shift`) is shifted in. Note that `shift_amount` is treated as
    unsigned.
    """
    a, shamt = _check_shift_inputs(bits_to_shift, shift_amount)
    bit_in = bits_to_shift[-1]  # shift in sign_bit
    dir = Const(0)  # shift right
    return barrel.barrel_shifter(bits_to_shift, bit_in, dir, shift_amount)
Shift right arithmetic operation.

    :param bits_to_shift: WireVector to shift right
    :param shift_amount: WireVector specifying amount to shift
    :return: WireVector of same length as bits_to_shift

    This function returns a new WireVector of length equal to the length
    of the input `bits_to_shift` but where the bits have been shifted
    to the right.  An arithemetic shift is one that treats the value as
    as signed number, meaning the sign bit (the most significant bit of
    `bits_to_shift`) is shifted in. Note that `shift_amount` is treated as
    unsigned.