KEMBAR78
Microcontroller BCS402 Module 2 | PDF
0% found this document useful (0 votes)
31 views21 pages

Microcontroller BCS402 Module 2

The document discusses various ARM instruction sets for data processing, including arithmetic, logical, and branch instructions, along with their syntax and examples. It explains the functionality of barrel shifters for manipulating data, stack operations, and memory transfer instructions. Additionally, it covers the role of co-processors in extending computational capabilities and managing memory operations.

Uploaded by

downloadfiles955
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
31 views21 pages

Microcontroller BCS402 Module 2

The document discusses various ARM instruction sets for data processing, including arithmetic, logical, and branch instructions, along with their syntax and examples. It explains the functionality of barrel shifters for manipulating data, stack operations, and memory transfer instructions. Additionally, it covers the role of co-processors in extending computational capabilities and managing memory operations.

Uploaded by

downloadfiles955
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 21
ne data processing jnstauction& sequitement in >) the manipulation of clea weqistes) Explain in brieg 2 processing jas -Hections+ decia processing SnetrvetiOng manipulate cla on Tasisyction , arithmetic: iastrection Comparicon Fatrectors enol ig Anstevctions NM procer using barrel shifter- Date) annie Page No. .... Table ghows bstvel shifter Qpermabon— mea rori$ peseaiption Shift ei Logies! shify Bef xLsly use Logical Shift Right xLSRy ASR Asiidmetic Right Suift XASRY 20k Rotate Rigut xRorRy ) RRX RGtate Rigut extended] =X RRK Agithmetic Tretavetions— The oitnmehic ‘instsuctions Smplement acktition, Gubtrection of 32- bit signe and wasignect UG OAs yartox ~ fsconctf§ s} Rel ,Ra = Addl two 82-bit Yyaluer anol eazy — Rd = Rn tN+ Add +w0 32-bit values Ra=RatN Rd 2N-Ro Rel =Ra-N a an , Logical Rnstwvetioat - rogiés! instvecton ‘perform bitaheos Opreton On “the -hwo Sodu7rte wepistevse RniN Syntax 2 Cingection sfdeo rel} Ysp Ra Ro ROU bmice ANS of YO 82-bit Rd-p,4, Peeieeieit oR Gf. hoo B2- HITS Values | Ra =k EoR = cogint exevigive of two 31 bits’ ustues | Rol = Rar = Rin’ Bic > Logie! br cane (ANS NOT) | Rel = Rin®mny PRE mo = 0x00000000 BBR ORR F071 72 FOR 02040608 ep or 2324 ¢ BEG aocor0 POST BO >= OX 12BA CEH tom| 0 Dstvetong— These Instructions ase useol ty compre 07 fest & regissey wit| O& 32 -biF value + aI De update “the Cps7 value acerrding to Aheresott bud alo not affect other Keg Stes + | Sygotax t- “Feat bing Of A 82-bitUslug — Prags Re an rath’ “eg— pre epss = nzevqifr_ USER P of RNgN | torts . VIs4; Post CMP tog pst = Nzcvgqit+_vseR Meltipty Pns-troetions— The Mo Hip the wontents 0. if Mstyvetions mu Itply the “struction Ma) eae Seen on Sloaeh ite Sot cep » in Another ister *Syntax > MLA ]2070 54 Bo, em, pe Bi ce: MUL Febrort>} 9 Rg i “ae TAS} RA em Be MOUAPLY gaol ceaumobte PIUL Site PRE - fo = OX 00000000 Fost ~ RA =(Rm*R) HRN > Rol = Re Rs 22 OK 00000000 PAUL Yo, 7X 340 =v Date.. Page No. ...2:3. Bain Branch insthoctom jn ARM with guitable je + Demonstrate Branch instiuct ¢ usage flow exeeytion coith an example programs « sige DB branch instruction changes the flo Of eetotion og is used fO «ail % Youtine - This eemereuetion Aloud byograms to have Subsoutina , if then else ctsoctuses | ancl [00ps - The ARMySE instruction cet Includes four different praneh Msbrections 5 Syntax = 8} } Imbel : BL§d} label BAL Leonel | KM label a peslabel “waite link pe= label 4 sadldters of the next inc pujtin after the 6c. branch Exchange C= Fm $ OXffitff Re, 72k 8 te “Te Grampe Shows foward aud backward brang ecouy there loops aie AWtolvers Specific , we olo Not | jactude the pre ~ and post oe gia. The -forwasd brane Skips & Snsteuchon = The backed branch crestes an infinHe loop: Bac kuxied a tomeward ~AhAd Alt t,t, He oe B FH, CH (ER nea rw Bae 5. & backward Dd be he 7 Backnotigd fowward Bacez SvQ brite, H4 Branches aw wed to change execuhon flow - => QT ranch with tink or BL, ingtroction s si +o the B m&trocHon but ovetorites -Ihe link ¥ {[% wlth 5 we+usn addyers~ Be pevfosms @ subroutine esi: | “THs exsmple shoos 4 Simple fragment of code ~thst besnches subsoutine U8INe the BL instruction: BL Subtoutine | CMP oo te | MOVER 4, #0 [ > Subs outine ae MOV pe, hr. The totanch exchenge (BX) aNd branch exchange usith link Lx f Fe oe he +ttyol “ype of baanch instruction «+ 4 % (ties On angplete addyex’ Storect in wezisiry Om 7 cele eae OD uae! 0) rape PRRs, codes the u Staelin Date... soe. Page No. ...2:Govvse tug _numbers— REA. Branch Bemo, CODE READONLY ENTRY Peow of Execution mov Ro, #10 mov @1, #20 t Mov Ro, FIO Mov @!, H20 eo, RI a. CMP Ro, Ri BT GitesterLabel 4. BLT Llegtabel Lewlobe@! tg execttd > Jom ps Equal lobe] cto Less Label 8 MOU 22,4) ig exccted b- & Endlatel is taken 4: Mov R3,#4 and SWI O step execution: iS > Explain she following with example }- i> Sine Operation | = the ARM architects wed The (ood -Store. Moltibie Stack Operations+ Yasizvetions to casty Out he Push ( placing data onto astack) Wes 4 sre mpttiple Sashsu efon * + The Popp (. Yersoving data from astack) uses a load moHipie lasdsuchons An “Ascencting Stack geows upwwes 4 T+ staris ftom HemA OE pithed Ontp 4010 memoty- Qadyess and &% OS st + paogyenes “to higher Merozy qclerserccs + + A dercending- Sialk gvows downwasds + Tt S444 feom high memory AddBUs and then it paogrenes 40 Lowey memay aqctatense- ‘| + Jn a foil stack (F), the stack pointer sp points oan | address that is the last used ov full locafiore Wuile to an empty stack CE) the Sp points to 90 addres that is fisst unused ox empty (ocathon + | = + Softwase Stack e597 he implemenied using- the LOM and STM familie of iastrectionss FaddteASing methods — = Prltweng mode. Descriphon Pop SlbM Pugh Ee Pou paaenaia - LOMFA LaMDA comeR a eee pe LOMED LOMTA smeD Py ascenling Lnweq Lomde cimen stpe4, ed empty es eeueling LOMED LOMrR Stegy 314 Date... ae 2 Page No. . 25K. PRE Mt 2 A FOAL Bata =s OxOO00000 , x 00000003 "OMgOo!s 0 x0000000I is S42 2 O-XGOO DK HOOOULTT | 5 0x000S00!0 brs er 3 OxP 7 “MED spl, fiat

>4y LT ask onithmetic. right Shift —xASRY Cgigned) am >> -TRoR qgotate Bigot xRORY [Lwnsigned) 94) tw < Explain Ss => ly processes singtervc tions §— aye eureol 0 extend the PE eUSemeC COC sOT CAO either provide addons! computation capability os be wid tp contro athe memory, supsystem Sinetucling esches and memory management * The co-processoy Sastru eto “include — < Date PYOCeKIng ° * Regcte Tervafer + Memoty Treusfer Instavcbows: Syntax 1! 4 EDP Ft eh, Opeoded, Cd, en Fo opcot?} | emec J Mer> feond> } eb, eptodet , Rd, en, 6m J, ope fcond >} Cp | ce, edtdaening ' oo, | CDP — COprocessor date procedsingy = pevform ano feo '9 n oper MRE MCR coprocessey veoister opr CEMehs hs tepistey trmsfer = mye dam Ryn ¥" ene ste - coptoceu 27 EMONY FIMSey — fond ami core DIT ( plain with exomples the follovoing 32-bit (_[rostewetion of ARM processow — | a pon MN owen. compagison natroction which, gd fg Uscl +0 COM prt value with negative 3. | ng tneyse | | CMIN Stan for compsze Negative « LH; niax- oMN €Rn> , -o andl Accumvbte Tn a Single tattivction eyck hi> MRS— CMove Register from Status veg iste ) eee ; MRG\epeds foo: move to ARM RBIStE trom y Status Register: DB is wreol +o copy the stontents of a Psogzam Status Regisrey © Grae ot spsk) into % genet! bexpo CeFistey. > MRS ,cpsR mes oes S ese ED Rs eo, cece 5 copy cPse into Ro x ancl CP SR HAH vQ@aeET mode fees a 6 100l! ~ Move fis 32-bit CPSR UslLe Ino Lo, | cteay CAND NoT J of tio © bet with +e Load Registers grands fo D + qs used te toad a Single valve fiat In_ memory © som Vittval eT Rol [Rnd ror Ra, [Ra Offset J ide Rd, evalue #021000 tdR Ri , CRO memoty. at 0xI000 has valve onde) O ADEADBEEF pgeer) proach With Adty« d and_fiom the Se tood and stores the Faults + a vin STRH — SS STRH Stn -for Dt storey fre Lowes mamory * gtote Registet Halfword iv) pits (ha Poort J BF aeFIsts i, ntax— sry ed, [en] Sten ea, [en , Hoffset] STRH Re [Ra] , Hoffset Moy RO, HOKI23+ LDR RE, = O%200000000 STRH Ro CRI] Wi! Store - loses [6 bi Of Ro (9% 1234) -fo AAA? Ox 20000000. Swab seyister cvoith memory » ) Oo wepister Wales with & word in Date... Page No. ..3 jain single Bogie te¥ {oad Baie adldtsexsing mode jax, table, indlex Mode with an example: ~ Regishet Nnsttuctions cise reel for moving = §{ 4 QBy Ra | addressing? J 4 LDR }dtond>} $B HSH Rd, addvering® BTR Jetond> TH, Wd addvesing® } | [PIR > toad word hcto a register | Rdc—mensafaciren STR > Save byte ox word fiom svegictey | Rd ~> menPLedeleeni] load byte into _o tepister Rd & megng [acitaen] gel —pmem’ [acids] Save byfe fam 9 tegister Ra & Sin Extend} Cinem 8 hadeews Rd € SignExtend: Rd — mem I aes Rd > mem l6Lacld ters ] 7 Index Methods — ee Se Base Ares | Gacler Methra | peta Registes | *°MPle ae = J | MPeeindex with weitebret| mern[ be | base toffset [LOR vo,[7, Hy + offset] ; NS Pac iqclex em[wetoffarl] oot updated /LOR xo Pr ind Post inden mere[ base] jbase +offct \UPRoo,[n] 4, Ss Pre inder with wr'itebsck calevrliotes an adore ftom 9 base register ples acldTOM offset And -then updoctes ~tnat ocldlvets brite weqistey with a new addacn- ti) The preindex Offsef Is the same as the pre index | with ursitebsck bet does Not update the oldies bare BOPSHT* we >festindex only updater ne aclerem bare tcqister after address is ete > a ep) PRE 40 , [ec] t#4 Cd) 0 = 0x 00000000 an pal aad 41 = 0X 0009 H000 as | mem32['7% 00090008] = 0X0 1010101 Pos 0s): Bo = 0x01 ™MeEM32 [0 x 0O0GN0EF = O AO2020202. s(t Ox vo0gy 4 LR vo, [4,44]! Preindesing with urtiteback s | PosT(1) “vo Ox 02020202 12 Ox 00009004 Loe to, [v, , t#4] Pre inclexing $ POst(2) : vo 70N02020202 %, =0x00009000 ; Date... Page No. .3. | pot N° ———— Cerise otis logical insrwetiont in ARM processes wh | lan example” es ‘abbrootions pev-fore bihoise logical Operations Logis! ra Closes Sovtee Tess Hers: i 2 —Teyntax 3 logics! Cruise AND of $0 _9)-bi+ vatuss] Rel2Rne [eee S logial vinwise OR of tar s-cit RAK [Ro= Rel) [eo S logical exclubve OR of tO B2-Vt valves |Rd= RoI BIC > logical bit clear (ANB NOT] Rd =Rn orl Ch | i> Qnty — ogi eal 4NS— | vow ei #OKFO 5 1110000 Mov R2, #OxOF 5 0000 III! AND Ro, 2, ,R2 3 Ros @ AND R2 = 0000 5000 ~ Exclvsve_ iSEOR — Logical, OR- Mov er, #OxKAA 4 O10 1010 Mov R2, +6 * Peel Aah) LL BOR Re, RRs 5 RO = OIO! 0101 Sir M.Visvesvaraya Institute of Technology, Bengaluru - 57 i Wy ORR— logiesl OR- ae Mov @1 ,w#oxFO 3119 | 0000 mov R2, to xOF; 00 00 Wee! ORR Roeh,e2 ; Rossii) NN | WS BIC (Rit Cleat)— AND with NOT- Mov Ri, HORE 4 @\\ ian Mov @®, , ORKOF 34 pooo iil Bie RO,& kX 3 FO=RI AND (HOTF2) = INI] D000 ; —- oC g- Explain different onithmene ingtietiong in ARM pw comes vorth an example: @ ane omithmetc “AStauctions implement actlition and Sobteaction Of 32-bit signed And onsinned values: = fau- fp 3st Rd 2 Syngas ABC — Add with came Ot adds 00 3) bit Yaluah and cary Yea = Rn +N + orty | Mov Ri, 4 OXFFFREFFF Mov R2, #2 A_CS RO, RI,RX 5} RO=ORXPEFFEFFR Fat canny i Dates eheten a Page No. = Ade «AC! 1. rw peas 4wO 32-bit valuet + (3 2 Ra +N } | e 4 if) Ri 410 Ot | P| mov 22,490 7 ABD ko,e1 (22 5 ROFP' +P2 = 30 a | Feoisve = stoect E bo Fl gubtsact 200 32-bit nls - § Rd =Rn -N} -_— + : g MOV Ri _, #50 mov Pr, +20 Rue Re,k, P23 RO= &i-Ro = 30 wl $BC— Subtraction With cerry Lt T+ substacts With easy of huo 2) -bit Vsluey- fed = Ra-N — !@sey fag) Mov 1 ,4P10 Mou R2,+43 SBC Ro, Ri R22 5 RO=k, - R2~ (1- casry) [| ks8 — Reverse Subtvact - LIT tevesse subgtacts of two 32-bit valuets _jRat = N -ROf L2) Mov ei #20 Mov Ra, #10 | ea S** Ro, Ri, RD 4 RO=Q-ki =O Sir M.Visvesvaraya Institute of Technology, Bengaluru - 57 ise cavty =1 7 RO=Ro -R1-(2-C) =10-S-9 5 a eet

You might also like