Shift Microoperations -arithmetic shift
An arithmetic shift is a rnicrooperation that shifts a signed binary number to the left or right. An arithmetic shift-left multiplies a signed binary number by 2. An arithmetic shift-right divides the number by 2. Arithmetic shifts must leave the sign bit unchanged because the sign of the number remains the same
These Topics Are Also In Your Syllabus | ||
---|---|---|
1 | Stored Program Organization | link |
2 | Instruction Codes | link |
You May Find Something Very Interesting Here. | link | |
3 | Indirect Address | link |
4 | Computer Registers | link |
5 | Program Counter | link |
when it is multiplied or divided by 2. The leftmost bit in a register holds the sign bit, and the remaining bits hold the number. The sign bit is 0 for positive and I for negative. Negative numbers are in 2's complement form. Figure 4-11 shows a typical register of n bits. Bit R, _ 1 in the leftmost position holds the sign bit. R, _ 2 is the most significant bit of the number and Ro is the least significant bit. The arithmetic shift-right leaves the sign bit unchanged and shifts the number (including the sign bit) to the right. Thus R, _ 1 remains the same, R, _ 2 receives the bit from R, _" and so on for the other bits in the register. The bit in Ro is lost.
The arithmetic shift-left inserts a 0 into R,, and shifts all other bits to the left. The initial bit of R, _ 1 is lost and replaced by the bit from R, _ 2• A sign reversal occurs if the bit in R, _ 1 changes in value after the shift. This happens if the multiplication by 2 causes an overflow. An overflow occurs after an arithmetic shift left if initially, before the shift, R, _ 1 is not equal to R, _ 2 • An overflow flip-flop V, can be used to detect an arithmetic shift-left overflow.
If V, = 0, there is no overflow, but if V, = I, there is an overflow and a sign reversal after the shift. V, must be transferred into the overflow flip-flop with the same clock pulse that shifts the register.