Computer Architecture and Organisation Notes

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Introduction to computer Architecture and organisation:

Computer Architecture is concerned with the way hardware components are connected together
to form a computer system. Computer Organization is concerned with the behavior of a
computer system. Computer architecture explains what a computer should do. Computer
organization explains how a computer works. Computer architecture deals with high level
design. Computer organization deals with low level design. Computer architecture is designed
first. Computer organization is started after finalizing computer architecture. Computer
Architecture is programmer view. Computer organisation is transparent from programmer.

Unit-I
Basic Structure of computers

A computer can be define as the fast electronic machine that accept the data (digital input
information) process it as per the list of internally stored instruction and process the resulting
information. Set of instruction return to achieve task is called a program and internal storage is
called as computer memory.
Different Types of computer
Personal computer
Note book computer/ Laptops
Work station
Enterprise System (Servers)
Servers
Super computer

Basic structure of computer H/W and S/W:


Hardware and software are essential parts of a computer system. Hardware components are the
physical parts of a computer, like the central processing unit (CPU), mouse, storage, and more.
Software components are the set of instructions that we store and run on our hardware.
Functional Unit:

A computer consists of functionally independent units:


a. Input
b. Output
c. Memory
d. CPU
i. ALU
ii. CU
Input Unit:
The input to the computer is either a data or instruction that guides the arithmetic and logic unit
about what operations have to be performed and also controls the movement of data between the
computer and its I/O devices.
Now, the input i.e. data or instruction are accepted with the help of input units such as a
keyboard, mouse, touchpad, joystick, and trackball.

Memory Unit:
A memory unit is required to store the programs that have the set of instructions that instructs
Arithmetic and logic unit which operation has to be performed. It also stores the data associated
with the program. The memory can further be classified into three types:

Primary Memory:
Primary memory is also known as the main memory or the random-access memory (RAM). It is
the fastest accessible memory of the computer. If a program has to be executed it first needs to
be placed in the primary memory. Then the instructions of the program are fetched one at a time
by the processor for execution.
Secondary Memory:
Secondary memory is the hard disk of your system, it also includes flash drive, optical disks,
magnetic disk. The secondary memory is slower and less expensive as compared to primary
memory. It doesn’t lose its contents even if the supply of power gets off. We require secondary
memory to store a large volume of data or program permanently or the data that is less likely to
be retrieved.

Arithmetic Logic Unit:


All the arithmetic operations are performed by the arithmetic logic unit of the processors.
Arithmetic operations such as addition, subtraction, division, multiplication, comparison
between the numbers, etc.

The ALU unit performs the operations present in the instruction and stores the result into the
memory.

Control Unit:

The functions of input, ALU, memory, and output unit must be coordinated so that everything
goes in sequence i.e. the processor accepts input, place it in memory, processes the stored input,
and generates output. This entire sequence is coordinate by the control unit.

What is Bus?
Bus is a group of wires (or lines) that connects several devices with in a computer system. Bus is
a communication system that transfers data between components inside a computer, or between
computers. The Computer bus helps the various parts of the PC communicate. If there was no
bus, you would have an unwieldy number of wires connecting every part to every other part.
Types of Computer Bus

There are a variety of buses found inside the computer.


iii. Address Bus:-
e. It is unidirectional
f. It is a group of wires which carries address information bits from processor to
peripherals.
g. The address bus carries information about the location of data in memory.
h. Address bus width determines the maximum memory capacity.
i. If address bus has 16 bits so that saying that have 2 16 memory location is available in
memory.
j. For example: if address line=3 bits 2 3=8 i.e. 3 address line is required to select 8
location.
k. In general 2x =n where X is number of address lines, n is number of location.
b. Data Bus:-
• It is bidirectional.

• Group of wire which carry data information bit from processor to peripherals and vice
versa.
• Data bus width determines the system performance (word length/ computer).
• The first standard for data bus was 32-bit, whereas newer 64-bit systems can handle
much greater amounts of data.

c. Control Bus:-
• Control bus are bidirectional that goes from peripheral to CPU and CPU to peripheral.
• Control the access to and the use of address lines and data lines.
• Control signals like memory read/write, I/O read & write etc.

Types of Bus Structure


Single Bus Structure: -

• Common bus used to communication between peripheral and microprocessor. Single bus
does one transfer at a time, so only two units can actively use the bus at a given time. Bus
control lines are used to arbitrate multiple requests for use of one bus.

Advantages of Single Bus System


l. It has low initial cost.
m. It requires less maintenance.
n. It is simple in operation.

Disadvantages of Single Bus System


• One of the disadvantages of single bus system, if there is any fault occur, all system
affected and the other feeders pass over.
• This system supply low flexibility and immunity.

Multi-bus structure:
System that contains multiple buses achieve more parallelism. This leads to better performance
but an increase cost.
Multi-bus structure improves the performance but also increase cost significantly. In multi-bus
structure each of which connects subset of products.

E.g. In two bus structure one bus can, be used to fetch instruction other can be used to fetch data
required for execution.
Advantages of Multi-bus System
• Better performance
• Improves Efficiency
Disadvantages of Multi-bus System
• More costly

Basic Operational Concept:


To perform a given task an appropriate program consisting of a list of instructions is stored in the
memory. Individual instruction can be brought from memory into processor which execute the
specified operations. Data to be used as operands are also store into memory.

ADD LOC A, R0
This instruction adds the operand at memory location LOC A to the operand in a register R0 and
place the sum in to register R0. The original content of LOC A is preserved, where as those of
R0 are overwritten. This instruction requires to perform several steps, first the instruction fetch
from the memory into processor. Next, the operand at LOC A is fetch and added to the contents
of R0. Finally, the resulting sum is store in R0. In computer this two types of operations are
perform
Load LOC A, R1
Add R1, R0
First instruction transfers the content of memory location LOC A into register R1 and the second
instruction add the content of registers R1 and R0 and place the sum into R0.
Transfers between the memory and the processor are stared by sending the address of memory
location to be accessed to the memory unit and issuing the appropriate control signals. Fig.
shows the how the memory and processor can be connected. It also shows the few operational
details of the processor.
The ALU, Control unit and the processor contains a number of registers used for several
different purposes. Instruction Register (IR) holds the instruction that is currently being executed

o Memory Address Register(MAR)


o Memory Data Register(MDR)
Instruction Register (IR):
 It holds the instruction that is currently being executed.
 
It generate the timing signals

Program Counter (PC):

It contains the memory address of the next instruction to be fetched for execution.

Memory Address Register (MAR):


It holds the address of the location to be accessed.
Memory Data Register (MDR):
It contains the data to written into or read out of the address location.
MAR and MDR facilitates the communication with memory.
Operation Steps:

The program resides in memory. The execution starts when PC is point to the first

instruction of the program. The program resides in memory. The execution starts  when
PC is point to the first instruction of the program. MAR read the control signal

The Memory loads the address word into MDR. The contents are  transferred to
Instruction register. The instruction is ready to be decoded & executed.

Normal execution of the program may be pre-empted if some device requires


urgent servicing.
Eg...Monitoring Device in a computer controlled industrial process may detect
a dangerous condition.
In order to deal with the situation immediately, the normal execution of the
current program may be interrupted & the device raises an interrupt signal.
The processor provides the requested service called the Interrupt Service
Routine (ISR).

ISR save the internal state of the processor in memory before servicing the
interrupt because interrupt may alter the state of the processor.
When ISR is completed, the state of the processor is restored and the interrupted
program may continue its execution.



The Memory loads the address word into MDR. The contents are  transferred to
Instruction register. The instruction is ready to be decoded & executed.
Normal execution of the program may be pre-empted if some device requires
urgent servicing.
Eg...Monitoring Device in a computer controlled industrial process may detect
a dangerous condition.
In order to deal with the situation immediately, the normal execution of the
current program may be interrupted & the device raises an interrupt signal.
The processor provides the requested service called the Interrupt Service
Routine (ISR).

ISR save the internal state of the processor in memory before servicing the
interrupt because interrupt may alter the state of the processor.
When ISR is completed, the state of the processor is restored and the interrupted
program may continue its execution.

Number Systems
• Binary number system (Base 2)
• Octal number system (Base 8)
• Decimal number system (Base 10)
• Hexadecimal number system (Base 16)
Converting from one number system to another

A) Converting to decimal (base 10)


 Decimal to decimal
(123)10 = 3x100 + 2x101 + 1x102 =3 +20 +100 = 123

 Binary (base 2) to decimal (base 10)


(1011)2 = 1x20 + 1x21 + 0x22 + 1x23 = 1+2+0+8 = 11

Memory Locations, addressing and encoding of information:


When a program should be executed that load into main memory and the processor will fetch the
content of the memory, so our information is stored in memory. Memory location is nothing but
the place where the information gets loaded into memory.
Memory Address in the sense there will be an address to locate that load information
from the memory. Memory consists of many millions of storage cells each of which can store
1bit (binary digit) then each storage cell has the probability to store 1 bit of information so bit in
the sense binary digit, so memory is made of millions of storage cell where each cell is not
sufficient in the real world, 1 bit in the sense either 1 or 0. So we need the collection of n bits to
represents some data.
Data is usually accessed in n bit groups. N is called word length.
 If word length is 16 (2byte) aligned words begin at byte address 0,2,4…….
 If word length is 64(8byte) aligned words begin at byte address 0,8,16…..

Words are said to have unaligned address, if they begin at an arbitrary byte address

Encoded information in word

Example of encoded information in a 32 bit word

32 bit word length example

Memory Address:
To retrieve information from memory either for one word or one byte (8bit),
addresses for each location are needed.
 If length of the memory address is k bits then there are 2 k memory
address

 This is called an address space of a computer

 Addresses range from 0 to 2k -1

210 = 1024 = 1K (Kilobyte)


220 = 1,048,576 = 1M (Megabyte)
230 = 1073741824 = 1G (Gigabyte)
240 = 1.0995116e+12 = 1T (Terabyte)
Byte Addressing:
We have three basic information quantities to deal with bit byte word. To which
unit individual address are to be assigned? Most practical assignment is to assign
successive addresses to successive byte in memory. This is called byte addressable

Big Endian and little-Endian Assignment


In the big-endian assignment, the lower byte addresses are used for the leftmost bytes of the
word. Observe the word 0 in the image below, the leftmost bytes of the word have lower byte
addresses.

In the little-endian assignment, the lower byte addresses are used for the rightmost bytes of the
word. Observe the word 0 in the image below the rightmost bytes of word 0 has lower byte
addresses.

SOFTWARE
• Software is a set of instructions, data or programs used to operate computers and
execute specific tasks. System Software is a collection of programs that are executed
as needed to perform function such as,
• Receiving & Interpreting user commands.
• Entering & editing application program and storing them as files in secondary Storage
devices.
• Managing the storage and retrieval of files in Secondary Storage devices.
• Running the standard application such as word processor, games, and Spreadsheets
with data supplied by the user.
• Controlling I/O units to receive input information and produce output results.
• Translating programs from source form prepared by the user into object form.
• Linking and running user-written application programs with existing standard Library
routines.

Software is of 2 types
 Application program
 System program
Application Program:
It is written in high level programming language(C, C++, Java, and FORTRAN). The
programmer using high level language need not know the details of machine program
instruction.
System Program: (Compiler, Text Editor, File)
Compiler:
It translates the high-level language program into the machine language program.
Text Editor:
It is used for entering & editing the application program. System software Component -> OS
(OPERATING SYSTEM)
Operating System:
It is a large program or a collection of routines that is used to control the sharing of and
interaction among various computer units.
Functions of OS:
Assign resources to individual application program.
Assign memory and magnetic disk space to program and data files.
Move the data between the memory and disk units.
Handles I/O operation.

INSTRUCTION AND INSTRUCTION SEQUENCING


A computer must have instruction capable of performing the following operations. They
are,
 Data transfer between memory and processor register.
 Arithmetic and logical operations on data.
 Program sequencing and control.
 I/O transfer

Register Transfer Notation:

The transfer of information from one location to another, possible locations that may be
involved in such transfers are memory locations, registers in the I/O subsystem. We
identify a location by a symbolic name.

Location Hardware Binary Eg. Description


Address
 The contents of
R1 [LOC]
memory
location are
transferred to.
the processor
Memory LOC,A,VAR2 register
Processor R0,R1,….  Add the
[R3] [R1]+[R2]
contents of
register R1 &R2
and places .their
sum into
register R3.It is
called Register
Transfer
Notation
DATAIN,DATAOUT Provides Status
I/O Registers information

Assembly Language Notation:

Assembly Language Description


Format
Move LOC,R1 Transfers the contents of memory location to the processor
register R1.

Add R1,R2,R3 Add the contents of register R1 & R2 and places their sum
into register R3.

Type of Instruction

Type is depend on the no. of operands means how many no. of operands we are using.
Three Address

Too large to fit in a word for a reasonable word length machine


Syntax: Operation source1, source2, destination
Eg:
1. Add A,B,C
Add values of variable A ,B & place the result into c.
2. Add R0, R1, R2
Add values of register R0,R1 & place the result into R2

Two address instructions:-


Systax:
Operation Source, Destination
Eg. 1. Add A,B
Add the values of A,B & place the result into B.
Mov A,R1
Mov R1,C
One Address:-
One special CPU register is used called accumulator (ACC) as an implicit operand
Syntax: Operation Source/Destination
Eg:
Add B
Content of accumulator add with content of B.

Zero Address Instructions :-


• Machine storing operands in a structure called push down Stack
• Operands are specified w. r. t. SP (Stack pointer)
• E.g. ADD will add two top most items on the stack

Instruction Execution and Straight–line Sequencing:


Instruction Execution:
There are 2 phases for Instruction Execution. They are
 
Instruction Fetch
 
Instruction Execution
 
Instruction Fetch:
The instruction is fetched from the memory location whose address is in PC. This
 
is placed in IR.
Instruction Execution:
Instruction in IR is examined to determine whose operation is to be performed
Program execution Steps:

To begin executing a program, the address of first instruction must be placed


in PC.
The processor control circuits use the information in the PC to fetch &
execute instructions one at a time in the order of increasing order.
This is called Straight line sequencing. During the execution of each instruction,
the PC is incremented by 4 to point the address of next instruction.

Fig: Program Execution

Branching:

The Address of the memory locations containing the n numbers are symbolically
given as NUM1,NUM2…..NUMn.
Separate Add instruction is used to add each number to the contents of
register R0.
After all the numbers have been added,the result is placed in memory location
SUM.

Fig:Straight Line Sequencing Program for adding ‘n’ numbers


Using loop to add ‘n’ numbers:

Number of enteries in the list „n‟ is stored in memory location M.Register R1


is used as a counter to determine the number of times the loop is executed.
Content location M are loaded into register R1 at the beginning of the program.
It starts at location Loop and ends at the instruction.Branch>0.During each
pass,the address of the next list entry is determined and the entry is fetched and
added to R0.

Decrement R1
It reduces the contents of R1 by 1 each time through the loop.

Branch >0 Loop

A conditional branch instruction causes a branch only if a specified condition is


satisfied.

Fig:Using loop to add ‘n’ numbers:

Conditional Codes:

Result of various operation for user by subsequent conditional branch instruction


is accomplished by recording the required information in individual bits often called
Condition code Flags.

Commonly used flags:


N(Negative) set to 1 if the result is –ve ,otherwise cleared to 0.
Z(Zero) set to 1 if the result is 0 ,otherwise cleared to 0.
V(Overflow) set to 1 if arithmetic overflow occurs ,otherwise cleared to 0.
C(Carry)set to 1 if carry and results from the operation ,otherwise cleared to 0.

You might also like