micro operations
micro operations
Arithmetic Microoperations
• Unlike register transfer microoperations,
arithmetic microoperations change the information
content.
• The basic arithmetic microoperations are:
– addition
– subtraction
– increment
– decrement
– shift
Arithmetic Microoperations (continued)
Arithmetic Microoperations
Symbolic Description
Designation
R3 ← R1 + R2 Contents of R1 plus R2 transferred to R3
R3 ← R1 – R2 Contents of R1 minus R2 transferred to R3
R2 ← R2 Complement contents of R2 (1’s comp.)
R2 ← R2 + 1 2’s complment contens of R2 (negate)
R3 ← R1+R2 + 1 R1 plus 2’s comp. of R2
R1 ← R1 + 1 Increment content of R1 by 1
R1 ← R1 - 1 Decrement content of R1 by 1
Binary Adder
• We implement a binary adder with registers to
hold the data and a digital circuit to perform the
addition (called a binary adder).
• The binary adders is constructed using full adders
connected in cascade so that the carry produced by
one full adder becomes an input for the next.
• Adding two n-bit numbers requires n full adders.
• The n data bits for A and B might come from R1
and R2 respectively
B3 A3 B2 A2 B1 A1 B0 A0
C3 C2 C1
FA FA FA FA C0
S3 S2 S1 S0
C4
Adder-Subtracter
• Subtracting A – B is most easily done by adding
B’ to A and then adding 1.
• This makes it convenient to combine both addition
and subtraction into one circuit, called an adder-
subtracter.
• M is the mode indicator
– M = 0 indicates addition (B is left alone and C0 is 0)
– M = 1 indicates subtraction (B is complement and C0 is
1).
4-Bit Adder-Subtractor
B3 A3 B2 A2 B1 A1 B0 A0
C3 C2 C1
FA FA FA FA C0
S3 S2 S1 S0
C4
Binary Incrementer
• The binary incrementer adds 1 to the
contents of a register, e.g., a register storing
0101 would have 0110 in it after being
incremented.
• There are times when we want incrementing
done independent of a register. We can
accomplish this with a series of cascading
half-adders.
x y x y x y x y
HA HA HA HA
C S C S C S C S
C4 S3 S2 S1 S0
Arithmetic Circuit
• We can implement 7 arithmetic micro-
operations (add, add with carry, subtract,
subtract with borrow, increment, decrement
and transfer) with one circuit.
• We provide a series of cascading full adders
with Ai and the output of a 4x1 multiplexer.
– The multiplexers’ inputs are two selects, Bi, Bi’,
logical 0 and logical 1.
– Which of these four values we provide
(together with the carry) determines which
microoperation is performed.
S1 FA D1
S0
4x1 Y1 C2
B1 0
1 MUX
2
3
X2 C2
A2
FA D2
S1
S0 Y2 C3
B2 0
4x1
1 MUX
2 X3 C3
3
A3 FA D3
S1
S0 Y3 C4
B3 0
4x1
1 MUX cout
0 2
3
x y F0 F1 F2 F3 F4 F5 F6 F7
0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 1 1 1 1
1 0 0 0 1 1 0 0 1 1
1 1 0 1 0 1 0 1 0 1
Truth Tables for 16 2-Variable Function (continued)
0 0 1 1 1 1 1 1 1 1
0 1 0 0 0 0 1 1 1 1
1 0 0 0 1 1 0 0 1 1
1 1 0 1 0 1 0 1 0 1
F0 = 0 F←0 Clear
F1 = xy F←A∧ B AND
F2 = xy’ F ←A ∧ B
F3 = x F ←A Transfer A
F4 = x’y F ←A ∧ B
F5 = y F ←B Transfer B
F6 = x ⊕ y F ←A ⊕ B Exclusive-OR
F7 = x + y F←A ∨ B OR
Sixteen Logic Microoperations (continued)
S1 S0 Output Operation
S1
S0
0 0 E =A^ B AND
Ai 4x1
0 MUX
Bi 0 1 E =A∨ B OR
1
1 0 E =A⊕ B XOR
2
1 1 E = A’ Complement
3
Logic Applications
• Logic Operations allow us to manipulate
individual bits in ways that we could not do
otherwise.
• These applications include:
– selective set
– selective complement
– select clear
– mask
– insert
– clear
Selective-Set
Selective Clear
Insert
Shift Microoperations
• Shift microoperations are used for serial transfer
of data and are used in conjunction with arithmetic
and logic operations.
• The register contents can be shifted to the left or to
the right.
• There are three types of shift operations:
– Logical shifts transfers 0 through the serial input, with
all the bits involved in the shifting.
– Arithmetic shifts multiplies (or divides) a signed
number by 2.
– Circular shifts circulates the bits of the register around
the two ends with no loss of information.
Shift Microoperations
Symbolic Designation Description
R ← shl R Shift-left register R
R ← shr R Shift-right register R
R ← cil R Circular shift-left register R
Rn-1 Rn-1 R1 R0
Sign
bit
4-Bit Combinational Circuit Shifter
Select
0 shift right
1 shift left
S
Serial input 0 MUX H0
IR 1
S
A0
0 MUX H1
1
A1
S
0 MUX H2
1
A2
S
A3
0 MUX H3
Serial input 1
IL
S0 Di
One stage
of Arithmetic
Circuit Select
0 4x1 Fi
Ci+1 1 MUX
2
3
One stage
of Logic Ei
Circuit
Bi
Ai
Ai-1 shr
Ai+1 shl
Operation Select
S3 S2 S1 S0 Cin Operation Function
0 0 0 0 0 F =A Transfer A
0 0 0 0 1 F=A+ 1 Increment A
0 0 0 1 0 F=A+ B Addition
0 0 0 1 1 F=A+ B+ 1 Add with Carry
0 0 1 0 0 F=A+ B Subtract with Borrow
0 0 1 0 1 F=A+ B+ 1 Subtraction
0 0 1 1 0 F=A–1 Decrement A
0 0 1 1 1 F=A Transfer A
Function Table for Arithmetic Logic Shift Unit
Operation Select
S3 S2 S1 S0 Cin Operation Function
0 1 0 0 x F=A∧B AND
0 1 0 1 x F=A∨ B OR
0 1 1 0 x F=A⊕ B XOR
0 1 1 1 x F=A Complement A
1 0 x x x F = shr A Shift-Right A into F
1 1 x x x F = shl A Shift-Left A into F