Introduction to Computer Organization
After studying this chapter you will understand
The basic structure of computer system.
Conversion of binary number to decimal number.
Organization of the CPU.
Computer Architecture and Computer organization.
Basic of Computer
The hardware of computer is mainly divided into three parts, Central Processing Unit (CPU), Memory and I/O
components shown in figure. The CPU is used to process the data. The memory of the computer is a storage unit.
It stores the instructions and data. It is random access in nature means it can access any location randomly. The
I/O components are physical in nature and use for communicating and controlling the transfer of information to
and from the computer system and outside world. Block diagram of computer system is shown in figure
Central Processing Unit is used to do bulk of data processing
operations. As shown in Figure, the central processing unit is
consisting up of Arithmetic Logic Unit (ALU), Control Unit and
Registers.
The control unit manages and coordinates the operations of all other
components of computer
system. ALU is used to manipulating the data. Registers are the high-
speed memories and is used to
store the temporary results and other operands.
Von Neumann Architecture
The first computer was developed is ENIAC(Electronic Numerical Integrator and Computer). The ENIAC machine
is decimal in nature rather than binary. It uses vacuum tubes as processing elements. The task of entering the
program and then updating it was very tedious in the ENIAC machine. The programming task could become easy
if the program and the concerned data stored in the same memory. Computer could get its instruction by reading
them from the memory and program could be altered by changing the values in the memory portions. This is the
principle that is first reported in Von Neumann Architecture
stored program principle. The instructions are executed sequentially in this architecture. It means that computer
can read instruction or write data in the memory, both cannot be simultaneously performed. Desktop persona;
computer is an example of Von Neumann Architecture.
INPUT UNIT
An input unit performs following tasks:
1. It accepts instructions and data from outside world such as user, CD, DVD etc.
2. The computer can understand only binary data so It converts these instructions and data in computer
understandable form
3. These instruction and data need to be processed then the input device passes the converted
instructions and data to the computer system.
STORAGE UNIT
The storage unit performs following tasks:
1. Storage unit stores the data and instructions read from input device. These instructions are
required for processing the data.
2. It also stores the Intermediate results of processing.
3. The storage units is also required to store the final results of processing and then released to an
output device
There are two types of storage devices
Primary Storage
It is volatile in nature i.e. it loses connect when power goes off.
It is used to store intermediate result of processing and also hold the data.
Since it is made up of semiconductor device, it is fast and very expensive.
Example of primary storage is RAM i.e. Random-Access memory
Secondary Storage
It is used to store the result permanently.
It holds data and information of stored jobs.
It is less expensive than primary memory.
Due to its cheaper cost it used or bulk storage.
It is nonvolatile in nature.
Example of Secondary Storage is Magnetic Tapes, Hard Disks and Flash drives.
CENTRAL PROCESSING UNIT (CPU)
It is the brain of computer System. It controls and coordinates all the activities of the systems. It consists
up of following units.
Arithmetic Logic Unit (ALU)
Arithmetic Logic Unit of a computer system is the place where the actual executions of instructions. It It also
direct the output performed to output device.
OUTPUT UNIT
An output unit of a computer system performs the following functions:
1. It accepts the result of the computation performed by ALU. This result is in binary form.
2. It converts these coded results to human Readable form and show the result to outside world.
Monitors and Printers are the example of output unit.
CPU organization
To understand the organization of CPU, firstly we should understand that how the instruction is
executed in the processor. For executing the instruction, the processor must do:
Fetch instruction
Decode instruction
Execute instruction
During the fetch operation the processor reads an instruction from the memory, then an instruction is
decoded to determine but action should be taken. If the data is present within the instruction, then it is
executed and result is written back into the memory, but if the instruction required operand for execution, then
the operand is first read from the memory address and then required operation is performed
To do these things processor needs:
▪ Registers to store temporary data.
▪ Register to store the address of next instruction to be executed.
▪ Needs to store instruction and data temporarily when the instruction is executing.
▪ Components for performing computational tasks.
▪ Components for controlling overall operations.
▪ System bus for interconnection.
Common types of computer registers include:
Program Counter (PC): Keeps track of the next instruction to be executed. (12bit)
• Instruction Register (IR): Holds the current instruction being executed. (16 bit)
• Accumulator Register (AR).(16 bit)
• Memory Address Register (MAR).
• Memory Buffer Register (MBR).
• Stack Pointer (SP): Points to the top of the stack in memory.
• Status Register (SR): Contains flags indicating the state of the CPU.
• Temporary Register TR(16-bit)
• INPUT/OUTPUT Register (8-bit/8-bit)
• Address Register (16-bit)
• Data register(16-bit)
Basic structure of CPU
Accumulator (AC):
The accumulator register store one of the operands. It interacts with the ALU and after computation
store the output temporarily.
Arithmetic and Logic Unit (ALU):
ALU is the main part of CPU. It performs various arithmetic and logical computations and store result
back in the main memory.
Program Counter (PC):
The PC contains the address of next instruction to fetch from memory.
Memory Address Register (MAR):
The address generated in the PC moved to MAR. So MAR provide the address of memory from
where the instruction is retrieved.
Data Register (DR):
When a memory is address by MAR, then control units request for memory read, the results is placed
on data bus and then into the DR. So we can say the DR contains a word or data to be read from
memory or to written into the memory.
Instruction Register (IR):
It contains the instruction that is most recently fetched. The instruction that is present in DR is loaded
into the IR.
Control Unit (CU):
It controls and coordinates all the activities of the system.
Organization and Architecture
When dealing with the hardware of computer system we must distinguish between computer organization,
computer design and computer architecture.
Computer organization is the study of the operations of hardware components and how these components are
connected together to form a computer. The task of the organizational structure is to check the various
components operate as they intended to do. The organizational attributes include memory technology, control
signals, interface between computer and peripherals.
Computer Design is the hardware design of computer system. Once the specifications of the computer are
formulated, it is the task of designer to develop the hardware for the system. Computer design is concerned with
to find which hardware should be used and how the different parts should be connected.
Computer architecture is concerned with structure and behavior of computer system as per user perspective. It
includes the instruction formats, instruction set, information, I/O mechanism and addressing modes. It also
includes the attributes that have direct impact on execution of program.
What is ALU?
ALU is a digital circuit that provides arithmetic and logic operations. It is the fundamental building block of
the central processing unit of a computer.
The Arithmetic Logic Unit (ALU) is a critical component of the central processing unit (CPU) in a computer. It is
responsible for performing arithmetic and logic operations, which are fundamental to the functioning of any
computer system. The ALU can handle operations such as addition, subtraction, multiplication, division, and
various logical operations like AND, OR, XOR, and NOT.
Key Functions of ALU
1. Arithmetic Operations: The ALU performs basic arithmetic operations such as addition, subtraction,
multiplication, and division. These operations are essential for executing mathematical calculations within
the CPU.
2. Logical Operations: The ALU also handles logical operations, including comparisons and bitwise
operations like AND, OR, XOR, and NOT. These operations are crucial for decision-making processes in
programs.
3. Bit-Shifting Operations: The ALU can perform bit-shifting operations, which involve shifting the positions
of bits in a binary number to the left or right. This is often used in multiplication and division by powers of
two.
ALU Structure and Components
The ALU is typically divided into two main units:
• Arithmetic Unit (AU): This unit is responsible for performing arithmetic operations.
• Logic Unit (LU): This unit handles logical operations2.
The ALU receives input data from the CPU's registers, performs the required operations, and then sends the
results back to the registers or memory1. The control unit of the CPU directs the ALU on which operations to
perform based on the instructions it receives1.
ALU Configurations
Different processors may have varying ALU configurations, depending on their design and intended use. Some
common configurations include:
• Single ALU: Some processors have a single ALU that handles all arithmetic and logic operations.
• Multiple ALUs: More advanced processors may have multiple ALUs to perform parallel operations,
increasing the processing speed2.
BUS
Types of the bus
There are mainly three type of bus:-
1. Address bus: Transfers memory addresses from the processor to components like storage and
input/output devices. It's one-way communication.
2. Data bus: carries the data between the processor and other components. The data bus is bidirectional.
3. Control bus: carries control signals from the processor to other components. The control bus also carries
the clock's pulses. The control bus is unidirectional.
The bus can be dedicated, i.e., it can be used for a single purpose or it can be multiplexed, i.e., it can be used for
multiple purposes. when we would have different kinds of buses, different types of bus organizations will take
place.
Registers
Registers are very fast computer memory which is used to execute programs and operations efficiently. but In
that scenario, registers serve as gates, sending signals to various components to carry out little tasks. Register
signals are directed by the control unit, which also operates the registers.
The following list of five registers for in-out signal data storage:
1. Program Counter
A program counter (PC) is a CPU register in the computer processor which has the address of the next
instruction to be executed from memory. As each instruction gets fetched, the program counter
increases its stored value by 1. It is a digital counter needed for faster execution of tasks as well as for
tracking the current execution point.
2. Instruction Register
In computing, an instruction register (IR) is the part of a CPU's control unit that holds the instruction
currently being executed or decoded. The instruction register specifically holds the instruction and
provides it to the instruction decoder circuit.
3. Memory Address Register
The Memory Address Register (MAR) is the CPU register that either stores the memory address from
which data will be fetched from the CPU, or the address to which data will be sent and stored. It is a
temporary storage component in the CPU (central processing unit) that temporarily stores the address
(location) of the data sent by the memory unit until the instruction for the particular data is executed.
4. Memory Data Register
The memory data register (MDR) is the register in a computer's processor, or central processing unit,
CPU, that stores the data being transferred to and from the immediate access storage. Memory data
register (MDR) is also known as memory buffer register (MBR).
5. General Purpose Register
General-purpose registers are used to store temporary data within the microprocessor. It is a
multipurpose register. They can be used either by a programmer or by a user.
What is Data Path?
Suppose that the CPU needs to carry out any data processing action, such as copying data from memory to a
register and vice versa, moving register content from one register to another, or adding two numbers in the ALU.
Therefore, whenever a data processing action takes place in the CPU, the data involved for that operation follows
a particular path, or data path.
One Bus Organization
In one bus organization, a single bus is used for multiple purposes. A set of general-purpose registers, program
counters, instruction registers, memory address registers (MAR), memory data registers (MDR) are connected
with the single bus. Memory read/write can be done with MAR and MDR. The program counterpoints to the
memory location from where the next instruction is to be fetched. Instruction register is that very register will
hold the copy of the current instruction. In the case of one bus organization, at a time only one operand can be
read from the bus.
As a result, if the requirement is to read two operands for the operation then the read operation needs to be
carried twice. So that's why it is making the process a little longer. One of the advantages of one bus
organization is that it is one of the simplest and also this is very cheap to implement. At the same time a
disadvantage lies that it has only one bus and this "one bus" is accessed by all general-purpose registers,
program counter, instruction register, MAR, MDR making each and every operation sequential. No one
recommends this architecture nowadays.
Two Bus Organization
To overcome the disadvantage of one bus organization another architecture was developed known as two bus
organization. In two bus organizations, there are two buses. The general-purpose register can read/write from
both the buses. In this case, two operands can be fetched at the same time because of the two buses. One bus
fetch operand for ALU and another bus fetch for register. The situation arises when both buses are busy fetching
operands, the output can be stored in a temporary register and when the buses are free, the particular output
can be dumped on the buses.
There are two versions of two bus organizations, i.e., in-bus and out-bus. From in-bus, the general-purpose
register can read data and to the out bus, the general-purpose registers can write data. Here buses get
dedicated.
Three Bus Organization
In three bus organizations we have three buses, OUT bus1, OUT bus2, and an IN bus. From the out buses, we can
get the operand which can come from the general-purpose register and evaluated in ALU and the output is
dropped on In Bus so it can be sent to respective registers. This implementation is a bit complex but faster in
nature because in parallel two operands can flow into ALU and out of ALU. It was developed to overcome the
busy waiting problem of two bus organizations. In this structure after execution, the output can be dropped on
the bus without waiting because of the presence of an extra bus. The structure is given below in the figure.
Control Unit and its Design
A Central Processing Unit is the most important component of a computer system. A control unit is a part of the
CPU. A control unit controls the operations of all parts of the computer but it does not carry out any data
processing operations.
What is a Control Unit?
The Control Unit is the part of the computer's central processing unit (CPU), which directs the operation of the
processor. It was included as part of the Von Neumann Architecture by John von Neumann. It is the responsibility
of the control unit to tell the computer's memory, arithmetic/logic unit, and input and output devices how to
respond to the instructions that have been sent to the processor.
The functions that a control unit performs are dependent on the type of CPU because the architecture of the CPU
varies from manufacturer to manufacturer.
Examples of devices that require a CU are:
• Control Processing Units(CPUs)
• Graphics
•
• Processing Units(GPUs)
Functions of the Control Unit
• It coordinates the sequence of data movements into, out of, and between a processor's many sub-units.
• It interprets instructions.
• It controls data flow inside the processor.
• It receives external instructions or commands to which it converts to sequence of control signals.
• It controls many execution units (i.e. ALU, data buffers and registers) contained within a CPU.
• It also handles multiple tasks, such as fetching, decoding, execution handling and storing results.
The control unit of a CPU fetches and executes instructions, playing a critical role in system performance. Its
design ensures smooth operation of various components.
Types of Control Unit
There are two types of control units:
• Hardwired
• Micro programmable control unit.
Hardwired Control Unit
In the Hardwired control unit, the control signals that are important for instruction execution control are
generated by specially designed hardware logical circuits, in which we cannot modify the signal generation
method without physical change of the circuit structure
Micro Programmable control unit
The fundamental difference between these unit structures and the structure of the hardwired control unit is the
existence of the control store that is used for storing words containing encoded control signals mandatory for
instruction execution.
What is Program Control Instructions?
Program Control Instructions are the machine code instructions which are used to control the flow of execution
of instructions in the processor domain. These are important in instilling on the processor how to execute a certain
task, access different programs and control the decision making on the basis of some conditions. They are
commonly used in assembly language and generated by high level language which is compiled into machine code
form to enable the processor act in the desired manner.
Types of Program Control Instructions
In microprocessor and Microcontroller, program control instructions guide how a computer executes a program
by allowing changes in the normal flow of operations. These instructions help in making decisions, repeating tasks,
or stopping the program.
What is Program Control Instructions?
Program Control Instructions are the machine code instructions which are used to control the flow of execution
of instructions in the processor domain. These are important in instilling on the processor how to execute a certain
task, access different programs and control the decision making on the basis of some conditions. They are
commonly used in assembly language and generated by high level language which is compiled into machine code
form to enable the processor act in the desired manner.
Types of Program Control Instructions
1. Compare Instruction
Compare instruction is specifically provided, which is similar to a subtract instruction except the result is not
stored anywhere, but flags are set according to the result.
Example: CMP R1, R2;
2. Unconditional Branch Instruction
It causes an unconditional change of execution sequence to a new location.
Example: JUMP L2 Mov R3, R1 goto L2
3. Conditional Branch Instruction
A conditional branch instruction is used to examine the values stored in the condition code register to determine
whether the specific condition exists and to branch if it does.
Example: Assembly Code : BE R1, R2, L1 Compiler allocates R1 for x and R2 for y High Level Code: if (x==y) goto
L1;
4. Subroutines
A subroutine is a program fragment that lives in user space, performs a well-defined task. It is invoked by another
user program and returns control to the calling program when finished.
Example: CALL and RET
5. Halting Instructions
• NOP Instruction - NOP is no operation. It causes no change in the processor state other than an
advancement of the program counter. It can be used to synchronize timing.
• HALT - It brings the processor to an orderly halt, remaining in an idle state until restarted by interrupt,
trace, reset or external action.
6. Interrupt Instructions
Interrupt is a mechanism by which an I/O or an instruction can suspend the normal execution of processor and
get itself serviced.
• RESET - It reset the processor. This may include any or all setting registers to an initial value or setting
program counter to standard starting location.
• TRAP - It is non-maskable edge and level triggered interrupt. TRAP has the highest priority and vectored
interrupt.
• INTR - It is level triggered and maskable interrupt. It has the lowest priority. It can be disabled by resetting
the processor.
Advantages of Program Control Instructions
• Efficient Control Flow: Program Control Instructions provide the processor with the means to decide the
order of instructions. This means that branching can be efficiently made which is important for
complicated mathematics as well as algorithms.
• Conditional Execution: With conditional instruction, code can be executed whenever a specific condition
is met thereby improving the usability of programs in dealing with different situations.
• Modular Code: Modular are especially subroutines where separate code can be carried, simplifying its
usage as most calls basically involve performing standard functionalities as and when required.
• Synchronization: Instructions such as NOP and HALT helps in the militia of processes as well for any
inoperable phase Of the system thereby protects it from unnecessary algorithm.
• Interrupt Handling: Interrupt strategies give real time competencies since they give the processor the
ability to attend to peripheral devices and other kinds of processes promptly.
• Efficient Resource Management: These instructions encumber improvement in resource management
over system operations by stopping, resuming or terminating them when high performance is needed by
the CPU.
Disadvantages of Program Control Instructions
• Complexity: In cases of program control instructions, mainly regarding assembly language, it can be
complicated to write and understand such instructions as they require thorough understanding of the way
a processor is designed.
• Performance Overhead: The use of conditional controls and subroutine calls has its drawbacks where
branching and moving back to previous statuses especially when they contain nested calls or excessive
use can be performance hindrances.
• Risk of Errors: Identifying errors such as the program branching where it is not supposed to or the abuse
of interrupts can lead to errors such as program hanging where the program goes into loops and does not
progress any further rendering fixing it virtually impossible.
• Dependency on Processor Architecture: These types of instructions are very particular with the processor
architecture to an extent that such type of software cannot be run on a different hardware platform.
• Interrupt Latency: This is on handling interrupts has some downsides particularly latency if there is a need
to handle several interrupts of different priorities.
• Overhead with Subroutines: There is little doubt that the use of subroutine physically changes the way
the code is organized and though it saves time concerning the code, too many transitions between the
code and the subroutine/main program usually wastes time within the detractors of the stack
management.