SHR

Instruction: Shift value right by specified number of bits.

SHR Value, < # > Bits


Result: Value is shifted right by Bits.

  • Value (d-field) is the register to shift right.
  • Bits (s-field) is a register or a 5-bit literal whose value is the number of bits to shift right.

Opcode Table:

–INSTR–  ZCRI –CON–    –DEST–         –SRC–

Z Result

C Result

Result

Clocks

 001010    001i    1111    ddddddddd    sssssssss

Result = 0

D[0]

Written

4

Concise Truth Table:

In

Out

Destination

Source

Z

C

Effects

Destination

Z

C

$1234_5678; 305,419,896

$0000_0004; 4

-

-

wz wc

$0123_4567; 19,088,743

0

0

$0123_4567; 19,088,743

$0000_000C; 12

-

-

wz wc

$0000_1234; 4,660

0

1

$0000_1234; 4,660

$0000_0010; 16

-

-

wz wc

$0000_0000; 0

1

0

Explanation

SHR (Shift Right) shifts Value right by Bits places and sets the new MSBs to 0.

If the WZ effect is specified, the Z flag is set (1) if the resulting Value equals zero. If the WC effect is specified, the C flag is set equal to Value's original bit 0. The result is written to Value unless the NR effect is specified.

Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.