- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are Shift Micro-operations in Computer Architectures?
Shift micro-operations are used for the serial transfer of data and also support in conjunction with arithmetic, logic, and several data-processing operations. The contents of a register can be shifted to the left or the right.
Simultaneously, that the bits are shifted, the first flip-flop holds its binary data from the serial input. In shift-left operation, the serial input transfers a bit into the rightmost position. In shift-right operation, the serial input transfers a bit into the leftmost position. The data transferred by the serial input decides the type of shift.
Types of Shift Micro-operations
There are three types of shift micro-operations are as follows −
Logical Shift
It transfers 0 by the serial input. The symbol "shl" can be used for logical shift left and "shr" can be used for logical shift right.
R1 ←R1 shl R1
R2 ←R1 shr R2
The register symbol should be the equivalent on both sides of the arrows.
Circular Shift
This circulates or pivots the bits of register around the two ends without any trouble of data or contents. In circular shift, the serial output of the shift register is linked to its serial input. "cil" and "cir" is used for circular shift left and right respectively. The symbolic documentation for the shift micro-operations is demonstrated in the table.
Shift Micro-operations
Symbolic Designation | Description |
---|---|
R ←R1 shl R | Shift-left register R |
R ←R1 shr R | Shift-right register R |
R ←R1 cil R | Circular shift-left register R |
R ←R1 cir R | Circular shift-right register R |
R ←R1 ashl R | Arithmetic shift-left R |
R ←R1 ashr R | Arithmetic shift-right R |
Arithmetic Shift
This shifts a signed binary number to left or right. An arithmetic shift left multiplies a signed binary number by 2 and shift left divides the number by 2. Arithmetic shift micro-operation leaves the sign bit constant due to the signed number remains equal when it is multiplied or divided by 2.
Rn-1 | Rn-2 | R→ | R1 | R0 |
Sign bit
Arithmetic Shift Right
The leftmost bit in a register influences the sign bit, and the remaining bits influence the number. The sign bit is 0 for positive and 1 for negative. Negative numbers are in 2's complement form. The figure displays a symbolic register of n bits.
Bit Rn-1 in the leftmost position holds the sign bit.
Rn-2 is the most significant bit of the number and
R0 is the least significant bit. The arithmetic shift-right leaves the sign bit constant and shifts the number (involving the sign bit) to the right. Therefore
Rn-1 remains the equal,
Rn-2 receives the bit from
Rn-1 and so on for the other bits in the register. The bit in
R0 is lost.