Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a) Find the addressing mode of the next assembly instructions. b) How many cycles has each instruction? STR R1,[R0] Register indirect address Clock Cycles
- a) Find the addressing mode of the next assembly instructions.
- b) How many cycles has each instruction?
\
STR R1,[R0] Register indirect address
Clock Cycles MNEMONIC ADDRESS MODE PUSH {R2,R3} Cegiste addyessing Delay Loop0: LDR R2,M Jinnediare addiesSing Delay_Loop1: SUB R2,[R1,#1] CMP R2,[R1,#0xA6]! BNE Delay_Loopl SUB R3,R2,#1 CMP R3,#0 BNE Delay_Loop0 POP {R2,R3} MOV PC,LR |veq Pre inden w.weite boe retive adevessing immediate advese ing immediore dddeef1ing reiotive adklvessing regisrer eddreESing register adavessing 2. main: Init GPIO BL LDR R0,GPIO PORTF DATAR MOV RI,#00000000b STR R1,[RO],#0x9C velative addvess Immediate address ng immediate adckessing Poss indtied dldessing Loop: LDR RI,[R0] AND RI,R3,#00010001b CMP R1,#00010000b BEQ GRED CMP R1,#00000001b BEQ GBLUE CMP R1,#00000000b BEQ GGREEN B Loop |register adaressing mmedicte adaresing immediate addressing Celerie addcessng Immed.ate acAressing relative addcessing Immediare addvecsiv retive addvessing reiative aadeesing Init GPIOF: PUSH {R0,R1} LDR R0,SYSCTL_RCGC2_R LDR R1,SYSCTL RCGC2_Data STR R1,(R0,LSR #9] LDR R0,GPIO_PORTF_LOCK_R LDR R1,PORTF LOCK DATA STR R1,[R0] LDR R0, GPIO PORTF_CR_R MOV RI,#01F reqistor addiessing Lmedians adasssing immatiate eadvessing Pe - inteiedadcess ng immediate sdciressog mmegiare adeiressing rqister odxece inpediers addcessing immediate addveks ing STR R1IROL 2. immediate LDR R0, GPIO PORTF AFSEL R MOV RI,#0x00 STR RI,[RO] LDR R0, GPIO_PORTF_PCTL_R mmedicte register indirect immeaiate MOV R1,#0x00 STR R1,[R0,%00101101]! LDR RO, GPIO PORTF DIR R MOV R1,#00E STR R1,(RO],#SA3 LDR R0,GPIO PORTF PUR R MOV R1,[R7,#0xll] STR R1,[RO] LDR R0,GPIO PORTF DEN R MOV R1,#01F STR R1,[RO] POP {RO,RI} Immediate Pre insexing w Wrise eae immediere immediate POst Indeed Lmmediate Pre inaexea tgister indirect immediate immediate register indirect register relative Bx LR RED LED: PUSH {RI,R2} register MOV R1,#00000010b STR RI,[RO] MOV R3,#5 PUSH {r5-r7,Ir} BL Delay P {r5-7,! immedigtte Yegister indivect immedinte reqister relative MOV R1,#00000000b STR R1,[RO] POP {R1,R2} immediate register Indirect register BLUE_LED: PUSH {R1,R2} MOV R1,#00000100b STR R1,[RO] MOV R3,#5 PUSH {r5-r7,Ir} BL Delay register immediate register i mmediete register reiative Clock Cycles MNEMONIC ADDRESS MODE PUSH {R2,R3} Cegiste addyessing Delay Loop0: LDR R2,M Jinnediare addiesSing Delay_Loop1: SUB R2,[R1,#1] CMP R2,[R1,#0xA6]! BNE Delay_Loopl SUB R3,R2,#1 CMP R3,#0 BNE Delay_Loop0 POP {R2,R3} MOV PC,LR |veq Pre inden w.weite boe retive adevessing immediate advese ing immediore dddeef1ing reiotive adklvessing regisrer eddreESing register adavessing 2. main: Init GPIO BL LDR R0,GPIO PORTF DATAR MOV RI,#00000000b STR R1,[RO],#0x9C velative addvess Immediate address ng immediate adckessing Poss indtied dldessing Loop: LDR RI,[R0] AND RI,R3,#00010001b CMP R1,#00010000b BEQ GRED CMP R1,#00000001b BEQ GBLUE CMP R1,#00000000b BEQ GGREEN B Loop |register adaressing mmedicte adaresing immediate addressing Celerie addcessng Immed.ate acAressing relative addcessing Immediare addvecsiv retive addvessing reiative aadeesing Init GPIOF: PUSH {R0,R1} LDR R0,SYSCTL_RCGC2_R LDR R1,SYSCTL RCGC2_Data STR R1,(R0,LSR #9] LDR R0,GPIO_PORTF_LOCK_R LDR R1,PORTF LOCK DATA STR R1,[R0] LDR R0, GPIO PORTF_CR_R MOV RI,#01F reqistor addiessing Lmedians adasssing immatiate eadvessing Pe - inteiedadcess ng immediate sdciressog mmegiare adeiressing rqister odxece inpediers addcessing immediate addveks ing STR R1IROL 2. immediate LDR R0, GPIO PORTF AFSEL R MOV RI,#0x00 STR RI,[RO] LDR R0, GPIO_PORTF_PCTL_R mmedicte register indirect immeaiate MOV R1,#0x00 STR R1,[R0,%00101101]! LDR RO, GPIO PORTF DIR R MOV R1,#00E STR R1,(RO],#SA3 LDR R0,GPIO PORTF PUR R MOV R1,[R7,#0xll] STR R1,[RO] LDR R0,GPIO PORTF DEN R MOV R1,#01F STR R1,[RO] POP {RO,RI} Immediate Pre insexing w Wrise eae immediere immediate POst Indeed Lmmediate Pre inaexea tgister indirect immediate immediate register indirect register relative Bx LR RED LED: PUSH {RI,R2} register MOV R1,#00000010b STR RI,[RO] MOV R3,#5 PUSH {r5-r7,Ir} BL Delay P {r5-7,! immedigtte Yegister indivect immedinte reqister relative MOV R1,#00000000b STR R1,[RO] POP {R1,R2} immediate register Indirect register BLUE_LED: PUSH {R1,R2} MOV R1,#00000100b STR R1,[RO] MOV R3,#5 PUSH {r5-r7,Ir} BL Delay register immediate register i mmediete register reiativeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started