Logical and Shift Micro-operations

Logical Shift micro-operations:

The logical operations that are performed on the contents of the processor register are called as the logical micro-operations. These micro-operations are AND, OR, INVERT, XOR etc. are performed on individual bits of the registers

As an example, logical exclusive-OR micro-operations can be written as:

X: R3 <– R1  R2

This RTL syntax describes that R3 is update with the result of the exclusive-OR operation on the contents of R1 and R2 when the control signal X goes high.

We are aware that a ‘+’ means an arithmetic addition as well as a logical OR operation. To avoid the confusion in the use of the symbols the OR operation will be indicated by ‘V’ and the arithmetic operation by ‘+’ symbol. All the operations are given in the following table-1.


R3 <– R1 V  R2
R3 get the value of XOR operation on the contents of R1 and R2
R3 <– R1 ꓥ  R2
R3 get the value of AND operation on the contents of R1 and R2
A <–  A’
Accumulator is updated with its complement
R3 <– R1 +  R2
R3 get the value of ADD operation on the contents of R1 and R2
Multiple operations
, seperated
P: R3 <– R1 +  R2 , R5 <– R1 ꓥ  R4
When P is high, R3 and R5 get updated with new values

Various Logical micro-operations.

Table-2 Shows various logical-micro-operations that can be performed on two variable X and Y.


Output Functions

X Y F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
0 0 0 1 0 1 0 1 0 1 0 0 0 1 0 1 1 1
0 1 0 1 0 1 1 0 0 1 1 0 1 0 1 0 0 1
1 0 0 1 1 0 0 1 0 1 0 1 1 0 1 0 1 0
1 1 0 1 1 0 1 0 1 0 0 0 1 0 0 1 1 1
Function details F0=0 F1=1 F2=X F3=X’ F4=Y F6=Y’ F2=X.Y F8=(XY)’ F12=X’Y F15=XY’ F3= X+Y F9= (X+Y)’ F4= X


F5= X⊙Y F13=X+Y’ F14= X’+Y
Logical micro-operations F<=0 F<=1 F<=X F<=X’ F<=Y F<=Y’ F<=XꓥY F<= (XꓥY)’ F<=X’ꓥY F<=XꓥY’ F<= XVY F<= (XVY)’ F<= X


F<=      ( XY)’ F<= XVY’ F<= X’VY

The functions of two variables are expressed in algebraic form, and the micro-operations are driven from these functions and are also written in the bottom row of the table. The operations are performed on each bit of the register and are stored back in the register as output.

Hardware implementation:

The hardware implementation of the above logic functions can be implemented by a simple circuit comprising of Mux and logic gate at the input of the MUX. Most of the logic micro-operations can be computed using simple logic gate. Figure-1 shows the implementation of four micro-operations.


Figure-1: logical Micro-operations


The same concept can be expanded to accommodate all the 16-micro-operations.

Also, there are some special microoperations described in the above table of logical micro-operations. These micro-operations will be useful while playing with controller programing for example in manipulating individual bits or a portion of a word stored in a register. They can be used to change bit values, delete a group of bits, or insert new bit values into a register.

Accordingly these selective micro-operations are:

  1. Selective set
  2. Selective clear
  3. Selective complement
  4. Mask Operation
Specialized operations
Selective set


A   =    1010

B   =    1100


AVB  = 1110

C <– A V B
OR Operation
An OR operation with ‘1’ sets the selected bit
Selective clear


A   =    1010

B   =    1100

B’ =     0011


A /\ B’= 0010

A <– A /\ B’
AND with complement of B (i.e. B’)
ANDing with zero(‘0’) clears the bit. Hre MSB is cleared
Selective complement


A   =    1010

B   =    1100


A B  = 0110

A<–  A B                 
XOR Operation
This operation complements the MSB bit. XOR wit ‘1’ complements the bit
Mask Operation


A   =    1010

B   =    1100


AVB  = 1110

A <– A V B
It is similar to selective-clear operation except that the bits of A are cleared only where there are corresponding 0’s in B


Shift Micro-operations

The shift operations executed on the contents of the registers are called as shift micro-operations. The contents of a register can be shifted to the left or the right. At the same time that the bits are shifted, the first flip-flop receives its binary information from the serial input from left or right i.e. from the direction of shift. Shift operations are of following types.

  • shift-left operation
  • shift-right operation
  • Circular (rotate) operation
  • Arithmetic Shift operation

Shift Left operation:

In the logical left shift operation, a ‘0’ is inserted from the right end as shown in the figure-2. As the bits are shifted the least significant bits occupy the position of next higher position bit and the MSB is lost. The left shift operation is equivalent to the multiplication by 2.

Figure-2: logical Shift Left Operation


Shift Right Operation:

In the logical right shift operation, a ‘0’ is inserted from the left end as shown in the figure-3. As the bits are shifted, the bits from higher place occupy the lower bit position and each time a shift operation is done the LSB bit is lost.

Figure-3: Logical Right Shift Operation

Circular or Rotate operation:

It was observed that In the left and right shift operations the bit from the right or left end get lost, but in the circular or rotate operation the bit is preserved and inputted from the other end.

Rotate Left:

The circular left operation inserts the MSB bit as input at the LSB position as shown in figure-4

Figure-4: Rotate Left Operation

Rotate Right:

The circular right operation shift the bits right internally and the LSB occupies the position of MSB as shown in figure-5.

Figure-5: Rotate Right Operation

Arithmetic Shift operation:

Arithmetic shifts must leave the sign bit unchanged because the sign of the number remains the same when it is multiplied or divided by 2.

Arithmetic right shift:

As shown in figure-6,  In each right shift, the sign bit Rn-1 is retained at the MSB position and also shifted to right along with other bits upon each operation. This preserves the sign of the number. Arithmetic right shift is equal to division by 2

Figure-6: Arithmetic Right Shift

Arithmetic left shift:

In arithmetic left shift all the bits are shifted one bit left position. In the circular left shift operation the most two significant bits (bn-1 and bn-2) bits must be checked for an overflow as shown in the figure. Arithmetic left shift is equal to multiplication by 2.

Figure-7: Arithmetic Right Shift


error: Content is protected !!