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
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
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
Knowledge Booster
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.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education