3 is pressed, Modify the code so that the green LED directly above each pushbutton illuminates whenever the particular pushbutton is pressed, and Modify the code so that the counter advances every one second. The program below starts counting from 0 up to 232 – 1, when a pushbutton (except KEY0) is pressed. The count is advanced every one hundredth of a second (1/100 sec) via the use of the internal 50 MHz onboard clock. The count is displayed on the 18 red LEDs, LEDR0-17. ADDR_SSEGNUMS: .word 0x4F5B063F, 0x077D6D66, 0x6F7F .global _start _start: /* initialize base addresses of parallel ports */ movia r18, 0x10000000 /* red LED base address */ movia r19, 0x10000010 /* green LED base address */ movia r20, 0x10000020 /* HEX3_HEX0 base address */ movia r21, 0x10000030 /* HEX4_HEX7 base address */ movia r22, 0x10000050 /* pushbutton KEY base address */ movia r23, 0x10002000 /* interval timer (onboard 50 MHz clock) base address */ movia r17, ADDR_SSEGNUMS movui r10, 10 /* load timer countdown value */ movui r3, 0x0007 /* upper 16-bits of 500000 countdown value */ sthio r3, 12(r23) /* write to timer start value (high) register */ movui r3, 0xA120 /* lower 16-bits of 500000 countdown value */ sthio r3, 8(r23) /* write to timer start value (low) register */ /* start and continue timer countdown with no interrupts */ movui r3, 0x6 /* load timer control valu

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
QUESTION- NIOS 2 ASSEMBLY PROGRAMMING A) Modify the code so that the counter starts counting only when KEY3 is pressed, Modify the code so that the green LED directly above each pushbutton illuminates whenever the particular pushbutton is pressed, and Modify the code so that the counter advances every one second. The program below starts counting from 0 up to 232 – 1, when a pushbutton (except KEY0) is pressed. The count is advanced every one hundredth of a second (1/100 sec) via the use of the internal 50 MHz onboard clock. The count is displayed on the 18 red LEDs, LEDR0-17. ADDR_SSEGNUMS: .word 0x4F5B063F, 0x077D6D66, 0x6F7F .global _start _start: /* initialize base addresses of parallel ports */ movia r18, 0x10000000 /* red LED base address */ movia r19, 0x10000010 /* green LED base address */ movia r20, 0x10000020 /* HEX3_HEX0 base address */ movia r21, 0x10000030 /* HEX4_HEX7 base address */ movia r22, 0x10000050 /* pushbutton KEY base address */ movia r23, 0x10002000 /* interval timer (onboard 50 MHz clock) base address */ movia r17, ADDR_SSEGNUMS movui r10, 10 /* load timer countdown value */ movui r3, 0x0007 /* upper 16-bits of 500000 countdown value */ sthio r3, 12(r23) /* write to timer start value (high) register */ movui r3, 0xA120 /* lower 16-bits of 500000 countdown value */ sthio r3, 8(r23) /* write to timer start value (low) register */ /* start and continue timer countdown with no interrupts */ movui r3, 0x6 /* load timer control value */ sthio r3, 4(r23) /* write to timer control register */ PRESS_A_KEY_TO_START: /* press a pushbutton to start counter */ ldwio r2, 0(r22) /* load input from pushbuttons */ stwio r2, 0(r19) /* write to green LEDs */ beq r2, r0, PRESS_A_KEY_TO_START /* monitor timeout signal to identify when the timer countdown ends (reach 0) */ WAIT_FOR_TO_SIGNAL: ldhio r3, 0(r23) /* load status register */ andi r3, r3, 1 /* load timeout (TO) bit */ beq r3, r0, WAIT_FOR_TO_SIGNAL /* wait until timer timeout (TO is set to 1) */ add r4, r4, r3 /* count number of timeouts */ stwio r4, 0(r18) /* display count of timeouts on LEDR */ stwio r0, 0(r23) /* reset TO bit in status register */ br WAIT_FOR_TO_SIGNAL B) Explain briefly what function is the four lines of code performing, Modify the code so that output displayed on the red LEDs in 2.1 is also displayed on HEX, and Modify the code so that the count advances by one every second starting from 0000 up to 9999. Show the count on four 7-segment displays, HEX0-3. Replace the instruction stwio r4, 0(r18) with the following lines of code and observe what happens on the red LEDs. divu r5, r4, r10 mul r5, r5, r10 sub r5, r4, r5 stwio r5, 0(r18) C) Modify the code to implement the pushbutton controls mentioned above. Use the pushbuttons to add control to the operation of the counter as described below: • KEY3 - This button is used to trigger (start) the counter from an initial state of 0000, resume counting after the counter has been paused and to restart the counter after a reset. • KEY2 - This button is used to stop/pause the counter holding the count currently being displayed. The counter stays paused until either KEY3 is pressed. • KEY1 - This button is used to reset the counter display to 0000. When this button is pressed, your counter is reset to zero, irrespective of its current state, and should hold this zero value until the KEY3 button is pressed.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY