Question: I have this NIOS II Assembly code and I want to display my code on leds that are on the fpga board. I included the

 I have this NIOS II Assembly code and I want to

I have this NIOS II Assembly code and I want to display my code on leds that are on the fpga board. I included the memory addresses for the switches and leds at the top of the code. Register r2 holds the largest number. Please help me with the additional lines of code to display my output to the leds on the board using the switches!

# Program that finds the largest number in a list of integers .equ switches, Ox002040a0 .equ leds, Ox00204090 .text global_start start: movia r8, RESULT #18 points to result location ldw r4, 4(18) #r4 is a counter, initialize it with N addi r5, r8, 8 # r5 points to the first number ldw r2, (r5) # r2 holds the largest number found so far LOOP: subi r4, r4, 1 # decrement the counter begr4, ro, DONE # finished if r4 is equal to 0 addi r5, r5, 4 # increment the list pointer ldwr6, (r5) # get the next number bge r2, r6, LOOP # check if larger number found mov r2, r6 # update the largest number found br LOOP DONE: stw r2, (18) # store the largest number into RESULT STOP: br STOP # remain here when done RESULT.sk.p 4 # space for the largest number found N.word 7 #number of entries in the list NUMBERS.word 4, 5, 3, 6 # numbers in the list word 1,8,2 .end # Program that finds the largest number in a list of integers .equ switches, Ox002040a0 .equ leds, Ox00204090 .text global_start start: movia r8, RESULT #18 points to result location ldw r4, 4(18) #r4 is a counter, initialize it with N addi r5, r8, 8 # r5 points to the first number ldw r2, (r5) # r2 holds the largest number found so far LOOP: subi r4, r4, 1 # decrement the counter begr4, ro, DONE # finished if r4 is equal to 0 addi r5, r5, 4 # increment the list pointer ldwr6, (r5) # get the next number bge r2, r6, LOOP # check if larger number found mov r2, r6 # update the largest number found br LOOP DONE: stw r2, (18) # store the largest number into RESULT STOP: br STOP # remain here when done RESULT.sk.p 4 # space for the largest number found N.word 7 #number of entries in the list NUMBERS.word 4, 5, 3, 6 # numbers in the list word 1,8,2 .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!