Question: Make a new folder and make a new file part2.s in that new folder. Write a new assembly language program that determines the longest string

Make a new folder and make a new file part2.s in that new folder. Write a new assembly language program that determines the longest string of 0s in a word of dataput the result into register R6. Compile and load the program. Fix any errors that you encounter. Once the program is loaded into memory in the DE1-SoC Computer, single step through the code to see how the program works.

EXAMPLE CODE:

/* Program that counts consecutive 1s */ .

text

.global start

start: LDR R1, TEST NUM // load the data word into R1

MOV R0, #0 // R0 will hold the result

LOOP: CMP R1, #0 // loop until the data contains no more 1s

BEQ END LSR R2, R1, #1 // perform SHIFT, followed by AND

AND R1, R1, R2 ADD R0, #1 // count the string lengths so far

B LOOP

END: B END

TEST NUM: .word 0x103fe00f

.end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!