Professional Documents
Culture Documents
Comp 321 Lecture Slide Chapter 3 (Register Transfer & Microoperations)
Comp 321 Lecture Slide Chapter 3 (Register Transfer & Microoperations)
Comp 321 Lecture Slide Chapter 3 (Register Transfer & Microoperations)
1
Computer Registers
▪ How to define the internal hardware organization of a digital
computer ?
1. Set of registers & their function
2. Sequence of microoperations
3. Control that initiates the sequence of microoperation
• Registers hold data that can be readily accessed by the CPU.
• Most computers have registers of a certain size. (Common sizes
include 16, 32, and 64 bits).
• Computer instructions are stored in consecutive memory
locations and executed sequentially one at a time.
• The control reads an instruction from specific address in memory
and executes it. This needs:
1. Counter to calculate the address of the next instruction
2. Register in the control unit for storing instruction codes that
2
read from memory.
Cont….
3
Cont….
4
Cont….
6
Cont….
7
Register Transfer Language
10
Cont….
11
Cont….
12
Cont….
This is a point-to-point
bus configuration:
15
Cont….
16
Cont….
17
The next slide shows a model bus configuration.
Cont….
18
Common Bus System
19
Cont….
21
Cont….
22
Construction of common bus
23
Cont….
• 4 bit register X 4
• Four by 4 X 1 Multiplexers 4-line
common
• Bus Selection : S0, S1 bus
When we represent in
Function table by the
value Of S1S0
Q: how many multiplexers are needed for the 16 bit eight registers ?
▪ Number of variables used?🡺selection inputs
▪ How many line common bus is constructed?
▪ Size of multiplexers? 24
Cont….
25
Cont….
26
Cont….
28
Memory Transfer
30
Arithmetic microoperation
• Addition:
• Negate : 2’s complement
• Subtraction : R1 + 2’s complement of R2
• Increment by 1
• Decrement by 1
Binary adder
• To perform this arithmetic operation we need register and
digital component.
• The digital circuit that generates the arithmetic sum of two binary
numbers of any length.
• Constructed with full-adder circuits connected in cascade, with
the output carry from one full-adder connected to the input carry
31
of the next full- adder.
Cont….
Hardware implementation
32
Cont….
Binary incrementer
• The increment microoperation adds one to a number in a
register. Implemented with binary counter
• The binary incrementer is constructed with Half-adder
circuits connected in cascade, with the output carry from one
Half-adder connected to the input carry of the next Half-
adder.
For example, if a 4-bit register has a binary value 0110, it will
go to 0111 after it is incremented.
Always
added to 1
33
Logic microoperations
• Logic microoperations consider each bit of the register
separately and treat them as binary variables.
+ 1100 Content of R2
Special Symbols
Special symbols will be adopted for the0110logic
Content of R1 after P=1
microoperations
OR(∨), AND(∧), XOR(⊕) and complement(a bar on top), to
distinguish them from the corresponding symbols used to
express Boolean functions.
e.g.
Arithmetic Logic
Boolean OR
ADD OR
34
Cont….
Hardware implementation
•16 microoperations- Use only 4(AND, OR, XOR, Complement)
•One stage of logic circuit (for n bit circuit we need n diagrams)
S0
S1
Ai
Bi
35
Applications of Logic microoperations
• Logic microoperations are very useful for manipulating
individual bits or a portion of a word stored in a register.
• Used to change bit values, delete a group of bits, or insert new
bit values.
❖ 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 effect bit positions that have
0’s in B.
1010 A before
❖ 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
▪ Similar to the selective-clear operation except that the bits of A are cleared only
where there are corresponding 0’s in B
1010 A before
1100 B(Logic Operand)
1000 A After
❖ Insert operation
▪ The insert operation inserts a new value into a group of bits
▪ This is done by first masking the bits and then ORing them with the
required value
37
Cont….
1) Mask 2) OR
0110 1010 A before 0000 1010 A before
0000 1111 B mask 1001 0000 B insert
❖ Clear
▪ The clear operation compares the words in A and B and produces an all
0’s result if the two numbers are equal.
0110 A
0110 B
0000 A after clear
38
Shift Microoperation
39
Types of Shift microoperation
1.Logical Shift
•is one that transfers 0 through the serial input.
•The bit transferred to the end position through the serial input is
assumed to be 0 during a logical shift(Zero inserted).
Solution
R= 11010101
logical shift-left(shl R) = 10101010
circular shift- right(cir R)= 01010101
logical shift- right(shr R) = 00101010
circular shift-left(cil L) = 01010100
3. Arithmetic Shift
▪ An arithmetic shift shifts a signed binary number to the left or right
▪ Arithmetic shifts must leave the sign bit unchanged because the sign of
the number remains the same
▪ Negative numbers represent by 2’s complement
41
Cont….
LSB lost
Solution
R= 10011100
▪ arithmetic shift right(ashr R) = 11001110
Since there is no change to sign bit in division, we put the sign bit.
43