Question: I need help revising this code in NIOS II DE - 1 0 Lite . First I will give you the assignment, then I will
I need help revising this code in NIOS II DE Lite First I will give you the assignment, then I will give you the code I have so far. I just need help compiling successfully in CPULator Please fix the code according to the assignment and give detialed description of the code and how it should run
Assignment:
My addresses for all my devices :
LED Base : xff
Seven Seg Display : xff
Swtiches : xff
In NIOS II DE Lite I need a program that has lines of code that does the following :
Uses Devices
Uses Infinite Loops and allows user interaction until stopped
The first change is functionable
The Second change is functionable
Overall program functions as described in the proposal's minimum requirements
AtLeast Lines of NIOS II DE Lite Instructions
Meaningful and accurate comments included with every instruction
Detailed program gives after End directive
The program I want to make allows the user to control LEDs on the DELite board using the board's switches as the input device. Each switch corresponds to one LED, and the program would read the state of the switches and updates the LEDs accordingly. The program I want to make, would use an infinite loop, that constantly checks the switches and adjusts the LEDs based on the switch state the user decides to select.
My Input device would be using the switches. My Output would be the LEDS
User Input: The user interacts with the program by toggling the switches.
Each switch corresponds to one of the LEDs, allowing the user to control each LED individually deciding what switch the user would want to use.
The program controls the LEDs on the DELite board according to the state of the switches.
If the switch is on or off it directly affects the corresponding LED on or off
First Change: Reading the switch inputs.
The program would continuously read the state of the switches.
The program uses this input to determine which LEDs should be turned on or off.
Second Change : Update the LEDs based on the switch inputs.
The program would update the state of the LEDs based on the current state of the switches.
This mapping is direct, with each switch controlling one LED.
Third Change: Looping back to continuously read switches and update LEDs.
The program continuously loops back to read switch inputs and update the state of the LEDs accordingly depending on the users input
The use of the Infinite loop ensures realtime control of the LEDs based on switch input.
After the user flips a switch, the count of the number of switches currently in the on position will show in the seg display.
Current Code : equ LEDBASE, xFF ## Base address of LEDs
equ SWBASE, xFF ## Base address of switches
equ SEGBASE, xFF ## Base address of segment display
equ HEXOFFSET, ## Offset for HEX display
equ HEXOFFSET, ## Offset for HEX display
equ HEXOFFSET, ## Offset for HEX display
equ HEXOFFSET, ## Offset for HEX display
equ LEDCOUNTDISPLAY, ## Display for showing switch count
section text
global start
start:
movia r LEDBASE ## Load LED base address
movia r SWBASE ## Load switch base address
movia r SEGBASE ## Load segment display base address
updateleds:
movi r ## Initialize switch count to
## Read switch state and update LEDs
movi r ## Total number of switches
loopreadswitches:
ldwio rr ## Read switch state
andi r r ## Mask out switch state
stwio rr ## Update corresponding LED
addi r r ## Move to next switch
addi r r ## Move to next LED
add r r r ## Update switch count
subi r r ## Decrement loop counter
bne r zero, loopreadswitches ## Continue loop if not all switches read
## Display switch count on segment display
mov r r ## Copy switch count to register
mov r zero ## Initialize display offset
movi r ## Value for converting switch count to BCD
divu r r r ## Divide switch count by
muli r r ## Multiply quotient by
sub r r r ## Update switch count
addi r r ## Convert quotient to ASCII
stwio rr ## Display digit on segment display
addi r r ## Move to next display
divu r r ## Shift divisor to next decimal place
bne r zero, loopdisplaycount ## Continue loop if more digits to display
br updateleds ## Repeat indefinitely
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
