

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Lab; Subject: COMPUTER SCIENCE; University: Texas A&M University; Term: Unknown 1989;
Typology: Lab Reports
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Computer Architecture CPSC 321, Fall Semester 2004 Lab Assignment # Due: One week after your lab session – Complete by yourself.
This lab assignment will make you familiar with number conversions, such as decimal to hexadecimal. A small matrix multiplication routine allows you to become familiar with the equivalent of two-dimensional arrays in MIPS assembly language. The third problem is designed to reinforce your under- standing of these conventions.
[Base conversion - 40 points] For this part of the assignment, you are required to write a MIPS assembly program to convert an unsigned integer u in base b into its base d equivalent.
The following are the tasks to complete this part:
Example.
Input base: 12 Input number in base 12: 12ab Convert to base? 16 Base 16 equivalent: ...
Assume that all inputs are well-formed, i.e. all numbers are within their legal ranges.
[Array Multiplication - 40 points] Write a MIPS assembly program to multiply two 3x3 matrices, A and B, and store the result into a matrix C.
Note: Memory for the matrices should be defined statically in the .data section of your code and the data should be stored in a row major format, i.e. the matrix (^)
a 00 a 01 a 02 a 10 a 11 a 12 a 20 a 21 a 22
is stored as the sequence (a 00 , a 01 , a 02 , a 10 , a 11 , a 12 , a 20 , a 21 , a 22 ).
The following are the tasks to complete this part:
[Function calls/register convention - 20 points] Implement the following C program fragment in MIPS assembly lan- guage, and run it on SPIM.
int S, A, B, C, D;
/* Function f(a, b, c, d) / int f( int a, int b, int c, int d ) { int S; S = sum(diff(a,b),diff(c,d)); /a - b + c - d;*/ return ( S ); }
/* sum fn */ int sum( int a, int b) { int s; s = a + b; return s; }
/* diff fn */ int diff( int a, int b)