COSC 065 Hardware Systems

Fall 2008

Homework Assignment #6

Medium MIPS Assembly Language

Due: Friday, Oct 24, 11:59PM CDT

Submit: Turn in your source files using the turnin command on Morbius. Please name your files "main-q1.S", "main-q2.S", and "main-q3.S". Failure to follow this simple convention may significantly delay grading of your assignment.

Work may be completed in teams of two. The names of both partners must appear in a comment block at the top of your file for credit to be given. I strongly recommend that you take the time to meet with your partner in person and work together on these projects, rather than work separately and try to integrate at the last minute.

Background

Take time to familiarize yourself with the UNIX environment, using the tutorial here.

Always start your MIPS programming assignments using the MIPS Playground tarball. Download the tarball, and open it in your working directory using the UNIX command "tar xvzf xinu-cosc065.tgz". The file main.S is ready for you to begin programming in MIPS assembly language.

Your work must be compiled on a machine with the proper tools, such as the dual-head Linux boxen in the Systems Lab (CU 310). Consult the professor for advice on connecting remotely if the lab is full or you must work from elsewhere.

In order to assemble your program, use the command "make". In order to run your program, use the command "./mipcon". At any time, you can shutdown the MIPS remote console system by hitting Ctrl-Space, followed by the letter 'q', for 'quit'.

Few rules govern the format of assembly language programs. Make an effort to keep your programs readable and well-documented; sometimes the professor gives partial credit if he can tell what you were trying to do, even if it doesn't quite make it.

Q1 -Calculator

Write an assembler program that reads in arithmetic operators ("+", "-", "*", "/" and "%") and pairs of integers and returns the result of applying the operators. Continue looping until the end of file marker is reached, as discussed in class.

The professor has provided an example program for your reference, runnable on Morbius as ~brylow/cosc065/bin/hw6-calc.

You may assume that overflow and underflow do NOT occur.

Q2 - Kelvin Table

Write an assembler program that reads two positive integers, low and high, and prints a table of conversions from temperature degrees Kelvin to degrees Celsius and degrees Fahrenheit every five degrees Kelvin from low to high.

The professor has provided an example program for your reference, runnable on Morbius as ~brylow/cosc065/bin/hw6-kelvin.

Use the operating system's kprintf() function to format your output.

Q3 - GCD

Write an assembler program that reads two positive integers, x and y, and prints the greatest common divisor of x and y. Continue looping until the end of file marker is reached, as discussed in class.

The professor has provided an example program for your reference, runnable on Morbius as ~brylow/cosc065/bin/hw6-gcd.

You may assume that overflow and underflow do NOT occur.


Back
[Revised 2008 Oct 19 20:58 DWB]