Professional Documents
Culture Documents
1
Recap of Last Lesson
https://www.youtube.com/watch?v=-SADbPS8UgA
2
Special Purpose Registers in
the CPU-Page1
Most important components of CPU. Each register performs a specific function. A brief description of most important
CPU's registers and their functions are given below:
3
Special Purpose Registers in
the CPU –Page2
6. Instruction Register (IR): or Current Instruction Register
Once an instruction is fetched from main memory, it is stored in the Instruction Register. The control unit takes instruction
from this register, decodes and executes it by sending signals to the appropriate component of computer to carry out the
task.
7. Accumulator Register:
The accumulator register is located inside the ALU, It is used during arithmetic & logical operations of ALU. The control
unit stores data values fetched from main memory in the accumulator for arithmetic or logical operation. This register
holds the initial data to be operated upon, the intermediate results, and the final result of operation. The final result is
transferred to main memory through MDR.
9. Flag Register:
The Flag register is used to indicate occurrence of a certain condition during an operation of the CPU. It is a special
purpose register with size one byte or two bytes. Each bit of the flag register constitutes a flag (or alarm), such that the bit
value indicates if a specified condition was encountered while executing an instruction.
4
Closer look at Processor Architecture
5
How Instructions are Processed in CPU
Fetch/Decode /Execute
Cycle
6
CHAPTER II
ALU organization
3.1 OBJECTIVES
• Binary numbers
• Binary addition, subtraction, multiplication
and division
• Sign number representation
• Floating point arithmetic
8
Binary Numbers
• Need to check your awareness of binary number system
• Binary addition
9
Binary Signed Numbers
• Assumption – You are already aware of binary number system
10
Fill the table below
Signed Binary String Sign & Magnitude 1’s Complement 2’s Complement
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
11
Check your answers..
Signed Binary String Sign & Magnitude 1’s Complement 2’s Complement
0000 +0 +0 +0
0001 +1 +1 +1
0010 +2 +2 +2
0011 +3 +3 +3
0100 +4 +4 +4
0101 +5 +5 +5
0110 +6 +6 +6
0111 +7 +7 +7
1000 -0 -7 -8
1001 -1 -6 -7
1010 -2 -5 -6
1011 -3 -4 -5
1100 -4 -3 -4
1101 -5 -2 -3
1110 -6 -1 -2
1111 -7 -0 -1
12
Observations ..
Signed Binary String Sign & 1’s Complement 2’s Complement
Magnitude • Two representations for 0 in first
0000 +0 +0 +0
two methods but its not the case in
0001 +1 +1 +1
2’s complement
0010 +2 +2 +2
0011 +3 +3 +3
• In 2’s complement you can
0100 +4 +4 +4 represent -8 (with 4 bits) but other
0101 +5 +5 +5 methods cannot do that.
0110 +6 +6 +6 • Mathematical operations such as
0111 +7 +7 +7 addition in Sign & Magnitude and
1000 -0 -7 -8 also 1’s complement notations
1001 -1 -6 -7 will result in wrong answers. Eg
1010 -2 -5 -6
Add +7 and -7 and see whether
1011 -3 -4 -5
you get the answer as zero.
1100 -4 -3 -4
1101 -5 -2 -3
• In 2’s complement, see if you can
1110 -6 -1 -2 assign a common place value for
1111 -7 -0 -1 negative numbers?
• Perform binary operations (add
and subtract) using 2’s
complement and get the correct
answers.
13
•3.2 ALU organization
ALU Organisation
•It is discussed earlier, an ALU performs simple arithmetic-logic and shift operations. ‘
•The complexity of an ALU depends on the type of instruction set which has been
realized for it.
•The simple ALUs can be constructed for fixed-point numbers.
•On the other hand the floating-point arithmetic implementation requires more
complex control logic and data processing capabilities, i.e., the hardware. Several
micro- processor families utilize only fixed-point arithmetic capabilities in the ALUs.
•For floating point arithmetic or other complex functions they may utilize an auxiliary
special purpose unit. This unit is called arithmetic co-processor.
14
ALU Design
• Implementing One bit ALU which does
following operations
– AND, OR, Add, Subtract,
– NAND and NOR
16