COSC 065 Hardware Systems

Fall 2007

Homework Assignment #4

Basic MIPS Assembly Language
Due: Friday, Oct 12, 2:00PM CDT
Submit: E-mail electronic copy to professor, with a subject header "COSC 065 HW#4".
Work may be completed in pairs. Each team should submit only once. Be certain to put both team member names on work submitted. It would be courteous to carbon-copy your partner when e-mailing the final submission.

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 - Stats

Write an assembler program that reads in integers from the user until a zero is entered. Print the total, the average (total divided by number of items, truncated to an integer), the highest integer seen, and the lowest integer seen.

Example:
? 3
? 4
? 5
? 0
12
4
5
3

You may assume that overflow and underflow do NOT occur.

Q2 - Exponent

Write an assembler program that reads two positive integers, x and y, and prints x to the y power. Your program should continue asking for integers until it has gotten two positive numbers.

Example:
? 2
? 30
1073741824

You may assume that overflow and underflow do NOT occur.

Q3 - Celsius to Fahrenheit

Write an assembler program that reads a positive integer, and converts that integers from a temperature on the Celsius scale to a temperature on the Fahrenheit scale. You need only use integer precision for the conversion.

Example:
? 100
212

You may assume that overflow and underflow do NOT occur.


Back
[Revised 2007 Oct 04 12:24 DWB]