MODULE 1
MODULE 1
1.1 Introduction
BASIC CONCEPTS
• Computer Architecture (CA) is concerned with the structure and behaviour of
thecomputer.
• CA includes the information formats, the instruction set and techniques for
addressingmemory.
• In general covers, CA covers 3 aspects of computer-design namely: 1) Computer
Hardware, 2) Instruction set Architecture and 3) ComputerOrganization.
1. ComputerHardware
It consists of electronic circuits, displays, magnetic and optical storage media
and communicationfacilities.
2. Instruction SetArchitecture
It is programmer visible machine interface such as instruction set, registers,
memory organization and exceptionhandling.
Two main approaches are 1) CISC and 2)RISC.
(CISCComplex Instruction Set Computer, RISCReduced
Instruction Set Computer)
3. ComputerOrganization
It includes the high level aspects of a design, suchas
→ memory-system
→ bus-structure &
→ design of the internal CPU.
It refers to the operational units and their interconnections that realize the
architectural specifications.
It describes the function of and design of the various units of digital computer
that store and processinformation.
1.3 BasicOperationalConcepts
FUNCTIONAL UNITS
• A computer consists of 5 functionally independent mainparts:
1) Input
2) Memory
3) ALU
4) Output&
5) Controlunits.
PERFORMANCE
• The most important measure of performance of a computer is how quickly it can
executeprograms.
• The speed of a computer is affected by the designof
1) Instruction-set.
2) Hardware & the technology in which the hardware isimplemented.
3) Software including the operatingsystem.
• Because programs are usually written in a HLL, performance is also affected by the
compiler that translates programs into machine language. (HLLHigh
LevelLanguage).
• For best performance, it is necessary to design the compiler, machine instruction set
and hardware in a co-ordinatedway.
• Let us examine the flow of program instructions and data between the memory &
theprocessor.
• At the start of execution, all program instructions are stored in themain-memory.
• As execution proceeds, instructions are fetched into the processor, and a copy is
placed in thecache.
• Later, if the same instruction is needed a second time, it is read directly from
thecache.
• A program will be executedfaster
if movement of instruction/data between the main-memory and the
processor is minimized which is achieved by using the cache.
PROCESSOR CLOCK
• Processor circuits are controlled by a timing signal called aClock.
• The clock defines regular time intervals called ClockCycles.
• To execute a machine instruction, the processor divides the action to be performed
into a sequence of basic steps such that each step can be completed in one
clockcycle.
• Let P = Length of one clock
cycle R = Clockrate.
• Relation between P and R is givenby
------(1)
• Equ1 is referred to as the basic performanceequation.
• To achieve high performance, the computer designer must reduce the value of T,
which means reducing N and S, and increasingR.
The value of N is reduced if source program is compiled into fewer
machineinstructions.
The value of S is reduced if instructions have a smaller number of basic steps
toperform.
The value of R can be increased by using a higher frequencyclock.
• Care has to be taken while modifying values since changes in one parameter may
affect theother.
BYTE-ADDRESSABILITY
• In byte-addressable memory, successive addresses refer to successive byte locations
in thememory.
• Byte locations have addresses 0, 1, 2. . . ..
• If the word-length is 32 bits, successive words are located at addresses 0, 4, 8. .
with each word having 4bytes.
• Consider a 32-bit integer (in hex): 0x12345678 which consists of 4 bytes: 12, 34, 56,
and78.
Hence this integer will occupy 4 bytes inmemory.
Assume, we store it at memory address starting1000.
On little-endian, memory will looklike
Addres Value
1000
s 78
1001 56
1002 34
1003 12
WORD ALIGNMENT
• Words are said to be Alignedin memory if they begin at a byte-address that is a
multiple of the number of bytes in aword.
• Forexample,
If the word length is 16(2 bytes), aligned words begin at byte-addresses 0, 2, 4
. . . ..
If the word length is 64(2 bytes), aligned words begin at byte-addresses 0, 8,
16 . . . ..
• Words are said to have Unaligned Addresses, if they begin at an arbitrarybyte-
address.
Add R1, R2, R3 Add the contents of registers R1 and R2, and places their
sum into register R3.
Two Address Opcode Source, Destination Add A,B Add the contents of Move B,
memory-locations A & B. C Add A,
Then, place the result C
into location B, replacing
the original
contents of this
location.
Operand B is both a
source and a destination.
Zero Opcode [no Source/Destination] Push Locations of all operands Not possible
Addres are definedimplicitly.
s The operands are stored
in a pushdownstack.
• Access to data in the registers is much faster than to data stored inmemory-locations.
• Let Ri represent a general-purpose register.Theinstructions:
LoadA,Ri
Store Ri,A
AddA,Ri
are generalizations of the Load, Store and Add Instructions for the single-accumulator
case, in which register Ri performs the function of the accumulator.
• In processors, where arithmetic operations as allowed only on operands that are in
registers, the task C<-[A]+[B] can be performed by the instructionsequence:
Move A,Ri
Move B,Rj
Add Ri,Rj
Move Rj,C
Program Explanation
• Consider the program for adding a list of n numbers (Figure2.9).
• 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 registerR0.
• After all the numbers have been added, the result is placed in memory-locationSUM.
BRANCHING
• Consider the task of adding a list of ‘n’ numbers (Figure2.10).
• Number of entries in the list ‘n’ is stored in memory-locationN.
• Register R1 is used as a counter to determine the number of times the loop
isexecuted.
• Content-location N is loaded into register R1 at the beginning of theprogram.
The Loop is a straight line sequence of instructions executed as many times asneeded.
The loop starts at location LOOP and ends at the instructionBranch>0.
• During eachpass,
→ address of the next list entry is determined and
→ that entry is fetched and added to R0.
• The instruction Decrement R1 reduces the contents of R1 by 1 each time through
theloop.
• Then Branch Instruction loads a new value into the program counter. As a result,
the processor fetches and executes the instruction at this new address called the
BranchTarget.
• A Conditional Branch Instruction causes a branch only if a specified condition is
satisfied. If the condition is not satisfied, the PC is incremented in the normal way,
and the next instruction in sequential address order is fetched andexecuted.
CONDITION CODES
• The processor keeps track of information about the results of various operations.
This is accomplished by recording the required information in individual bits, called
condition codeflags.
• These flags are grouped together in a special processor-register called the condition
code register (or statueregister).
• Four commonly used flagsare:
1) N (negative) set to 1 if the result is negative, otherwise cleared to0.
2) Z (zero) set to 1 if the result is 0; otherwise, cleared to0.
3) V (overflow) set to 1 if arithmetic overflow occurs; otherwise, cleared to0.
4) C (carry) set to 1 if a carry-out results from the operation; otherwise cleared to 0