CS201 Lab: Arithmetic Operations and Debugging
Objective of this lab:
To investigate Arithmetic Operations and implement them in Spim.
Preparation
Read lab lecture notes.
Lab Assignment
Please note:
To make it easier for marking, you are required to submit
one .pdf file and all the .s files.
The .pdf file will contain all the required components for the lab assignment.
This will apply to Lab #7 to Lab #10.
Program#1:
Write a SPIM assembly language program convertF2C.s.
The program will do the following:
- Prompt the user to enter a temperature in Fahrenheit
- Convert it to Celsius
- Print out the converted values of the input 100, 0, and 70 with appropriate message
Here are the two formulas for your reference.
F = (9 * C / 5) + 32
C = 5 * (F - 32) / 9
Program#2:
Write a SPIM assembly language program equation.s based on the example
program math1.s in the lab notes.
The program will do the following:
- Prompt the user to enter a value for X
- Calculate the result of A*X^2+B*X+C, keep A, B and C values the same as before.
- Print out the calculated results of the input value 7, 5, and 9 with appropriate message
You will hand in the following:
- The source code in the file convertF2C.s and equation.s
- The screenshot to show the screen right after you loaded the .s file.
- The screenshot of the console displaying the results
Copyright: Department of Computer Science, University of Regina.