程序代写代做 assembly C arm [25 marks] 2. This question is about assembly-language code and interrupts. Note: Different from Question 1, you will submit individual files for each part of this question, to separate Quercus assignments, which are labelled Question 2a, Question 2b, and Question 2c.

[25 marks] 2. This question is about assembly-language code and interrupts. Note: Different from Question 1, you will submit individual files for each part of this question, to separate Quercus assignments, which are labelled Question 2a, Question 2b, and Question 2c.
Note: A short video demonstration of a complete solution for all parts of this question can be found at https://youtu.be/jPMutBfX19o
[8 marks] (a) You are to write an assembly-language program that works as follows: it reads the SW switch port and lights up a seven-segment display corresponding to the value read on SW20. For example, if SW20 = 000, then the digit 0 is shown on HEX0. If SW20 = 001, then the digit 1 is displayed on HEX1, and so on, up to the digit 5 which would be shown on HEX5 if SW20 = 101. Once a digit has been displayed, it should remain displayed even if SW is subsequently changed.
Recall that the seven-segments displays are connected to the two registers:
􏰱􏰲􏰲􏰳􏰴􏰵􏰵 􏰤􏰥􏰦􏰦􏰧􏰤􏰤􏰤􏰧􏰤
􏰤􏰥􏰦􏰦􏰧􏰤􏰤􏰤􏰰􏰤
􏰰􏰯􏰰􏰤 􏰧􏰹 􏰧􏰰􏰧􏰧 􏰯􏰭 􏰯􏰸􏰯􏰹 􏰷 􏰶 􏰭 􏰤
􏰩􏰩􏰩 􏰩􏰩􏰩 􏰩􏰩􏰩 􏰩􏰩􏰩
􏰪􏰫􏰬􏰰􏰭􏰮􏰤 􏰪􏰫􏰬􏰧􏰭􏰮􏰤 􏰪􏰫􏰬􏰯􏰭􏰮􏰤 􏰪􏰫􏰬􏰤􏰭􏰮􏰤
􏰰􏰯􏰰􏰤 􏰧􏰹 􏰧􏰰􏰧􏰧 􏰯􏰭 􏰯􏰸􏰯􏰹 􏰷 􏰶 􏰭 􏰤
􏰺􏰻􏰼􏰻 􏰳􏰴􏰽􏰾􏰵􏰼􏰴􏰳
􏰺􏰻􏰼􏰻 􏰳􏰴􏰽􏰾􏰵􏰼􏰴􏰳
􏰿􏰴􏰽􏱀􏰴􏱁􏰼􏰵
􏰤 􏰸􏰯
􏰹􏰧 􏰰
􏰭
􏱂􏱁􏱃􏰵􏰴􏰲
􏰩􏰩􏰩 􏰩􏰩􏰩
􏰪􏰫􏰬􏰸􏰭􏰮􏰤 􏰪􏰫􏰬􏰹􏰭􏰮􏰤
Also recall from the lab exercises in this course that you cannot perform store operations to individual bytes in these registers—you can only store 32-bit words. Hence, the code for your solution to this question can use STR instructions to write to the HEX display ports, but cannot use STRB to write to these ports.
Write your code in a file named Q2a.s and submit this file to the Quercus assignment labelled Question 2a.
[11 marks] (b) For this part you are to write an assembly-language program that flashes LEDR0 on and off ev- ery 0.5 seconds. Your code should have a main program that writes to the LEDR port and your program should use interrupts to implement the required 0.5 second time intervals. To create in- terrupts every 0.5 seconds use the A9 Private Timer, which has a base address of 0xFFFEC600. This timer is described in Section 2.4.1 of the DE1-SoC Computer documentation, which can be found on the Quercus home page for this course, by following the link Laboratory Exercises and then ARM Materials. Use this timer to make a delay of 0.25 seconds.
Page 6 of 14

[6 marks]
To configure the ARM processor’s generic interrupt controller (GIC) use the code that was pro- vided along with Lab Exercise 6.
Write the code for this part in a file named Q2b.s and submit this file to the Quercus assignment labelled Question 2b.
(c) For this part you are to augment your program from part (a) to add the following functionality: When the SW switches are set to select a particular digit (from 0 to 5), you are to flash this digit on and off every 0.5 seconds. Implement the required 0.5 second time intervals using interrupts from the same timer that you used in part (b) of this question.
Important: once a digit has been selected once, it must remain displayed even if SW has been subsequently changed.
Also Important: only the digit that is currently selected by SW is allowed to flash on/off. Marks will be deducted if multiple digits flash on/off.
Write the code for this part in a file named Q2c.s and submit this file to the Quercus assignment labelled Question 2c.
Page 7 of 14

[25 marks]
[5 marks]
[6 marks]
3.
This question is about C code. In this question you will submit individual files for each part of this question, to separate Quercus assignments, which are labelled Question 3a, Question 3b, Question 3c and Question 3d.
Note: A short demonstration of a working solution for all parts of this question can be found at https://youtu.be/Mofcc8QAbMY.
(a) For this part you are to write a C program that displays the characters ECE243 on the hex- adecimal displays HEX5 – HEX0. The message should flash on/off at a rate of approximately 0.5 seconds. Implement the required delay between showing, and blanking the characters in the display by using a software delay loop – do not use a hardware timer for this part of the ques- tion. Write the code for this part in a file named Q3a.c and submit it to the Quercus assignment labelled Question 3a.
(b) For this part you are to write a C program that turns on one light at a time on the LEDR port. You should start by lighting up only LEDR0, then only LEDR1, then only LEDR2, and so on, to LEDR9, and then returning back to LEDR0. The effect created by your program should be that a light appears to scroll across the LEDR port.
The speed at which the lights are scrolled should be controlled by using the Interval Timer in the DE1-SoC Computer. This timer has the base address 0xFF202000 and is described in Section 2.11 of the DE1-SoC Computer documentation. Use this timer to make a delay of 0.25 seconds. Use polled-I/O to wait for the timer to expire—do not use interrupts!
You should be able to control the direction in which the lights are scrolled by using the KEY port. Each time any KEY is pressed and released, the direction of scrolling should be reversed. Write the code for this part in a file named Q3b.c and submit this file to the Quercus assignment labelled Question 3b.
(c) For this part you are to create a scrolling message on the seven-segment displays HEX5 – HEX0. Your C program should display the message U of t ECE-243 and should scroll the message in the right-to-left direction across the displays. The letters in the message can be constructed as
Control the speed of scrolling by using the same timer as in part (b), with a timer delay of 0.5 seconds. Use polled-I/O; do not use interrupts. You should be able to control the displays using the KEY port. When the message is currently scrolling, then pressing and releasing any KEY should stop the scrolling so that the HEX displays are static. Now pressing and releasing any KEY should restart the scrolling, etc.
Write the code for this part in a file named Q3c.c and submit this file to the Quercus assignment labelled Question 3c.
(d) For this part you are to augment your solution from part (c) to provide additional features using the pushbutton KEYs, as follows: KEY0 should start/stop the scrolling (as was done for any KEY in part (c)), KEY1 should double the scrolling speed, KEY2 should halve the scrolling speed, and KEY3 should reverse the direction of scrolling.
Write the code for this part in a file named Q3d.c and submit this file to the Quercus assignment labelled Question 3d.
Page 8 of 14
[8 marks]
[6 marks]