Write a program in PLP assembly that repeatedly reads the value of the switches (address: 0xf0100000) and displays a pattern on the LED array based on what switches. Each time the switch value is read, the pattern should be displayed (regardless of whether the switch value has changed or not since the last time it was read). The table below indicates the pattern that should be displayed for each possible switch setting.   - please use"sw" "li", labels, loops, "beq" and "lw" to create the code. The code is for assambly language and it will be compiled and run on PLPTool version 5.2.   I have created the following code it is not completed it. I seem to be stuck here. Please complete it, following the task instructions.   # main source file   .org 0x10000000   _start:     # Initialization     li $t0,0xf0100000  # Load address of switches     li $t1,0xf0200000      # Load address of LEDs li $t5,1 #  Load value of switch 0 address of LEDs li $t6,2 # Load value of switch 1 address of LEDs li $t7,4 # Load value of switch 2 address of LEDs   loop:     # Read switch value     lw $t2, 0($t0)         # Load switch value into $t2       # Generate LED pattern based on switch value       beq $t2,$t5, switch_0   # Switch 0 pattern     beq $t2,$t6, switch_1   # Switch 1 pattern        switch_0:     li $t3, 0xf  # Pattern for switch 0 (LEDs 0-3 on) sw $t3, 0($t1)         # Update LEDs with generated pattern j loop                 # Repeat loop   switch_1:     li $t3, 0b11110000     # Pattern for switch 1 (LEDs 4-7 on)     sw $t3, 0($t1)         # Update LEDs with generated pattern j loop                 # Repeat loop

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 18RQ
icon
Related questions
Question
Write a program in PLP assembly that repeatedly reads the value of the switches (address: 0xf0100000) and
displays a pattern on the LED array based on what switches. Each time the switch value is read, the pattern
should be displayed (regardless of whether the switch value has changed or not since the last time it was read).
The table below indicates the pattern that should be displayed for each possible switch setting.
 
- please use"sw" "li", labels, loops, "beq" and "lw" to create the code. The code is for assambly language and it will be compiled and run on PLPTool version 5.2.
 
I have created the following code it is not completed it. I seem to be stuck here. Please complete it, following the task instructions.
 
# main source file
 
.org 0x10000000
 
_start:
    # Initialization
    li $t0,0xf0100000  # Load address of switches
    li $t1,0xf0200000      # Load address of LEDs
li $t5,1 #  Load value of switch 0 address of LEDs
li $t6,2 # Load value of switch 1 address of LEDs
li $t7,4 # Load value of switch 2 address of LEDs
 
loop:
    # Read switch value
    lw $t2, 0($t0)         # Load switch value into $t2
 
    # Generate LED pattern based on switch value
 
    beq $t2,$t5, switch_0   # Switch 0 pattern
    beq $t2,$t6, switch_1   # Switch 1 pattern
    
 
switch_0:
    li $t3, 0xf  # Pattern for switch 0 (LEDs 0-3 on)
sw $t3, 0($t1)         # Update LEDs with generated pattern
j loop                 # Repeat loop
 
switch_1:
    li $t3, 0b11110000     # Pattern for switch 1 (LEDs 4-7 on)
    sw $t3, 0($t1)         # Update LEDs with generated pattern
j loop                 # Repeat loop
 
The Task:
Write a program in PLP assembly that repeatedly reads the value of the switches (address: 0xf0100000) and
displays a pattern on the LED array based on what switches. Each time the switch value is read, the pattern
should be displayed (regardless of whether the switch value has changed or not since the last time it was read).
The table below indicates the pattern that should be displayed for each possible switch setting:
LED Pattern
Switch
Number
Hexadecimal
Binary
Decimal
Switch Value
Switch Value
Switch Value
0
0х00000001
0600000001
1
Turn on LEDs 0, 1, 2, and 3, then set all 8
LEDs to off
1
0х00000002
abee999919
2
Turn on LEDs 4, 5, 6 and 7, then set all 8
LEDs to off
2
0х00000004
0600000100
4
Create a scrolling pattern that moves
from right to left starting with LED 1 and
skipping every other LED. Only one LED
should be on at any given time (i.e., LED
1, then LED 3, then LED 5, then LED 7)
and the pattern should end with all LEDS
off.
Other
Other
Other
Other
All LEDs off
Transcribed Image Text:The Task: Write a program in PLP assembly that repeatedly reads the value of the switches (address: 0xf0100000) and displays a pattern on the LED array based on what switches. Each time the switch value is read, the pattern should be displayed (regardless of whether the switch value has changed or not since the last time it was read). The table below indicates the pattern that should be displayed for each possible switch setting: LED Pattern Switch Number Hexadecimal Binary Decimal Switch Value Switch Value Switch Value 0 0х00000001 0600000001 1 Turn on LEDs 0, 1, 2, and 3, then set all 8 LEDs to off 1 0х00000002 abee999919 2 Turn on LEDs 4, 5, 6 and 7, then set all 8 LEDs to off 2 0х00000004 0600000100 4 Create a scrolling pattern that moves from right to left starting with LED 1 and skipping every other LED. Only one LED should be on at any given time (i.e., LED 1, then LED 3, then LED 5, then LED 7) and the pattern should end with all LEDS off. Other Other Other Other All LEDs off
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Fundamentals of Computer System
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT