Skip to content

Helpers

arithmetic_shift_right(n, shift_amt, bit_width)

This returns the value represented by the two's-complement binary representation of the final result. This means the result could be negative (if the top bit of the input is negative)

n is truncated to the width of bit_width before the operation takes place.

logical_shift_left(n, shift_amt, bit_width)

logical_shift_right(n, shift_amt, bit_width)

n is truncated to the width of bit_width before the operation takes place.

rotate_right(n, shift_amt, bit_width)

n is truncated to the width of bit_width before the operation takes place.

to_signed(unsigned, bit_width)

Returns the signed number associated with the two's-complement binary representation of unsigned