The document discusses various types of microoperations including register transfer, arithmetic, logic, and shift microoperations. It provides details on how basic arithmetic operations like addition, subtraction, and increment/decrement are implemented. Logic operations like AND, OR, XOR, and NOT are also covered. Shift operations include logical, circular, and arithmetic shifts. The hardware implementation of these microoperations uses basic logic gates and circuits like half adders, full adders, and multiplexers.
2. Types of Microoperations
There are 4 types of microoperations
1. Register transfer microoperations
2. Arithmetic microoperations
3. Logic microoperations (bit manipulations on non-numeric data)
4. Shift microoperations(bit manipulations on non-numeric data)
DR. PRASENJIT DEY 2
2/27/2021
3. Arithmetic Microoperations
The basic arithmetic microoperations are: addition, subtraction,
increment, decrement.
Addition Microoperation:
R3 ←R1+R2
Subtraction Microoperation:
R3 ←R1-R2 or R3 ←R1+R2+1
DR. PRASENJIT DEY 3
1’s complement
2/27/2021
5. Used for 1-bit addition
Let, x and y are two 1-bit variables. Then, the truth table of the half
adder will be
If we design this truth table in a k-map, then we will get the following
equations corresponding to the carry and sum
Which can be designed by this digital circuit
2/27/2021 DR. PRASENJIT DEY 5
carry = xy sum = xy’ + x’y
= x y
x
y carry
sum
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
x y carry sum
Hardware implementation: Half Adder
6. Used for n-bit addition
The truth table of the full adder is
If we design this truth table in a k-
map, then we will get the following
equations corresponding to the
carry and sum
2/27/2021 DR. PRASENJIT DEY 6
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
cn = xy + xcn-1+ ycn-1
= xy + (x y)cn-1
s = x’y’cn-1+x’yc’n-1+xy’c’n-1+xycn-1
= x y cn-1 = (x y) cn-1
x
y
cn-1
x
y
cn-1
cn s
x
y
cn-1
S
cn
x y cn-1 cn s
0
0
1
0
0
1
1
1
0
1
0
1
1
0
1
0
Hardware implementation: Full Adder
7. Binary Adder using Full Adder
DR. PRASENJIT DEY 7
C0
A0
B0
S0
A1
B1
S1
A2
B2
S2
A3
B3
S3
C1
C2
C3
C4
4-bit binary adder (connection
of FAs)
2/27/2021
FA
FA
FA
FA
A3A2A1A0 => 1 0 1 0
+B3B2B1B0=> 0 1 0 0
1 1 1 0
8. Binary Adder-Subtractor
DR. PRASENJIT DEY 8
FA
FA
FA
FA C0
A0
B0
S0
A1
B1
S1
A2
B2
S2
A3
B3
S3
C1
C2
C3
C4
4-bit adder-subtractor
M
2/27/2021
M=0: Addition
M=1: Subtraction
B3 B2 B1 B0
B3 B2 B1 B0
=0 1
M=1: A+B+1
M=1: A+B+0
9. Binary Adder-Subtractor
For unsigned numbers, this gives A – B if A≥B or the 2’s complement of
(B – A) if A < B
(example: 3 – 5 = -2= 1110)
For signed numbers, the result is A – B provided that there is no
overflow. (example : -3 – 5= -8) 1101
DR. PRASENJIT DEY 9
C3
C4
V =
1, if overflow
0, if no overflow
Overflow detector for signed numbers
2/27/2021
10. Binary Incrementer/Decrementer
DR. PRASENJIT DEY 10
C S
x y
HA
C S
x y
HA
C S
x y
HA
C S
x y
HA
S0
S1
S2
S3
C4
1
A0
A1
A2
A3
4-bit Binary Incrementer
2/27/2021
Binary Incrementer can also be implemented using a counter
A binary Decrementer can be implemented by adding 1111 to the
desired register each time!
A+(1111)
=A+2’s of 1
=A-1
11. Arithmetic Circuit
This circuit performs 4 distinct arithmetic operations and the
basic component of it is the parallel adder
The output of the binary adder is calculated from the following
arithmetic sum:
D = A + Y + Cin
DR. PRASENJIT DEY 11
2/27/2021
13. Logic Microoperations
There are in general 4 types of logical microoperations
OR Microoperation
Symbol: , +
Gate:
Example: 1001102 10101102 = 11101102
P+Q: R1←R2+R3, R4←R5 R6
DR. PRASENJIT DEY 13
2/27/2021
OR OR
17. Complex Logic Microoperations
Selective-set Operation
Used to force selected bits of a register into logic-1 by using the OR
operation
Example: 01002 10002 = 11002
DR. PRASENJIT DEY 17
2/27/2021
0 1 0 0
1 1 0 0
1 1 0 0
18. Complex Logic Microoperations cont.
Selective-complement (toggling) Operation
Used to force selected bits of a register to be complemented by using
the XOR operation
Example: 00012 10012 = 10002
DR. PRASENJIT DEY 18
2/27/2021
0 0 0 1
1 0 0 1
1 0 0 0
19. Complex Logic Microoperations cont.
Insert Operation
Step1: mask the desired bits
Step2: OR them with the desired value
Example: Let, R1 = 0110 1010, and we desire to replace the leftmost 4
bits (0110) with 1110 then:
◦ Step1: 0110 1010 0000 1111
◦ Step2: 0000 1010 1110 0000
R1 = 1110 1010
DR. PRASENJIT DEY 19
2/27/2021
21. Complex Logic Microoperations cont.
NOR Microoperation
Symbols: and
Gate:
Example: 1001102 10101102 = 00010012
DR. PRASENJIT DEY 21
2/27/2021
22. Complex Logic Microoperations cont.
Set (Preset) Microoperation
Force all bits into 1’s by ORing them with a value in which
all its bits are being assigned to logic-1
Example: 1001102 1111112 = 1111112
Clear (Reset) Microoperation
Force all bits into 0’s by ANDing them with a value in which
all its bits are being assigned to logic-0
Example: 1001102 0000002 = 0000002
DR. PRASENJIT DEY 22
2/27/2021
23. Hardware Implementation
The hardware implementation of logic microoperations requires that
logic gates be inserted for each bit or pair of bits in the registers to
perform the required logic function
Most computers use only four (AND, OR, XOR, and NOT) from which all
others can be derived.
DR. PRASENJIT DEY 23
2/27/2021
24. Hardware Implementation cont.
S1 S0 Output Operation
0 0 O = Ai Bi XOR
0 1 O = Ai Bi OR
1 0 O = Ai Bi AND
1 1 O = Ai Complement
DR. PRASENJIT DEY 24
S1
S0
0
1
2
3
4×1
MUX
Oi
Ai
Bi
2/27/2021
25. Shift Microoperations
Used for serial transfer of data
Also used in conjunction with arithmetic, logic, and other data-
processing operations
The contents of the register can be shifted to the left or to the right
As being shifted, the first flip-flop receives its binary information from
the serial input
Three types of shift:
Logical Circular Arithmetic
DR. PRASENJIT DEY 25
2/27/2021
26. Shift Microoperations cont.
DR. PRASENJIT DEY 26
r0
r1
r3
rn-1
r0
r1
r2
r3
rn-1
Shift Right
Shift Left
Serial Input Serial Output
Serial Output Serial Input
r2
2/27/2021
27. Shift Microoperations: Logical Shifts
Transfers 0 through the serial input
Logical Shift Right: R1←shr R1,1
Logical Shift Left: R2←shl R2,1
DR. PRASENJIT DEY 27
Logical Shift Left
? 0
r0
r1
r2
r3
rn-1
2/27/2021
28. Shift Microoperations: Circular Shifts
Circulates the bits of the register around the two ends without loss of
information
Circular Shift Right: R1←cir R1,1
Circular Shift Left: R2←cil R2,1
DR. PRASENJIT DEY 28
Circular Shift Left
r0
r1
r2
r3
rn-1
2/27/2021
29. Shift Microoperations: Arithmetic Shifts
Shifts a signed binary number to the left or right
An arithmetic shift-left multiplies a signed binary number by 2: ashl
(00100): 01000
An arithmetic shift-right divides the number by 2
ashr (00100) : 00010
An overflow may occur in arithmetic shift-left, and occurs when the
sign bit is changed (sign reversal)
ashl (10100) : 01001
DR. PRASENJIT DEY 29
2/27/2021
30. Shift Microoperations: Arithmetic Shifts cont.
DR. PRASENJIT DEY 30
Sign
Bit
Arithmetic Shift Left
Sign
Bit
?
0
?
r0
r1
r2
r3
rn-1
r0
r1
r2
r3
rn-1
2/27/2021
ashr (00100) : 00010
ashl (10100) : 010010
Arithmetic Shift Right
31. An overflow flip-flop Vs can be used to detect an arithmetic shift-left
overflow
Vs = Rn-1 Rn-2
DR. PRASENJIT DEY 31
Rn-2
Vs=
Rn-1 1 overflow
0 no overflow
2/27/2021
Shift Microoperations: Arithmetic Shifts cont.
32. Shift Microoperations cont.
Example: Assume R1=11001110, then:
◦ 1-bit Arithmetic shift right : R1 = 11100111
◦ 1-bit Arithmetic shift left : R1 = 10011100
◦ 1-bit Logical shift right : R1 = 01100111
◦ 1-bit Logical shift left : R1 = 10011100
◦ 1-bit Circular shift right : R1 = 01100111
◦ 1-bit Circular shift left : R1 = 10011101
DR. PRASENJIT DEY 32
2/27/2021
MSB
LSB
33. Hardware Implementation
A shift unit could be a bidirectional shift register with parallel
load.
Has drawbacks:
◦ Needs two pulses (the clock and the shift signal pulse)
◦ Not efficient in a processor unit where multiple number of registers
share a common bus
It is more efficient to implement the shift operation with a
combinational circuit
DR. PRASENJIT DEY 33
2/27/2021
34. Hardware Implementation cont.
DR. PRASENJIT DEY 34
S 1 0 S 1 0 S 1 0 S 1 0
A3A2A1A0
Serial Input IR Serial Input IL
Select
0 for shift right
1 for shift left
H3 H2 H1 H0
MUX MUX MUX MUX
4-bit Combinational Circuit Shifter
2/27/2021
35. Arithmetic Logic Shift Unit
Individual registers performing the microoperations directly
Connect these set of registers with a common operational unit called
an Arithmetic Logic Unit (ALU)
DR. PRASENJIT DEY 35
2/27/2021
36. Arithmetic Logic Shift Unit cont.
DR. PRASENJIT DEY 36
0
1
2
3
S3
S2
S1
S0
Bi
Ai
Ai+1
Ai-1
Enable
4×1
MUX
Ci
Ci+1
One stage of
arithmetic
circuit
One stage of
logic circuit
Di
Oi
Fi
shr
shl
One stage of
ALU
2/27/2021
s1s0: Arithmetic/logical
operations
s1s0 Arithmetic Logic
(00): Add XOR
(01): Subtract OR
(10): Increment AND
(11): Decrement NOT
s3s2 (00): Arithmetic operation
s3s2(01): Logic operation
s3s2(10): Right shift operation
s3s2 (11): Left shift operation