Register Transfer and Micro operations
Chapter No - 4
cpe 252: Computer Organization
1
contents
cpe 252: Computer Organization
2
• Register Transfer Language
• Register Transfer
• Bus and Memory Transfers
• Arithmetic Microoperations
• Logic Microoperations
• Shift Microoperations
• Arithmetic Logic Shift Unit
4-1 Register Transfer Language (RTL)
cpe 252: Computer Organization
3
4-1 Register Transfer Language cont.
microoperations is used to describe it
cpe 252: Computer Organization
4
101101110011
010110111001
Shift Right Operation
4-1 Register Transfer Language cont.
cpe 252: Computer Organization
5
4-1 Register Transfer Language cont.
Next steps:
cpe 252: Computer Organization
6
4-2 Register Transfer (our first microoperation)
cpe 252: Computer Organization
7
4-2 Register Transfer cont.
cpe 252: Computer Organization
8
R1
7 6 5 4 3 2 1 0
A block diagram of a register
Register R1
Showing individual bits
4-2 Register Transfer cont.
cpe 252: Computer Organization
9
PC
Numbering of bits
Partitioned into two parts
15
0
PC(H)
PC(L)
0
7
8
15
Lower byte
Upper byte
Other ways of drawing the block diagram of a register:
4-2 Register Transfer cont.
cpe 252: Computer Organization
10
4-2 Register Transfer cont.
P: R2 ← R1
cpe 252: Computer Organization
11
4-2 Register Transfer cont.
cpe 252: Computer Organization
12
n
Clock
R1
R2
Control Circuit
Load
t
t+1
Clock
Load
Transfer occurs here
Synchronized with the clock
P
Hardware implementation of a controlled transfer: P: R2 ← R1
Block diagram:
Timing diagram
4-2 Register Transfer cont.
cpe 252: Computer Organization
13
Basic Symbols for Register Transfers | ||
Symbol | Description | Examples |
Letters & numerals | Denotes a register | MAR, R2 |
Parenthesis ( ) | Denotes a part of a register | R2(0-7), R2(L) |
Arrow ← | Denotes transfer of information | R2 ← R1 |
Comma , | Separates two microoperations | R2 ← R1, R1 ← R2 |
4-3 Bus and Memory Transfers
cpe 252: Computer Organization
14
4-3 Bus and Memory Transfers
cpe 252: Computer Organization
15
3 2 1 0
Register D
D3 D2 D1 D0
3 2 1 0
Register C
C3 C2 C1 C0
3 2 1 0
Register B
B3 B2 B1 B0
3 2 1 0
Register A
A3 A2 A1 A0
D3 C3 B3 A3
S0
S1
MUX3
3 2 1 0
D2 C2 B2 A2
S0
S1
MUX2
3 2 1 0
D1 C1 B1 A1
S0
S1
MUX1
3 2 1 0
D0 C0 B0 A0
S0
S1
MUX0
3 2 1 0
4-Line Common Bus
Register A
Register B
Register C
Register D
Bus lines
4-3 Bus and Memory Transfers
R2 ←BUS (Load R2)
cpe 252: Computer Organization
16
4-3 Bus and Memory Transfers: Three-State Bus Buffers
cpe 252: Computer Organization
17
Normal input A
Control input C
Three-State Buffer
Output B
4-3 Bus and Memory Transfers: Three-State Bus Buffers cont.
cpe 252: Computer Organization
18
A
C=1
B
A
B
A
C=0
B
A
B
Buffer
Open Circuit
4-3 Bus and Memory Transfers: Three-State Bus Buffers cont.
cpe 252: Computer Organization
19
2×4 Decoder
Select
Enable
0
1
2
3
S1
S0
E
Bus line for bit 0
A0
B0
C0
D0
Bus line with three-state buffer (replaces MUX0 in the previous diagram)
4-3 Bus and Memory Transfers: Memory Transfer
cpe 252: Computer Organization
20
4-3 Bus and Memory Transfers: Memory Transfer cont.
cpe 252: Computer Organization
21
4-3 Bus and Memory Transfers: Memory Transfer cont.
cpe 252: Computer Organization
22
AR
x12
x0C
x0E
x10
x12
x14
x16
x18
19
34
45
66
0
13
22
R1←M[AR]
R1
100
R1
66
RAM
R1
100
4-4 Arithmetic Microoperations
cpe 252: Computer Organization
23
4-4 Arithmetic Microoperations cont.
R3 ←R1+R2
R3 ←R1-R2 or :
R3 ←R1+R2+1
cpe 252: Computer Organization
24
1’s complement
4-4 Arithmetic Microoperations cont.
R2 ←R2
R2 ←R2+1
R2 ←R2+1
R2 ←R2-1
cpe 252: Computer Organization
25
Half Adder/Full Adder
cpe 252: Computer Organization
26
Half Adder
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
c = xy s = xy’ + x’y
= x ⊕ y
x
y
c
s
x
y
cn-1
S
cn
Full Adder
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
x y c s
x y cn-1 cn s
0
0
1
0
0
1
1
1
0
1
0
1
1
0
1
0
4-4 Arithmetic Microoperations Binary Adder
cpe 252: Computer Organization
27
FA
FA
FA
FA
C0
A0
B0
S0
A1
B1
S1
A2
B2
S2
A3
B3
S3
C1
C2
C3
C4
4-bit binary adder (connection of FAs)
4-4 Arithmetic Microoperations Binary Adder-Subtractor
cpe 252: Computer Organization
28
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
4-4 Arithmetic Microoperations Binary Adder-Subtractor
(example: 3 – 5 = -2= 1110)
1011 +
ـــــــــــــــــــــــــــ
1000
cpe 252: Computer Organization
29
C3
C4
V =
1, if overflow
0, if no overflow
Overflow detector for signed numbers
4-4 Arithmetic Microoperations Binary Adder-Subtractor cont.
cpe 252: Computer Organization
30
4-4 Arithmetic Microoperations Binary Incrementer
cpe 252: Computer Organization
31
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
4-4 Arithmetic Microoperations Binary Incrementer
cpe 252: Computer Organization
32
4-4 Arithmetic Microoperations Arithmetic Circuit
cpe 252: Computer Organization
33
4-4 Arithmetic Microoperations Arithmetic Circuit cont.
cpe 252: Computer Organization
34
B0
3 2 1 0 S1 S0
4×1 MUX
FA
FA
FA
FA
Cin
D0
D1
D2
D3
C1
C2
C3
Cout
B0
1
0
S1
S0
B1
3 2 1 0 S1 S0
4×1 MUX
B1
1
0
S1
S0
B2
3 2 1 0 S1 S0
4×1 MUX
B2
1
0
S1
S0
B3
3 2 1 0 S1 S0
4×1 MUX
B3
1
0
S1
S0
A0
A1
A2
A3
4-bit Arithmetic Circuit
X0
Y0
X1
Y1
X2
Y2
X3
Y3
Figure A
4-5 Logic Microoperations�The four basic microoperations
OR Microoperation
P+Q: R1←R2+R3, R4←R5 ∨R6
cpe 252: Computer Organization
35
OR
OR
ADD
4-5 Logic Microoperations�The four basic microoperations cont.
AND Microoperation
cpe 252: Computer Organization
36
4-5 Logic Microoperations�The four basic microoperations cont.
Complement (NOT) Microoperation
cpe 252: Computer Organization
37
4-5 Logic Microoperations�The four basic microoperations cont.
XOR (Exclusive-OR) Microoperation
cpe 252: Computer Organization
38
4-5 Logic Microoperations�Other Logic Microoperations
Selective-set Operation
cpe 252: Computer Organization
39
In a processor register
Loaded into a register from memory to perform the selective-set operation
4-5 Logic Microoperations�Other Logic Microoperations cont.
Selective-complement (toggling) Operation
cpe 252: Computer Organization
40
In a processor register
Loaded into a register from memory to perform the selective-complement operation
4-5 Logic Microoperations�Other Logic Microoperations cont.
Insert Operation
cpe 252: Computer Organization
41
4-5 Logic Microoperations� Other Logic Microoperations cont.
NAND Microoperation
cpe 252: Computer Organization
42
4-5 Logic Microoperations� Other Logic Microoperations cont.
NOR Microoperation
cpe 252: Computer Organization
43
4-5 Logic Microoperations� Other Logic Microoperations cont.
Set (Preset) Microoperation
Clear (Reset) Microoperation
cpe 252: Computer Organization
44
4-5 Logic Microoperations�Hardware Implementation
cpe 252: Computer Organization
45
4-5 Logic Microoperations�Hardware Implementation cont.
cpe 252: Computer Organization
46
S1
S0
0
1
2
3
4×1 MUX
Ei
Ai
Bi
S1 | S0 | Output | Operation |
0 | 0 | E = A ⊕ B | XOR |
0 | 1 | E = A ∨ B | OR |
1 | 0 | E = A ∧ B | AND |
1 | 1 | E = A | Complement |
This is for one bit i
Figure B
4-6 Shift Microoperations
cpe 252: Computer Organization
47
4-6 Shift Microoperations cont.
cpe 252: Computer Organization
48
r0
r1
r3
rn-1
r0
r1
r2
r3
rn-1
Shift Right
Shift Left
Serial Input
Serial Output
Serial Output
Serial Input
Determines the “shift” type
r2
**Note that the bit ri is the bit at position (i) of the register
4-6 Shift Microoperations: �Logical Shifts
cpe 252: Computer Organization
49
The same
The same
Logical Shift Left
?
0
r0
r1
r2
r3
rn-1
4-6 Shift Microoperations: �Circular Shifts (Rotate Operation)
cpe 252: Computer Organization
50
The same
The same
Circular Shift Left
r0
r1
r2
r3
rn-1
4-6 Shift Microoperations� Arithmetic Shifts
ashr (00100) : 00010
cpe 252: Computer Organization
51
4-6 Shift Microoperations� Arithmetic Shifts cont.
cpe 252: Computer Organization
52
Arithmetic Shift Right
Sign Bit
Arithmetic Shift Left
Sign Bit
?
0
?
r0
r1
r2
r3
rn-1
r0
r1
r2
r3
rn-1
4-6 Shift Microoperations� Arithmetic Shifts cont.
Vs = Rn-1 ⊕ Rn-2
cpe 252: Computer Organization
53
Rn-2
Vs=
Rn-1
1 🡪 overflow
0 🡪 no overflow
4-6 Shift Microoperations cont.
cpe 252: Computer Organization
54
4-6 Shift Microoperations �Hardware Implementation cont.
cpe 252: Computer Organization
55
4-6 Shift Microoperations �Hardware Implementation cont.
cpe 252: Computer Organization
56
S
1
0
S
1
0
S
1
0
S
1
0
A3
A2
A1
A0
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
4-6 Shift Microoperations �Hardware Implementation cont.
cpe 252: Computer Organization
57
S
1
0
S
1
0
S
1
0
S
1
0
A3
A2
A1
A0
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
4-7 Arithmetic Logic Shift Unit
cpe 252: Computer Organization
58
4-7 Arithmetic Logic Shift Unit cont.
cpe 252: Computer Organization
59
0
1
2
3
S3
S2
S1
S0
Bi
Ai
Ai+1
Ai-1
Select
4×1 MUX
Ci
Ci+1
One stage of arithmetic circuit (Fig.A)
One stage of logic circuit (Fig.B)
Di
Ei
Fi
shr
shl
One stage of ALU
60