Cse 211 Notes
Cse 211 Notes
Lecture 6
Overview
Register Transfer
Arithmetic Micro-operations
Logic Micro-operations
Shift Micro-operations
Micro-operations set
MAR
• Designation of a register
- a register
- portion of a register
- a bit of a register
15 0 15 8 7 0
R2 PC(H) PC(L)
Numbering of bits Subfields
Register Transfer and Micro-operations 7
Lecture 6
Register Transfer Language
• Copying the contents of one register to another is a register
transfer
R2 R1
R3 R5
P: R2 R1
Load
Transfer occurs here
The same clock controls the circuits that generate the control
function and the destination register
Registers are assumed to use positive-edge-triggered flip-flops
Register Transfer
Arithmetic Micro-operations
Logic Micro-operations
Shift Micro-operations
Bus lines
B1 C 1 D 1 B2 C 2 D 2 B3 C 3 D 3 B4 C 4 D 4
0 0 0 0
4 x1 4 x1 4 x1 4 x1
MUX MUX MUX MUX
x
select
y
4-line bus
Register Transfer and Micro-operations 15
Le
Connecting Registers - Bus Transfer
Bus lines
Load
Reg. R0 Reg. R1 Reg. R2 Reg. R3
S0 0
Select 1
S1 2
Enable 3
Register Transfer and Micro-operations 16
Memory - RAM
Memory (RAM) can be thought as a sequential circuits
containing some number of registers
These registers hold the words of memory
Each of the r registers is indicated by an address
These addresses range from 0 to r-1
Each register (word) can hold n bits of data
Assume the RAM contains r = 2k words. It needs the
following data input lines
1. n data input lines
n
2. n data output lines
address lines
3. k address lines k
RAM
4. A Read control line Read
unit
5. A Write control line Write
n
data output lines
Register Transfer and Micro-operations 17
Lecture 7
Memory Transfer
Memory is usually accessed in computer systems by putting the
desired address in a special register, the Memory Address Register
(MAR, or AR)
M
Memory Read
AR
unit Write
Read : DR M[AR]
Register Transfer and Micro-operations 18
Lecture 7
Memory Read
Memory Write
M[MAR] R1
MICROOPERATIONS
Arithmetic MICROOPERATIONS
• The basic arithmetic microoperations are
– Addition
– Subtraction
– Increment
– Decrement
Overview
Register Transfer
Arithmetic Micro-operations
Logic Micro-operations
Shift Micro-operations
Binary Adder
Binary Adder
B3 A3 B2 A2 B1 A1 B0 A0
FA C3 FA C2 FA C1 FA C0
C4 S3 S2 S1 S0
Binary Adder-Subtractor
Binary Adder-Subtractor
B3 A3 B2 A2 B1 A1 B0 A0
FA C3 FA C2 FA C1 FA C0
C4 S3 S2 S1 S0
Binary Incrementer
Binary Incrementer
A3 A2 A1 A0 1
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
S1 D0
S0 FA
B0 0 Y0 C1
1 4x1
2 MUX
3
A1 X1 C1
S1 D1
S0 FA
B1 0 4x1 Y1 C2
1
2 MUX
3
A2 X2 C2
S1 D2
S0 FA
B2 0 Y2 C3
1 4x1
2 MUX
3
A3 X3 C3
S1 D3
S0 FA
B3 0 Y3 C4
1 4x1
2 MUX Cout
3
0 1
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
Register Transfer and Micro-operations 30
Selective-set AA+B
Selective-complement AAB
Selective-clear A A • B’
Mask (Delete) AA•B
Clear AAB
Insert A (A • B) + C
Compare AAB
Register Transfer and Micro-operations 31
0110 At+1 (A A B)
If a bit in B is set to 1, that same position in A gets complemented
from its original value, otherwise it is unchanged
Register Transfer and Micro-operations 32
0 1 0 0 At+1 (A A B’)
If a bit in B is set to 1, that same position in A gets set to 0, otherwise
it is unchanged
4. In a mask operation, the bit pattern in B is used to clear certain bits
in A 1 1 0 0 At
1010 B
1 0 0 0 At+1 (A A B)
0110 At+1 (A A B)
Register Transfer and Micro-operations 34
Shift Microoperations
• There are three types of shifts
– Logical shift
– Circular shift
– Arithmetic shift
• What differentiates them is the information that goes into the
serial input
• A right shift operation
Serial
input
Logical Shift
• In a logical shift the serial input to the shift is a 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 arithmetic shift is meant for signed binary numbers (integer)
• An arithmetic left shift multiplies a signed number by two
• An arithmetic right shift divides a signed number by two
• The main distinction of an arithmetic shift is that it must keep the
sign of the number the same as it performs the multiplication or
division
sign
bit
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)
Register Transfer and Micro-operations 41
D
Arithmetic i
Circuit
Select
0 4x1
C i+1 F
1 i
MUX S3 S2 S1 S0 Cin Operation
2 0 0 0 0 0 F=A
3 0 0 0 0 1 F=A+1
0 0 0 1 0 F=A+B
E 0 0 0 1 1 F=A+B+1
Logic i 0 0 1 0 0 F = A + B’
Bi 0 0 1 0 1 F = A + B’+ 1
Circuit 0 0 1 1 0 F=A-1
A 0 0 1 1 1 F=A
i
0 1 0 0 X F=AB
shr
A 0 1 0 1 X F = A B
i-1 0 1 1 0 X F=AB
shl
A 0 1 1 1 X F = A’
i+1
1 0 X X X F = shr A
1 1 X X X F = shl A