Unit 1- Introduction to Computer Architecture
Unit 1- Introduction to Computer Architecture
COMPUTER ARCHITECTURE
Unit – I
Shruthi S V
What is Computer?
A computer is a device that can be instructed to carry out sequences of
arithmetic or logical operations automatically.
Modern computers have the ability to follow generalized sets of operations,
called programs. These programs enable computers to perform an extremely
wide range of tasks.
What is Data?
Data in a computer terminology mean raw facts and figures.
For ex:-mohan,1977etc.
What is Information?
means what we get after processing.
NOTEBOOK COMPUTER
• Compact form of personal computer (laptop)
• Advantage is portability
WORK STATIONS
•More computational power than PC
•Costlier
•Used to solve complex problems which arises in engineering application
(graphics, CAD/CAM etc.)
SUPER COMPUTERS
•Faster than mainframes.
•Helps in calculating large scale numerical and algorithm calculation in short span of
time.
•Used for aircraft design and testing, military application and weather forecasting.
HANDHELD
• Also called a PDA (Personal Digital Assistant).
• A computer that fits into a pocket, runs on batteries, and
is used while holding the unit in your hand.
• Typically used as an appointment book, address book,
calculator, and notepad.
• Can be synchronized with a personal microcomputer as
a backup.
Basic Terminology
• Computer • Software
A device that accepts input, processes data, A computer program that tells the computer
stores data, and produces output, all according to how to perform particular tasks.
a series of stored instructions.
• Network
• Hardware Two or more computers and other devices that
Includes the electronic and mechanical devices are connected, for the purpose of sharing data
that process the data; refers to the computer and programs.
• Peripheral devices
Used to expand the computer’s input, output
and storage capabilities.
Basic Terminology
• Input
Whatever is put into a computer system.
• Data
Refers to the symbols that represent facts, objects, or ideas.
• Information
The results of the computer storing data as bits and bytes; the words, numbers, sounds, and graphics.
• Output
Consists of the processing results produced by a computer.
• Processing
Manipulation of the data in many ways.
• Memory
Area of the computer that temporarily holds data waiting to be processed, stored, or output.
• Storage
Area of the computer that holds data on a permanent basis when it is not immediately needed for processing.
•Assembly language program (ALP) - Programs are written using mnemonics
•HLL (High Level Language) - Programs are written using English like statements
•Compiler - Convert HLL to MLL, does this job by reading source program at once
•Interpreter – Converts HLL to MLL
•System software – Program routines which aid the user in the execution of
programs
e.g. Assemblers, Compilers
Calvin College
FUNCTIONAL UNITS OF COMPUTER
• Input Unit
• Output Unit
• Memory
• Bus Structure
FUNCTIONAL UNITS
Arithmetic
Input and
logic
Memory
Output Control
I/O Processor
• NOTHING ELSE!
INPUT UNIT:
•Converts the external world data to a binary format, which can be understood by CPU
OUTPUT UNIT:
•Converts the binary format data to a format that a common man can understand
•CU Provides control signals in accordance with some timings which in turn controls
the execution process
T1 Enable R1
T2 Enable R2
T4
•Control unit works with
a reference signal called
T1 processor clock
R1 R2
R2
MEMORY
Memory is one of the most important components of a computer system as it
stores data and instructions.
Every memory chip contains thousands of memory locations. In the computer, the
data is stored in the form of bits and bytes.
A bit is the smallest storage unit of memory. A nibble is a collection of 4 bits. Eight
bits combined together to form a single byte, which in turn represents a single
character.
Memory Units
Types of Memories
The computer memories can be divided into following categories:
Primary Memory
Cache Memory
Secondary memory
Primary Memory
Broadly primary memory
can be of two types :–
1. RAM (Random Access
Memory)
2. ROM (Read only memory).
Random Access Memory (RAM)
The memory can be accessed from any desired location
randomly.
The instructions and data that we input into the computer are
stored in
the RAM of the Computer.
Example:
Add LOCA, R0
•This instruction adds the operand at memory location LOCA to the operand which will be present in
the Register R0.
• The above mentioned example can be written as follows:
Load LOCA, R1
Add R1, R0
•First instruction sends the contents of the memory location LOCA into processor
Register R0, and meanwhile the second instruction adds the contents of Register R1
and R0 and places the output in the Register R1.
•The memory and the processor are swapped and are started by sending the
address of the memory location to be accessed to the memory unit and issuing the
appropriate control signals.
• In order to get the best performance it is required to design the compiler, machine
instruction set & hardware in a coordinated manner.
CONNECTION B / W PROCESSOR & MEMORY
The above mentioned block diagram consists of the following components
1) Memory
2) MAR
3) MDR
4) PC
5) IR
6) General Purpose Registers
7) Control Unit
8) ALU
•The instruction that is currently being executed is held by the Instruction Register.
•IR output is available to the control circuits, which generates the timing signal that
control the various processing elements involved in executing the instruction.
•The Memory address of the next instruction to be fetched and executed is contained
by the Program Counter.
•It is a specialized register.
•It keeps the record of the programs that are executed.
•Role of these registers is to handle the data available in the instructions. They store
the data temporarily.
•Two registers facilitate the communication with memory.
These registers are:
1) MAR (Memory Address Register)
2) MDR (Memory Data Register)
Working Explanation
A PC is set to point to the first instruction of the program. The contents of the PC are transferred to
the MAR and a Read control signal is sent to the memory. The addressed word is fetched from the
location which is mentioned in the MAR and loaded into MDR.
BUS STRUCTURES
• Group of lines that serve as connecting path for several devices is called a bus
(one bit per line). Individual parts must communicate over a communication line
or path for exchanging data, address and control information as shown in the
diagram below.
Bus Types:
• Dedicated – Separate data, address and control lines
• Multiplexed – Shared lines
Dedicated
1. Data bus: It carries the data from one system module to other. Data bus may consist of 32,64, 128 or
even more numbers of separate lines. This number of lines decides the width of the data bus. Each line
can carry one bit at a time. So, a data bus with 32 lines can carry 32bit of data at a time. If a processor
needs to read 64bit of data from memory then the processor must access the memory twice.
2. Address Bus: It is used to carry the address of source or destination of the data on the data bus.
3. Control Bus: It is used to control the access, processing and information transferring. As either the
exclusive data and address lines are shared by all components or common paths may create congestion
in traffic, there must be a separate and dedicated path for control signal transfer.
REGISTER
Within the processor , there is a set of Registers which are very fast but hold only small amount
of data, in order to speed up its operation by providing quick access to commonly used values. Because
they are semiconductor devices whose contents can be accessed at extremely high speed. And the
most important thing about Registers is that Registers generally hold data temporarily, during execution
of a program. And registers are normally measured by the number of bits they can hold.
As an example:
An 8-bit register means, it can store 8 bit of data, 32-bit register means it can store 32 bit of
data.
Now, generally, Registers in the processor perform following two roles:
1.Enable the machine or assembly language programmer to minimize main memory reference by optimizing use of Registers.
2.Used by control unit to control the operation of the processor or by operating system programs to control the execution of
programs.
Now, we will discuss about various type of registers that are commonly used in processors.
These are:
1.Accumulator Register(AC):
Accumulator Register is a general purpose Register. This Register is required for doing operation on data. As this register
holds the initial data to be operated on, the intermediate result and the final result of processing operation. Means, the result of
arithmetic operation are transfer to AC if no specific address of result operation is specified. And the number of bits that
accumulator register contain is equal to the number of bits per word. That is, if word is of n bits, the AC is also of n bits.
2.Program Counter(PC):
Program Counter(PC) holds the address of next instruction to be read from memory after the current instruction is executed.
Means, Program Counter generally acts as a pointer which points to the memory location where the next instruction is
stored.And the no. of bits in PC, that is, the size of PC is equal to the width of the memory address.
3.Temporary Register(TR):
Temporary Register(TR) is used for holding data during the processing. And since Temporary Register
hold data, so, the no. of bits it contain is equal to no. of bits of word(data word).
4.Instruction Register(IR):
Instruction Register(IR) is used for storing the instruction. Means the instruction register hold the
current instruction that is being executed. And since it contain instruction, so, the no. of bits(size) of
Instruction Register is equal to the no. of bits of instruction, and the size of instruction is n bit for n-bit
CPU.
5.Data Register(DR):
The Data Register hold the operand from memory. Means when an operand is found, using either
direct or indirect addressing, it is placed in Data Register(DR).The processor then used in this value as
data for its operation.Its size is equal to the size of word in memory.
6.Address Register(AR):
The Address Register hold the address of memory word that is the Address Register contain the
address of memory location or Register from where data is stored or retrieved. Since it contain address,
so the size of Address Register is equal to the width of memory address is directly related to size of
memory,
Means, if a memory is of size 2n *m , then, n bits are used to specify address.
7.Input Register(INPR):
Input Register(INPR) hold(or receives) data from an input device. And the size of input register is
depend on the alphanumeric code that followed in computer, that is, if ASCII is followed, then the size of
INPR is 7 bits and if EBCDIC is followed, then the size of INPR is 8 bits.
8.Output Register(OUTR):
Output Register(OUTR) hold data that need to be sent to an output device. Its size is also depend on
the alphanumeric code that followed in computer.
Now, thus, according to Basic computer, whose CPU is of 16 bit and memory is of 212*16=4096
words, of 16 bits each, and according to definition of each type of register we discussed, the no. of bits
allocated to each register is depicted in Figure below. Here we assume that EBCDIC code is followed in
computer.
INSTRUCTION SET ARCHITECTURE
• The instruction set architecture is basically the interface between your hardware and the software.
• The only way that you can interact with the hardware is the instruction set of the processor.
• To command the computer, you need to speak its language and the instructions are the words of a
computer’s language and the instruction set is basically its vocabulary.
• ISA is the portion of the machine which is visible to either the assembly language programmer or a
compiler writer or an application programmer.
• It is the only interface that you have, because the instruction set architecture is the specification of what
the computer can do and the machine has to be fabricated in such a way that it will execute whatever
has been specified in your ISA.
REGISTER
register, where registers are used for storing operands. Such architectures are in fact also
called load – store architectures, as only load and store instructions can have memory operands.
• Register – memory, where one operand is in a register and the other one in memory.
• Memory – memory, where all the operands are specified as memory operands.
STACK ORGANIZATION
where the operands are put into the stack and the operations are carried out on the top of the stack.
The operands are implicitly specified here.
Let us assume you have to perform the operation A = B + C, where all three operands are memory
operands.
you have to initially load one operand into the accumulator and the ADD instruction will only specify the
operand’s address.
In the register memory ISA, One operand has to be moved into any register and the other one can be a
memory operand.
In the register – register ISA, both operands will have to moved to two registers and the ADD instruction will
only work on registers. The memory – memory ISA permits both memory operands. So you can directly add.
In a stack-based ISA, you’ll have to first of all push both operands onto the stack and then simply give an add
instruction which will add the top two elements of the stack and then store the result in the stack.
So you can see from these examples that you have different ways of executing the same operation, and it
obviously depends upon the ISA. Among all these ISAs, It is the register – register ISA that is very popular
and used in all other architectures.
We shall now look at what are the different features that need to be considered when
designing the instruction set architecture.
They are:
Move DATA1, R0
Add DATA2, R0
Add DATA3, R0
Add DATAn, R0
Move R0, SUM
The addresses of the memory locations containing the n numbers are symbolically given as
DATA1, DATA2, . . , DATAn, and a separate Add instruction is used to add each Databer to
the contents of register R0. After all the numbers have been added, the result is placed in
memory location SUM.
Instead of using a long list of Add instructions, it is possible to place a single Add instruction in a program
loop, as shown below:
Move N, R1
Clear R0
LOOP Determine address of “Next” number and add “Next” number to R0
Decrement R1
Branch > 0, LOOP
Move R0, SUM
The loop is a straight-line sequence of instructions executed as many times as needed. It starts at location
LOOP and ends at the instruction Branch>0. During each pass through this loop, the address of the next list
entry is determined, and that entry is fetched and added to R0.
Assume that the number of entries in the list, n, is stored in memory location N. Register R1 is used as a
counter to determine the number of times the loop is executed. Hence, the contents of location N are loaded
into register R1 at the beginning of the program. Then, within the body of the loop, the instruction, Decrement
R1 reduces the contents of R1 by 1 each time through the loop. The execution of the loop is repeated as long
as the result of the decrement operation is greater than zero.
INSTRUCTION CYCLE
A program residing in the memory unit of a
computer consists of a sequence of
instructions. These instructions are executed
by the processor by going through a cycle
for each instruction.
In computer architecture, input-output devices act as an interface between the machine and the user.
Instructions and data stored in the memory must come from some input device. The results are displayed to the
user through some output device.
How it works ;