You are on page 1of 9

CSE-92 8 Computer Architeckure

MID SEMESTER EXAMM

Name Ashish Pa
Rollno 90750l6
Branch CSE CBTech 9rd gear)

CSuy)
To achually speak o elechonic hendware, we neecd
to send eluchic as sanal, me eas/es 8lqnal Fobr
So
Comp ule8 te undlorstand are on and ' s f
Compdey undershand only bnary numben, 1Binary
representaion of machin inshuehonr is khown
Cay Machine Languge"
Now to make easy to wmite inshuchor
Fer a poram mev, High vel proamming Languag
Such ay C/ch Jaua, were clesrgicd
Sleps to transtam a proqam Cnshuchons writen in q
hiqh -uvel dangua Such cu Cinto medhin Lenguaa
ave aufollous
O Cenvexdion of tgh uel Jangua to Ass embly
Rangua pro9Ydm 3-

Compilers are ued for fhu upoOSe, Compi ey q


Ps
hanslacu high vel Longuag shalemak
pooq ram thad
ink Assembly angua sufments, Ass èmbly Langua
is a sqmbo lic Tepvesetion of machine inshuchons
Ashish Pdu 190750l6 Paq No-2

For example-Suwap" poog1am Suap two cavnsecuiw


numbers P qn ama.

pmoqvam wlien
Pn Clanguage is Covn veileol
Swap"
below-
to casembly Langutg proqnam cy

Swap Crd UCJ,ind E) Suqp


muulh 2$S,y
d temp add s2,s4, $2
CompPlay
temp v C
V CkJ=Y Cet L $16 4C$2)
Sw 16, oCf
YctJ=temp Sw s , uCf)
31
-ConVerslo_aAcsembly Lanquag progiamto
mach in t langua Binony langaG PoqYam

An Assemble " is us eel tor dha parpos", n the


beqinning he assembly Langaage programs were
aanga
hunsAoitud to binang angdagi by hand uhich
dagi
wCy very tiYesbme proces, smg he Cornplu
compo u 7he

te help proqam he compdir, he ptoneers


in venfed
P
hogrums to banslel hom symbelei
nofcchun Assembly languag,) to bing Ta
Fnst of dhese pro04rums was named án
asse mbler. Arientbler raaslats sum bolu vesion
of an instruchn into binay verssUn
Ashish Pat 190 sol6 Paq No-3
e. the sam e previouw pTonum to swap
Consecuhu numbes in andy srangcduil to
machiny angua9 a

Swap o
muli 9 2, S y O0000000 lol Oo0100000ool ool0o
00000ooloo000 I Occ OOcOlco
aad , u $2 TOOOLIOLIOoooo00Oo000000O00|
Assemblevlooo OOoo10000o000000i0o|
2l00u I000 lOol o00oO0O0O0O000
lw I6, u(¢) looIolioo10000OOO000010o

Oo000o0IIo oO00OoO0O0OI0o0
Sw 16, OC{)
Sw IS, uC$)
)r 3
Ashish Pactsd 1907sol6 PaùeNo-4

ao-2)
Civen se conc
Co mpudeY A runa a progrum n O

Same proqrum
n Sse cOrcly
Com puteY B runs
U

To fPnd 9 houo much fauBerisA han 8


often
To discasine a ComputUY deslan, we

hoo different
CDandto relai he perfasmane o
when we w e he phraue
Computv quanbit ahvely
A TS n times faster han B mean
we me an

per tormancA) n
Per formaneCB)

To cgine pertovmance fovmalyedo Kivt dahne tim


timc tim; Kesponue
execion
Teponse or
time
time
time is the totcu
also called ene cion
tor Compudy to Ccomplet
desk.
yeuuie a

be gven as-
So, tomay, our problem can

aten_3-
Exechon Time ot Computer A= 0s

Execuhon Time ot Compuur B (Ss

To fTod
Per formame A)
Perfevmane B)
No , we Say a computr perfoms btler than ale
CompdeY 7 i} akes Lu taimt to compLul tesks
Ashish Patu 901sol6 Paac-No-S
So to maximine pertormane we wam to minimize
Tponse ttme oY ekecuion time for some task,
Mathemadhcally per tormane and execuhon ime toy
CompuyX are relatud
a
hollow 3-

Pertormavnce Cx) =
Ex eculon time X) -O
wThe -
wing eq-D we Can

p e r FoY mane o CompularA-


performane (A) Exe cuhn timf AJ

pefo mane ot Computey B 8

Pertoa mane CB)> Execuwion time S)


,

T5

ng e - e-
Pertomnave 1:5
Pertor mane )

taler than
Hence Copuier A 's-5 tirmu
Compufer B.
Pall 19095Ol6 Page No 36
Suy-3)
afven Ccode-

fov Cl=o, lea ,trt)


tor J=o j<b :Jt)

V a l u of a,b , j ose fn registey so, gsi, fto and Sti

7espective
$si holds bue address ot aay D
Codi fs u tollows 3 -

Conuentee MTPs Assembly

bo = O

0 O
O
addi to, $0, J u n p to
labe CHECET

be
be 0 , o, CH ECKT
O
LOO PT addi gtt 0,
$0,CHeCkJ F Jump to Label CHECET
bety $O,
bet # t 3 = $to t$t2
LOOPJ add t 3 t o , 4I
slIt2 t3, $t2 1 s2
t2=
add t 2 t 2 , $S
add

Sw$ta G+2)
dddt $t t1,
CHECKJ slt t2, t t $si
bneta O , LooPJ

addi to, to, 1


2 , $ t o , dso
slt
CHECET LooPI
bne t $0
Ashish Pate 90ol6 Page No -7

Civen MIPS assembly Tnshuchonu-

sl ## $to= f44
0 , 4 So, 2
ad d to, ¢s6,¢+0 # to- 2Af]
add F $ti 9.
sli t , $SI, 2
#
add t , S7,$t # f ALFJ
lw so o (3to) o ovgicu
addi ,dto, 4 # ¢t2= 2A LA+U, hew f u
vau not u pdatW

lw to, oC$t) to ACf+


$to ACAI+ALfJ
add to, $to, ¢so
S to oCtt) *BC] A LP) +A LfJ

ConYeyacd codle in C C lanquag-


BCJ= ACA+ Af);
f ACF
be nofec that h two sfatementr Can nof
ee
T+ to
be cause utter the updaion f=A Cf,
be swapped,
he temparaiy egisteY
when eveY we sefwe e
f.
Soring the oiginal vadu o
As hish Patt 12050l6 Page No-8
Qau-s)
Pven
thold tnLgeyT
S2 holdu eiu
$so holda baue
ciddyess ot Menory

atven Loop în MIPS 8-

add $ , $o, fo
t ¢si= Mem Aray
Loop l lw s1, oC¢co)
ad d s 2 , s , $SI
mem ruy t+
addt so, so, y t
addt , s t , L i f Clcoo) then sedst2=1o
slt ta, $t, loo (fb»# emere u )jump
*#
bne ta, so, Loop tt JoopP.

ConYev ted C Codle


int pY = LMem hruy COJ

for Ctrd i = o t t
f CC< lo)= =Cind&ph.
breae

Tesute prS
phr t+
Ashish Pab. 190SO/6 Page ro -9

Quo-6)
Cten- OK2000 Ocoo
to haldu he valw

Thshudhione -
Slt 4t2, $o, dto ($to>a), sdtt=l ele sbl-o
ELSE # f ($ta== brarh to lauel ELsE
ey t2, $o,
be,
DONE +jumpt DoNG
ElSE add t2,$t, 2 $t2= $tt2
DONG

SPnce $to holdu Ox200o oo00 which is tn hexido


docimal
tom. Ts COres Decimal Fosm Pe S368709/2
pondung
sed +o i in Line L
Stnce o>o t2 will qel
label ELSE n Lne 2
Since bo 0 we co?l no jup to
Tn i 3 we will jump to labelDONEY

APter Jun S proq ham Ps termmalod

Thus, Valu ol ft2 after inshuciony =1

You might also like