Unit 4 Full
Unit 4 Full
A computer Architecture
structure and behaviour of the computer
3 aspects 1 Computer hardware circuits displays storage etc
2 Instruction set registers memory instruction set etc
3 computer organization design
of internal CPU
bus structure memory sys
2 approaches 1 ISC complex instruction set comp
2 RISC reduced instruction set comp
Functional Units
5 June units
of a comp
hfffory
4 output
s control units
Itt Iliffe an
Mm Add RH R2 R3 in towns
of
transfers b w
components
ofprocessor Me PC
ÉFÉFnsfa
the contentsof R1 R2 to ALU
perform add in me
IF PTO
Connection b w main
processor memory
main memory
Mosso meminterface
12
Er
sea 1
Processor
Performance
of a process
Parallism
The performance can also be increased performing many operations in
by 1Mel
i e parallelism Parallelism can be implemented on many difflevels
Instruction level Parallelism
Multicore Processors
Multiprocessorscomputersystem
Questions
A program contains 100 of that 501 instructions req 4
instructions out
clockcycles and remaining aug 3 clockcycles for execution Find the total
time req to execute the program running on a 1 MHzmachine
501of instructions need 4 clockcycles 50 4 2004
501of instructionsneed3 dockcycles
3 a you
4a men s I 1558Itoseconds
A perg contains 1000 instructions 251 aug 4 In cycles 401
instruction req 5 In cycles and remaining req 3 Clk cyclesto
execution find the total time meg to execute the pegrunning
on a 1 GHz machine
25 94 250 4 10004
44 of 5
0
400 5 20004
4 I fifhd ff.fm
351.93 150 3
q_
Computer Performance
using Bench mark Programs
Computer performenace does not just dependon the N S T asseen
previously
Benchmark Standard Program used to measure the performance
a computer
of
Performance measure isthe timeit takes to executethe bending
program
non profitorganization EC sysperformance evaluationcompany
SPEC
t s.int
uses benchmark programs to check the comp performance
and to represent various domains rangingfromgaming
computing
test results
its.im i
for diff commercially available computers
a
j.FIpagsoun
3The running time is measuredfor each prg
on the ref comp
SPEC is then calculated by running time on refcomp SPEC
running time on testcomp orating
For ed for
sec of compis Y f wfE
h
process
rating is 50 that means that the comp under
If 4
mes as fast as the
ref comp
Memory organization
iii iiiiii
man
Temaywords lastword
Byterdressabilty
memory is made of 1 Bit memory cells organizedintobytes words
uniqueaddress is req to access thebyte 8bits
each memorylocation representing 1byte has givenone unique address
This is known as byteaddressability
addresses range from 0 to n 1 n total no mem locations bytes
of
based on address lines providedby the processor
address lines
If M no
of
2M tot no of addlines perorbyprocessor
2 1 kilobytes
220 1 Megabyte
23 1 Gigan
240 1 Tera
ÉÉm
Indianness
f thatched
adddshf
Ñft Iffff
f
af y s
htdgff
bytfhaffffrdff.ee
Word alignment
wordsaresaidtobealigned in memory
iftheystart at addressesthatisamultipleofthe noOf
8s In a bitsys natural word boundaries occur at addresses0 4,8ets
alignedmemoryfess improves performance for operations
efficiency
Memory Operations
RAM has 2 operations Read reads data stored at location
White writes data
Machine Lang perg 2 operations store write operation
load read operations
TTanstersacopyfthontentsf v
Transfers an itemofinfofrom
TmtRdÑh n thdthdm.deotoaspeciticme
www
the IAdTestroys
contents
Zero
addest
These instructions tjᵗYany operands
dont spec
They operate directly on
goals stored in registers or mem
QQ.hs.im
aftomi Operationdestination
These have one operand explicitly specified
The operation is performed b w the smiend
location A'tothe andgaffhfh.dk
t
add contents contents
of mem ofreg
d copies contents men location intotheaccumulator
of
ftp.sinafesfoam Operation source destination
Thesehave 2 operands explicitly specified
performs B A B Sum is storedin'B
HEFFETTI performs e Cos contentsof B'is unchanged
a
Qfsfm.to
dts operation source 1 some 2 destination
3 operands are
explicitly specified
They perform an operation b w the first 2 operandsEestoresthe result in
the 3rd operand
be Addff addsA GB result is sent to loc c
Questions
What is register transfer notation explainthe assemblylongnotations
symbolic2
RTN is a language used to describe the transfer
of data b w
registers in a digital computer
The contents of location are denoted byplacing
square brackets around the name of the location
R3
of reap
What are the 4 types of operations performedby comp
instructions
whts
Efffff ththffffly.mg
If transfers
hffffffmkms
24 2x 6
y Write an ALP code to implement this
Faddress
using X Y and no easiest method
his 3 5 4 S.ie
MUL X X X X2 X2 24 X x containe 24
ADD X Y Y 4 22 7
ADD 6 Y Y 24 Zat Y
usingzaddressinstfi MY goingtodisturbcontents
tyz f www.go ofx
MOL X X 4 Cahasse4
MUL Z Y 2 2x Y Ycontains k 2 n 2n storein Y
1B EE xp
using one address instm we use an accumulator
initially accumulator is empty
KIMOV X X Accumulator a is moved to accumulator
In I is E
IE
STOREY
iEEi Eau
Acc Y whatever is there in the ace is storedin4
Condition Codes
while performing any operation in the processor arithmetic
4tags flip flops are set
ofinto that representtheoutcome
tmall.IT
of ffhfhffhd
certain operations peerformedb porocess
es
2
or tags
zero
AT if
NCregetine tag setto 1 if resultie
1 result
0 or 0
ne or set too
Indexed add
relative add
Auto increment
Auto decrement w r
Immedidende ADD S X
Register mode
reg address
instant includes as an operandi e instantgets
data from that reg
effective address address of register
Syntax Ri
ble MOVR1 Ro more contents of myRy to Rego
Indenteddisplacement mode
instant includes 2 vials addressA indenregister asoperand
variants ofindex mode Inden mode Syntax CRIS
Base index Syntax Ri Rj
Base with index andoffset Syntax X Ri RI
allative mode Syntax PCT
effectiveaddress contents
of indenregister Ri
Eg ADD 20CRT R2
i i
D write an ALPpegto add N'numbers storedin the memory
ORIGIN 100
MOVE N R1 mom set ofN nos R1
MOVE ANUMI R2 move 1st no R2
MOVE 0 Ro CLRRo clear Ro
ADD R2 Ro
ᵈᵈ
ÉrÉÉn'Tr1
ff
LOOP or BUT
more um i
ORIGIN 200
SUM RESERVE4
N DATA
WORD150
NUMI RESERVE600
END
ii EEE
A write ALPprogram to compute the test scores
and store in
sum
of all
mem forN'students
ORIGIN 100 N total noofstudent
MOVE LIST RO studentI'D
CLEARA
CLEAR R2
CLEAR R 3
NOV N R4 MoveN'tory
3tests
AABB
for
FEIEEEI.EEIFs16bis.Cinorement
LOOP
ORIGIN 200
4
s
IEsEEii tests 15
List DREESE
END
A
A
Ls F
on the display screenusing
fdhhffffha
program
agree
controlled o
a producesaction output
I
Flags forcommb w www.magifuaaonfgmd ham
FIffffhhhhhhhaphthyister
idata inDatan
stored
datahastobedisplayedonthescreensend
when datatoDATAUT
deviceitwrites
datatoanoutput
keyboard
t.at
d
Read input line
continuouslycheck SIN inputstatus until it indicatesthat a char is available
in the DATAINregister
Once SIN is set transfer the charfrom to 11
DEAL
Displayingitin
continuouslycheck SOUT outputstatus until it indicates that thedisplay is
readyto relieve thechar
once sout is set char fromRI istransferred to DIVE
Looping waiting
use a loop to check status tags asseenabove
ensures synchronization b w processor I odevices
CISC style instructions
useinstructions likeTestBit to checkstatusof Ilo flags
MoreBytetotransferinstructions bwbufferregisters
Implementate
readSINthey
If SIN is set morecharfromDATAINSRs If not branchbackto READWAIT
readSoutHey
If SOUTis set morecharfrom R1 DATAOUT Ifnot we WRITEWAID
Implementation
of Stacks
Astackis a datastructure and i.at oftest
iheefgyg.ggmhmm
elementsarepushedandroped gt thing
variousoperationson stacksare
Push addinganele to the top thestack
Pop removing an ele from top of
the thestack
of
display todisplay thecontents
ofstarch
IT If is usedto keeptrack of the address ofthede
fgfgfffzt.at
It pointtothe
marathon wherethe taste waspassedontothe
wheman all itpushedontothe stack stackpointer is incremented
when all ispopped we decremented
0
É stack is full
if full branch to FULLERII
opened if not NEWITE
INI
stack
43 Bottomelement
SAFES
check stack is
a if empty
htEm.EMteEmor
Implement gauer
Data in queues are stored in 0
basis
new data is added to the back ofqueue andretrieved from
thefront
Two pointers are used to manage the queue
8sep
mom
It tt saaises
addresses from beginning toend is assigned tothe queue
Afstentry CTgher
addresses
Subroutine
Subroutine Completion
Local variables are removed from stack
Processor register's contents are stored
old value of FPrestored
Sean
2 address sourcedist
mEEE.EE's oh
13 s
D
Iaddress dist f
Accumulator each
step
ADDSUMMULIMOVLoadstored
j hg
MULT
MOV X Y Y
in EfEEI
fi
mut xxx
XY X x 23
SUB 45
s