You are on page 1of 16

COMPUTER ORGANIZATION

COURSE: CYBER SECURITY

1
Recap of Last Lesson

Computer Architecture and Von Neumann Architecture

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:

1. Memory Address Register (MAR):


This register holds the address of memory where CPU wants to read or write data. When CPU wants to store some data in
the memory or reads the data from the memory, it places the address of the required memory location in the MAR.

2. Memory Data Register (MDR):


This register holds the contents of data or instruction read from, or written in memory. The contents of instruction placed
in this register are transferred to the Instruction Register, while the contents of data are transferred to the accumulator or
I/O register.
In other words you can say that this register is used to store data/instruction coming from the memory or going to the
memory.

3. I/O Address Register (I/O AR):


I/O Address register is used to specify the address of a particular I/O device.

4. I/O Data Register (I/O DR):


I/O Buffer Register is used for exchanging data between the I/O module and the processor.

5. Program Counter (PC)


Program Counter register is also known as Instruction Pointer Register. This register is used to store the address of the
next instruction to be fetched for execution. When the instruction is fetched, the value of IP is incremented. Thus this
register always points or holds the address of next instruction to be fetched.

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.

8. Stack Control Register:


A stack represents a set of memory blocks; the data is stored in and retrieved from these blocks in an order, i.e. First In and
Last Out (FILO). The Stack Control Register is used to manage the stacks in memory. The size of this register is 2 or 4
bytes.

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

Question – What is the purpose of general


purpose registers?

5
How Instructions are Processed in CPU

Fetch/Decode /Execute
Cycle

6
CHAPTER II

ALU organization
3.1 OBJECTIVES

After going through this unit, you will be able to:

• describe the basic organization of ALU;

• discuss the requirements of a floating point ALU;

• define the term arithmetic coprocessor; and

• create simple arithmetic logic circuits.


Binary Representation

• 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

• Above is un-signed numbering

• Binary addition

9
Binary Signed Numbers
• Assumption – You are already aware of binary number system

• Above is un-signed numbering


• We need to represent both positive and negative numbers. Three systems are used
for representing such numbers:
– Sign-and-magnitude
– 1’s-complement : Done using complementing each bit of integer part for negative numbers
– 2’s-complement : Done by adding 1 to the least significant bit of 1’s complement for
negative numbers.
• Has 2 parts –Sign part and Integer part.
• In sign part usually 0 is used for positive (+) and 1 is used to represent negative (-)
• Question 1 – Represent +9 and -9 using the above three methods in 7-bit notation.

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

• Expanding single bit ALU to build a 32-bit ALU



15
THANK YOU

16

You might also like