Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions