Maddox Smith Staff asked 4 years ago

MIPS Programming

Hi, Assignment : This lab is to utilize the keyboard as a memory mapped I/O device which causes interrupts to be issued when a key is pressed. Memory mapped I/O is a basic concept within I/O systems of computers. Interrupts allow for asynchronous operations of various computer components. They allow the processor to be executing a task while no I/O is available, but minimize the latency of the computer’s response to an I/O request. You need to read the corresponding materials on “ Exceptions and Interrupts ” and “ Input and Output ” to work on this problem (refer to Appendix A7 and A8). You may use IOmap.s or the examples in A7 as the starting point to write your own MIPS assembly language program. ! 1) Your program should go into an infinite loop by running Fibonacci number function and generate the Fibonacci sequence (0, 1, 1, 2, 3, 5, 8, 13…). If an overflow occurs, the sequence will start all over again from 0. 2) During generating the Fibonacci sequence, you should check to see if a character has been received in from input. Your program should contain an interrupt service routine such that while generating the sequence, the user is able to optionally enter or not enter a character. Depending upon the character input, your program should do the following: • On receipt of a “p” or “P” your program should print out to the console the current Fibonacci sequence and reset the sequence generation. • On receipt of an “r” or “R” your program should print out the current Fibonacci sequence in the reversed order and reset the sequence generation. • On receipt of a “q” or “Q” your program should terminate gracefully, meaning from the main procedure after correctly returning from all currently invoked procedures. • Your program should ignore any other input from the keyboard. 3) Your program should use subroutines to implement the in order printing and the reverse printing respectively. ! In order to perform these tasks, as well as accept input via an interrupt service routine your program must contain code which initializes the Interrupt handling. Primarily this implies enabling the keyboard interrupt in both the Status register of the MIPS processor, and in the Receiver Control Register. Additionally you must of course define an Interrupt Service routine, and the Interrupt Service routine must have a set of memory locations available to communicate back and forth with the main program. Tools to be used: QTspim I have already have the code as uploaded. My requirement is to replace the syscall to print the terms with interrupts code as referenced syscall used in newfibonacci file must be replaced by the interrupt routines to print as used in lab2.s To be more precise, In newFibonacci file, printing output to the console and reading input from the console is done using syscall In lab2.s the same input reading and output printing is done using interrupts   Requirement: Replace the syscall in newfibonacci with interrupts code as shown in lab2.s   Tools to be used : qtspim in Qtspim, go to settings and enable memory-mapped i/o