4 Arithmetic Operations
4 Arithmetic Operations
Operations
Topics discussed :
Topics to be discussed :
Arithmetic Micro-operations
Logic Micro-operations
Shift Micro-operations
Arithmetic Logic Shift Unit
1
2
Logic Micro-operations
2
Hardware Implementation
Ai
0
Bi
1
4X1 Fi
MUX
2
3 Select
S1
S0
Function table
S1 S0 Output -operation
0 0 F=AB AND
0 1 F = AB OR
1 0 F=AB XOR
1 1 F = A’ Complement
Applications of Logic Micro-operations
Selective-set AA+B
Selective-complement AAB
Selective-clear A A • B’
Mask (Delete) AA•B
Clear/Compare AAB
Insert A (A • B) + C
Applications of Logic Micro-operations
Selective Set, the bit pattern in B is Selective complement, the bit pattern
used to set certain bits in A in B is used to complement certain
bits in A
1 1 0 0 At 1 1 0 0 At
1010 B 1010 B
1 1 1 0 At+1 (A A + B)
0 1 1 0 At+1 (A A B)
Selective Clear operation, the bit Mask operation, the bit pattern in B is
pattern in B is used to clear used to clear certain bits in A
certain bits in A
1 1 0 0 At 1 1 0 0 At
1010 B 1010 B
0 1 0 0 At+1 (A A B’) 1 0 0 0 At+1 (A A B)
If a bit in B is set to 1,
that same position in A If a bit in B is set to 0, that
gets set to 0, otherwise same position in A gets set
it is unchanged to 0, otherwise it is
unchanged
Applications of Logic Microoperations
Clear: if the bits in the same position in A and B are the same, they
are cleared in A, otherwise they are set in A
1 1 0 0 At
1010 B
0 1 1 0 At+1 (A A B)
Applications of Logic Micro-operations
Insert operation is used to introduce a specific bit pattern into A register,
leaving the other bit positions unchanged.
Steps :
A mask operation to clear the desired bit positions, followed by
An OR operation to introduce the new bits into the desired positions
Example
• To introduce 1010 into the low order four bits of A:
1101 1000 1011 0001 A (Original)
1101 1000 1011 1010 A (Desired)
Serial
input
Serial
input
sign
bit
Arithmetic Right Shift
sign
bit
Arithmetic Left Shift
Arithmetic Shift
0 4x1
C F
i+1 1 i
MUX
2
3
E
Logic i
B
i Circuit
A
i
shr
A
i-1
shl
A
i+1