Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

More Books

Students also viewed these Databases questions