Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is what I have so far on my first time using Keli. Here is the home work below and image of what I have

This is what I have so far on my first time using Keli. Here is the home work below and image of what I have done so far. Any suggestions? Write an ARM assembly language routine to count the number of 1s in a 32bit word in r0 and return the result in r1. code:image text in transcribedimage text in transcribed

LDR r0, 0x11AB003F dummy value for rl (11 ones) MOV r1,#0x0 MOV r2,#32 MOVS r0,r0, ROR #1 ADDCS r1,r1,#1 SUBS r2 , r2 , #1 BNE OnesCount ; clear ones counter ;use r2 as the loop counter i Repeat: rotate ro right set Ilags ;if carry set increment 1s counter ; decrement loop counter until all bits tested OnesCount If this was a subroutine Count, the code might be area test, cODE, readwrite ADR sp, Stackl LDR r2 , =0xFFFFFFFF STR r2, [sp] LDR r0, - 0xFFAB123A BL MOV r3,rl NOP NOP ;set up dummy r2 ; dummy data :call routine ; read result Count STMFD sp!, (r2,lr] MOV r1, #0x0 MOV r2,#4 Count ; save r2 and return on the stack onesCount MOVS r0,r0, ROR #1 ADDCS r1,r1,#1 SUBS r2 , r2 , #1 BNE OnesCount LDMFD sp!, (r2,pc) ; restore r2 and returr Stack Stackl DCD 0,0,0,0,0 DCD 0,0,0,0,0 Project arm32.s Project: first week 4 l area test, code, rewrite Target 1 Source Group arm32.s 5 ADP sp, Stackl 6 LDR r2,=0xFFFFFFFF 7 r2, Isph 8 r0, -0xEEAB123A 9 BL Count 10 MOV r3,rl 11 NOP 12 NOP 13 load the duny value "11" ones to register r0 14 15 LDR 16 MOV 17 MOV 18 ro,#0x11AB003E rl, 0x0 r2, #32 move the 0 to rl to clear register mover the 32 to register r2 to use as loop counter start the loop, repeat :shift the result in r0 one right 20 Loop Movs ro, ro, ROR 1 ADDCS 22 SUBS r2, r2,#1 23 BNE Loop 24 END :add vaule 1 to register rl ; subtrsct the 1 from r2 and store the result in r2 r1, r1, #1 LDR r0, 0x11AB003F dummy value for rl (11 ones) MOV r1,#0x0 MOV r2,#32 MOVS r0,r0, ROR #1 ADDCS r1,r1,#1 SUBS r2 , r2 , #1 BNE OnesCount ; clear ones counter ;use r2 as the loop counter i Repeat: rotate ro right set Ilags ;if carry set increment 1s counter ; decrement loop counter until all bits tested OnesCount If this was a subroutine Count, the code might be area test, cODE, readwrite ADR sp, Stackl LDR r2 , =0xFFFFFFFF STR r2, [sp] LDR r0, - 0xFFAB123A BL MOV r3,rl NOP NOP ;set up dummy r2 ; dummy data :call routine ; read result Count STMFD sp!, (r2,lr] MOV r1, #0x0 MOV r2,#4 Count ; save r2 and return on the stack onesCount MOVS r0,r0, ROR #1 ADDCS r1,r1,#1 SUBS r2 , r2 , #1 BNE OnesCount LDMFD sp!, (r2,pc) ; restore r2 and returr Stack Stackl DCD 0,0,0,0,0 DCD 0,0,0,0,0 Project arm32.s Project: first week 4 l area test, code, rewrite Target 1 Source Group arm32.s 5 ADP sp, Stackl 6 LDR r2,=0xFFFFFFFF 7 r2, Isph 8 r0, -0xEEAB123A 9 BL Count 10 MOV r3,rl 11 NOP 12 NOP 13 load the duny value "11" ones to register r0 14 15 LDR 16 MOV 17 MOV 18 ro,#0x11AB003E rl, 0x0 r2, #32 move the 0 to rl to clear register mover the 32 to register r2 to use as loop counter start the loop, repeat :shift the result in r0 one right 20 Loop Movs ro, ro, ROR 1 ADDCS 22 SUBS r2, r2,#1 23 BNE Loop 24 END :add vaule 1 to register rl ; subtrsct the 1 from r2 and store the result in r2 r1, r1, #1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions