Introduction to Computer Architecture Building Functions
For this assignment, you will need to write a set of five functions. The first two functions are min
and max functions for integers. You should compare the parameters and return the smallest or largest
value respectively. The third function is a double function. It doubles the value of an integer if the result
fits inside a 32-bit register. If the result is too large or too small, then it returns 0. The last two functions
take an ASCII character and either change it to uppercase or lowercase when applicable. If the parameter
is not a valid ASCII character (you don’t need to consider extended ASCII characters either), then they
should return -1 to represent an error. If the character is not a letter, then it should just be returned as is.
You will want to refer to an ASCII table for the form of ASCII characters and which ones are valid.
You should not need to modify the test suite. You only need to write the functions. Since QT SPIM
expects all of your code to be in a single file, you can concatenate them together in a few ways. If you are
on Windows, you can use the included batch file to do the work for you. Simply dragging your source file
and dropping it on the batch file should be sufficient. If you are having trouble with the batch file, make
sure that your file names match those below. You can also use a command line operation.
Windows: copy /Y “
Unix: cat “
Your program should include appropriate comments indicating what the code should be doing and
what registers are being used for. After displaying the results, your program should exit cleanly. You should
test your programs using the SPIM simulator to ensure their functionality before submitting them. You
should only submit your five functions. You will not receive credit if you submit the test suite in any form.
You should also not include any driver or debug code in your submission.
Objectives:
1. To introduce and practice writing functions in the MIPS assembly language.
2. To introduce and practice validating parameters.
Introduction to Computer Architecture Building Functions
Expected output:
##————————Testing the Minimum Function————————##
Test #1 passed: Testing min(1, 2).
Test #2 passed: Testing min(2, 1).
Test #3 passed: Testing min(1, 1).
Test #4 passed: Testing min(-1, 1).
Test #5 passed: Testing min(1, -1).
##————————Testing the Maximum Function————————##
Test #1 passed: Testing max(1, 2).
Test #2 passed: Testing max(2, 1).
Test #3 passed: Testing max(1, 1).
Test #4 passed: Testing max(-1, 1).
Test #5 passed: Testing max(1, -1).
##————————Testing the Double Function————————-##
Test #1 passed: Testing double(1) = 2.
Test #2 passed: Testing double(12345) = 24690.
Test #3 passed: Testing double(-12345) = -24690.
Test #4 passed: Testing double(0x3FFFFFFF) = 0x7FFFFFFE.
Test #5 passed: Testing double(0xC0000000) = 0x80000000.
Test #6 passed: Testing double(0x40000000) produces overflow.
Test #7 passed: Testing double(0xBFFFFFFF) produces overflow.
Test #8 passed: Testing double(0x66666666) produces overflow.
Test #9 passed: Testing double(0xAAAAAAAA) produces overflow.
##———————–Testing the Uppercase Function———————–##
Test #1 passed: Testing uppercase(a) = A.
Test #2 passed: Testing uppercase(q) = Q.
Test #3 passed: Testing uppercase(z) = Z.
Test #4 passed: Testing uppercase(A) = A.
Test #5 passed: Testing uppercase(M) = M.
Test #6 passed: Testing uppercase(Z) = Z.
Test #7 passed: Testing uppercase(#) = #.
Test #8 passed: Testing uppercase(@) = @.
Test #9 passed: Testing uppercase(^) = ^.
Test #10 passed: Testing uppercase({) = {.
Test #11 passed: Testing uppercase(128) produces an error.
Test #12 passed: Testing uppercase(255) produces an error.
Test #13 passed: Testing uppercase(255) produces an error.
Test #14 passed: Testing uppercase(-5) produces an error.
##———————–Testing the Lowercase Function———————–##
Test #1 passed: Testing lowercase(A) = a.
Test #2 passed: Testing lowercase(M) = m.
Test #3 passed: Testing lowercase(Z) = z.
Test #4 passed: Testing lowercase(a) = a.
Test #5 passed: Testing lowercase(q) = q.
Test #6 passed: Testing lowercase(z) = z.
Test #7 passed: Testing lowercase(#) = #.
Test #8 passed: Testing lowercase(@) = @.
Test #9 passed: Testing lowercase(^) = ^.
Test #10 passed: Testing lowercase({) = {.
Test #11 passed: Testing lowercase(128) produces an error.
Test #12 passed: Testing lowercase(255) produces an error.
Test #13 passed: Testing lowercase(-1) produces an error.
Test #14 passed: Testing lowercase(-5) produces an error.
##—————————–Testing completed.—————————–##