CAO Unit 1 - II
CAO Unit 1 - II
Arithmetic M icrooperations
MICROOPERATIONS
ARITHMETIC MICROOPERATIONS
• The basic arithmetic microoperations are
– Addition
– Subtraction
– Increment
– Decrement
Binary Adder
Binary Adder-Subtractor
Binary Incrementer
Arithmetic M icrooperations
ARITHMETIC CIRCUIT
Cin
S1
S0
A0 X0 C0
S1 D0
S0 FA
B0 0 4x1 Y0 C1
1 MUX
2
3
A1 X1 C1
S1 FA D1
S0
B1 0 4x1 Y1 C2
1 MUX
2
3
A2 X2 C2
S1 FA D2
S0
B2 0 4x1 Y2 C3
1 MUX
2
3
A3 X3 C3
S1 FA D3
S0
B3 0 4x1 Y3 C4
1 MUX
2
3 Cout
0 1
LOGIC MICROOPERATIONS
• Specify binary operations on the strings of bits in registers
– Logic microoperations are bit-wise operations, i.e., they work on the
individual bits of data
– useful for bit manipulations on binary data
– useful for making logical decisions based on the bit value
• There are, in principle, 16 different logic functions that can
be defined over two binary input variables
A B F0 F1 F2 … F13 F14 F15
0 0 0 0 0 … 1 1 1
0 1 0 0 0 … 1 1 1
1 0 0 0 1 … 0 1 1
1 1 0 1 0 … 1 0 1
Ai
0
Bi
1
4X1 Fi
MUX
2
3 Select
S1
S0
Function
S1 S0 table
Output μ-
0 0 F=A∧B AND
operation
0 1 F=A∨B OR
1 0 F=A⊕B XOR
1 1 F = A’ Complement
Logic Microoperations
– Selective-set A←A+B
– Selective-complement A←A⊕B
– Selective-clear A ← A • B’
– Mask (Delete) A←A•B
– Clear A←A⊕B
– Insert A ← (A • B) + C
– Compare A←A⊕B
– ...
Logic Microoperations
SELECTIVE SET
1 1 0 0 At
1010 B
1 1 1 0 At+1 (A ← A + B)
SELECTIVE COMPLEMENT
1 1 0 0 At
1010 B
0 1 1 0 At+1 (A ← A ⊕ B)
SELECTIVE CLEAR
1 1 0 0 At
1010 B
0 1 0 0 At+1 (A ← A ⋅ B’)
MASK OPERATION
1 1 0 0 At
1010 B
1 0 0 0 At+1 (A ← A ⋅ B)
CLEAR OPERATION
1 1 0 0 At
1010 B
0 1 1 0 At+1 (A ← A ⊕ B)
Logic Microoperations
INSERT OPERATION
• An insert operation is used to introduce a specific bit pattern
into A register, leaving the other bit positions unchanged
• This is done as
– A mask operation to clear the desired bit positions, followed by
– An OR operation to introduce the new bits into the desired
positions
– Example
» Suppose you wanted to introduce 1010 into the low order
four bits of A: 1101 1000 1011 0001 A (Original)
1101 1000 1011 1010 A
(Desired)
LOGICAL SHIFT
• In a logical shift the serial input to the shift is a 0.
• A right logical shift operation:
• 11011001
0
0 1 1 0 1 1 0 1
0
• A left logical shift operation:
0
1 1 0 1 1 0 0 1 0
CIRCULAR SHIFT
• In a circular shift the serial input is the bit that is shifted out of
the other end of the register.
ARITHMETIC SHIFT
• An left arithmetic shift operation must be checked for the
overflow
0
sign
bit
S
MUX H0
0
1
A0
A1 S
MUX H1
0
A2 1
A3
S
MUX H2
0
1
S
MUX H3
0
1
Serial
input (IL)
Shift M icrooperations
Arithmetic D i
Circuit
Select
Ci+1
0 4x1 Fi
1 MUX
2
3
Logic Ei
Bi Circuit
Ai
Ai-1 shr
Ai+1 shl