MIPS Assembly Programming - Homework #4 | CDA 3100, Assignments of Electrical and Electronics Engineering

Material Type: Assignment; Professor: Zhang; Class: COMPUTER ORG I; Subject: COMPUTER DESIGN/ARCHITECTURE; University: Florida State University; Term: Spring 2009;

Typology: Assignments

Pre 2010

Uploaded on 08/31/2009

koofers-user-ebr
koofers-user-ebr 🇺🇸

7 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Homework Assignment #4 – MIPS Assembly Programming
CDA 3100, Computer Organization I, Spring 2009
Due: Midnight, March 6, 2009
Submission: Email the code to the TA and the instructor.
The purpose of this assignment is to practice the implementation of a typical embedded
controller.
¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
In this assignment, you are asked to implement a simple TV controller. It accepts simple commands like
vol+/-, channel +/-, channel digit input (0-9), sleep timer, and power on/off.
Power key: ‘p’ on the keyboard
Channel +/- : ‘u’ as + and ‘d’ as –
Vol +/- : ‘l’ as + and ‘k’ as –
Digit input: 0-9
Sleep timer: ‘s’
View history: ‘v’
The specifications are:
1. When there is no input, roughly every 3 seconds, print out the current state of the TV, including:
Current second, Power On (of Off), Channel (current channel watching), volume (current
volume), Sleep timer remaining. For example, “100 sec -- Power On! Channel 10, Volume 30,
sleep timer 120.” If power is off, only output “100 sec -- Power off!”
2. Power key. When power key is pressed, if the power is currently off, turn on the TV immediately
by printing “Power On!” When power key is pressed, if the power is currently on, turn off the TV
immediately by printing “Power Off!”
3. Channel +/-.Once pressed, change the current watching channel accordingly within a range of 0-
99 and print out, for example, “Channel 30.”
4. Volume +/-.Once pressed, change the volume accordingly within a range of 0-99 and print out,
for example, “Volume 30.”
pf2

Partial preview of the text

Download MIPS Assembly Programming - Homework #4 | CDA 3100 and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

Homework Assignment #4 – MIPS Assembly Programming

CDA 3100, Computer Organization I, Spring 2009 Due: Midnight, March 6, 2009 Submission: Email the code to the TA and the instructor.

The purpose of this assignment is to practice the implementation of a typical embedded

controller.

In this assignment, you are asked to implement a simple TV controller. It accepts simple commands like vol+/-, channel +/-, channel digit input (0-9), sleep timer, and power on/off.

  • Power key: ‘p’ on the keyboard
  • Channel +/- : ‘u’ as + and ‘d’ as –
  • Vol +/- : ‘l’ as + and ‘k’ as –
  • Digit input: 0-
  • Sleep timer: ‘s’
  • View history: ‘v’ The specifications are:
  1. When there is no input, roughly every 3 seconds, print out the current state of the TV, including: Current second, Power On (of Off), Channel (current channel watching), volume (current volume), Sleep timer remaining. For example, “100 sec -- Power On! Channel 10, Volume 30, sleep timer 120.” If power is off, only output “100 sec -- Power off!”
  2. Power key. When power key is pressed, if the power is currently off, turn on the TV immediately by printing “Power On!” When power key is pressed, if the power is currently on, turn off the TV immediately by printing “Power Off!”
  3. Channel +/-.Once pressed, change the current watching channel accordingly within a range of 0- 99 and print out, for example, “Channel 30.”
  4. Volume +/-.Once pressed, change the volume accordingly within a range of 0-99 and print out, for example, “Volume 30.”
  1. Sleep timer. When hitting the sleep timer key, at the first time, do not change the status of the sleep timer and just show the current status. If the sleep timer key is pressed again within 3 seconds, then starts to modify the status of the sleep timer. That is, if the sleep timer is off, set the sleep timer to be 5 sec. If the sleep timer is on, increment the sleep timer by 5 sec. If the sleep timer exceeds 200 sec after the increment, set the sleep timer to be off. If the sleep timer is on, it decrements by 1 every second. Once it becomes 0, turn the TV off immediately and print out “Power off due to sleep timer!”
  2. Digit input. Once a digit key is pressed, print out the intended channel immediately. For example, 1’ is pressed, print out “Channel 1-” immediately. The controller should be expecting another digit input for another 2 seconds. If any other key is pressed during these two seconds, abort the digit input. For example, if1’ is pressed at 1000 second and channel +’ is pressed at 1001 second, the controller should perform the channel + function and “forget” about the digit input. If no other key is pressed during the two seconds, the controller switches to channel 1. If another digit key is pressed within the two seconds, for example,2’ is pressed, the controller switches to channel 12 immediately.
  3. The “View history” key. When pressed, print out the most watched 5 channels in a descending order. The channel is ordered according to the total amount of seconds this channel is watched since the TV is turned on. The time must be stored as single precision floating number.
  4. When the power is off, the controller responds to no key input except the Power key.
  5. Pay attention when the sleep timer turns off the TV when the controller is expecting the second digit input. The controller should abort the digit input. Okay, these are the basic requirements. Use the code developed during Monday’s class as a frame work to implement your code. Extra requirements to earn extra credits:
  6. The “Go-back” key (the `b’ key on the keyboard). When pressed, the TV should automatically switch back to current channel after 10 seconds. That is, if you pressed the “Go-back” key when watching channel 10 at time 1000 sec, at time 1010 sec, the TV should automatically go back to channel 10, regardless of what channel you are in.
  7. Use the interrupt to implement the keyboard input function. Basically, you may use the interrupt to capture the input key value and write it to a register only for this purpose. This register should be initialized with some impossible value such as 100000. You main loop should be constantly checking this register, and if it is storing some value that is within 0-256, it means that the interrupt has written a value to it. The main loop should then reset it to be the impossible value. Correctly implementing each of these extras can earn extra 0.5 point toward the course grade.