Impress
CMPSC-F353
Architecture of Comp Systems
Microoperations
Four types of microoperations:
Register transfer microoperations
Arithmetic microoperations
Logic microoperations
Shift microoperations
Microoperations
Arithmetic Microoperation
Negate : 2’s complement
Subtraction : R1 + 2’s complement of R2
Multiplication(shift left), Division(shift right)
Arithmetic Microoperation
M..Morris Mano. 1993. Computer System Architecture (3rd ed.). Pearson, Page 103
Binary Adder:
We use full adders to build binary adders
Full adder = 2-bits sum + previous carry
n-bit adder requires n full adders
4-bit Binary Adder :
c0(input carry), c4(output carry)
B3 A3 B2 A2 B1 A1 B0 A0
S3 S2 S1 S0
C0
C4
Arithmetic Microoperation
C1
C2
C3
Adder-Subtractor:
Subtracting A – B is done by adding 2’s complement of B to A.
• 2’s complement system makes it convenient to combine both addition and subtraction into one circuit, an adder-subtractor.
4-bit Binary Adder-Subtractor :
M =0 : Adder B M + C = B 0 + 0 = B, A + B
M =1 : Subtractor B M + C = B 1 + 1 = B’ + 1= -B(2’s comp), A – B
Arithmetic Microoperation
B3 A3 B2 A2 B1 A1 B0 A0
S3 S2 S1 S0
C4
C0
M
4-bit Binary Incrementor
The binary incrementor adds 1 to the contents of a register, e.g., a register storing 0101 would have 0110 in it after being incremented.
Sequential circuit implementation by using binary counter
Combinational circuit implementation by using Half Adder
4-bit Binary Incrementor
Arithmetic Microoperation
C4
S3 S2 S1 S0
B3 B2 B1 B0 1
Always added to 1
One circuit to implement all arithmetic microoperations
D= A + Y + Cin
A+1111=A-1
A-1+1=A
S0
S1
Cin
D0
D1
D2
D3
Cout
A0
B0
A1
B1
A2
B2
A3
B3
0
Arithmetic Circuit
Logic microoperations consider each bit of the register separately and treat them as binary variables
e.g.
Special Symbols
Special symbols will be adopted for the logic microoperations OR( ), AND( ), and complement(a bar on top), to distinguish them from the corresponding symbols used to express Boolean functions
e.g.
1010 Content of R1
+ 1100 Content of R2
0110 Content of R1 after P=1
Logic OR
Arithmetic ADD
Logic Microoperation
Hardware Implementation
Use 4 basic microoperations (AND, OR, XOR, Complement)
One stage of logic circuit
Logic microoperations are very useful for manipulating individual bits or a portion of a word stored in a register.
S0
S1
Ai
Bi
Logic Microoperation
Selective-set
The selective-set operation sets to 1 the bits in register A where there are corresponding 1’s in register B. It does not affect bit positions that have 0’s in B
Selective-complement
The selective-complement operation complements bits in A where there are corresponding 1’s in B. It does not effect bit positions that have 0’s in B
Selective-clear
The selective-clear operation clears to 0 the bits in A only where there are corresponding 1’s in B
1010 A before
1100 B(Logic Operand)
1110 A After
1010 A before
1100 B(Logic Operand)
0110 A After
1010 A before
1100 B(Logic Operand)
0010 A After
Selective-set
Selective-complement
Selective-clear
Some Applications
Selective-mask
It is similar to the selective-clear operation except that the bits of A are cleared only where there are corresponding 0’s in B
Insert
Inserts a new value into a group of bits. It is done by first masking the bits and then ORing them with the required value
Clear
The clear operation compares the words in A and B and produces an all 0’s result if the two numbers are equal
1010 A before
1100 B(Logic Operand)
1000 A After
Selective-mask
Some Applications
1) Mask 2) OR
0110 1010 A before 0000 1010 A before
0000 1111 B mask 1001 0000 B insert
0000 1010 A after mask 1001 1010 A after insert
Clear
0110 A
0110 B
0000 A after clear
Shift Microoperations
Shift microoperations are used for serial transfer of data
Three types of shift microoperation : Logical, Circular, and Arithmetic
Logical Shift
A logical shift transfers 0 through the serial input (Zero inserted)
Circular Shift(Rotate)
The circular shift circulates the bits of the register around the two ends without loss of information
0
0
Shift Microoperations
Arithmetic Shift
An arithmetic shift shifts a signed binary number to the left or right
An arithmetic shift-left multiplies a signed binary number by 2
An arithmetic shift-right divides the number by 2
Arithmetic shifts must leave the sign bit unchanged
Shift right :
Sign reversal occur : Overflow F/F Vs=1
Shift left :
LSB lost
MSB
LSB
Rn-1 Rn-2 . . . . . R1 R0
MSB
LSB
0 insert
Carry out
Sign bit
Shift Microoperations
Hardware Implementation(Shifter)
M..Morris Mano. 1993. Computer System Architecture (3rd ed.). Pearson, Page 116
Combinational Shifter
S3
S2
S1
S0
Bi
Ai
Ai-1
Ai+1
Fi
Ci
Ci+1
Arithmetic Logic Shift Unit
M..Morris Mano. 1993. Computer System Architecture (3rd ed.). Pearson, Page 118
What’s next?
Reading:
Chapter 4:
Section 4.4 to 4.7
FA�
FA�
FA�
FA�
FA�
FA�
FA�
FA�
x�
S�
y�
C�
HA�
x�
S�
y�
C�
HA�
x�
S�
y�
C�
HA�
x�
S�
y�
C�
HA�
InputOutput Microoperation
S1S0C
in
YD=A+Y+C
in
000BD=A+BAdd
001BD=A+B+1Add with carry
010B’D=A+B’Subtract with borrow
011B’D=A+B’+1Subtract
1000D=ATransfer A
1010D=A+1Increment A
1101D=A-1Decrement A
1111D=ATransfer A
Select
S�
2�
1�
0�
3�
4*1
MUX
�
0
�
S�
1�
X�
0
�
C�
1�
Y�
0
�
C�
0
�
2�
1�
0�
3�
4*1
MUX
�
S�
0
�
S�
1�
X�
1�
C�
2�
Y�
1�
C�
1�
2�
1�
0�
3�
4*1
MUX
�
S�
0
�
S�
1�
X�
3�
C�
4�
Y�
3�
C�
3�
2�
1�
0�
3�
4*1
MUX
�
S�
0
�
S�
1�
X�
2�
C�
3�
Y�
2�
C�
2�
FA�
FA�
FA�
FA�
Sheet1
Select Input Output Microoperation
S1 S0 Cin Y D=A+Y+Cin
0 0 0 B D=A+B Add
0 0 1 B D=A+B+1 Add with carry
0 1 0 B’ D=A+B’ Subtract with borrow
0 1 1 B’ D=A+B’+1 Subtract
1 0 0 0 D=A Transfer A
1 0 1 0 D=A+1 Increment A
1 1 0 1 D=A-1 Decrement A
1 1 1 1 D=A Transfer A
D=A+B
2
1
1
:
R
R
R
P
Å
¬
6
5
4
,
3
2
1
:
R
R
R
R
R
R
Q
P
Ú
¬
+
¬
+
S
1
S
0
0
1
3
2
4*1
MUX
E
i
S�
1�
S�
0�
0�
1�
3�
2�
4*1
MUX�
E�
i�
B
A
A
Ú
¬
B
A
A
Å
¬
B
A
A
Ù
¬
B
A
A
Ù
¬
2
2
1
1
R
shr
R
R
shl
R
¬
¬
2
2
1
1
R
cir
R
R
cil
R
¬
¬
2
2
R
ashr
R
¬
2
2
R
ashl
R
¬
R
R
V
n
n
s
2
1
–
–
Å
=
2�
1�
0�
3�
4*1
MUX
�
Select�
One state of arithmetic
circuit
(Fig. 4.9)�
One state of logic circuit
(Fig. 4.10)�