This is last minute change of plans for the labs. We are going to do a few little array computations today to make sure you have everything ready for the upcoming homework assignment.
You should work by yourself today. Hopefully you will breeze through this one and will have time to shorten the wires on the breadboard you created in the Power Management lab.
Downloading a starter project
containing a compressed MPLAB X
You should be able to expand it from the browser.
Be sure to store it in your MPLABXProjects
It might also be useful to bring up the Arrays with the MIPS32 Assembly lab in another browser window to jog your memory about UART simulation and MIPS32 arrays.
Looking at the code
Take a look at the following files within the project.
- tester.c —
mainfunction for the project. Does little more than call
testArrayFunctionswith the address of functions to be tested.
- misc.c —
testArraysFunctionsfunction which calls two functions, passed as parameters, and see if they perform the same results.
- testFunctionsInC.c — Four C array functions which you will implement in MIPS32 assembly language.
- tester.h — An include file with prototypes for all the functions.
- The .s files — These are outlines for your assembly code.
Note the header for the
in misc.c . This is how you
declare function prototype. The physicists using C (and FORTRAN)
love to pass functions to functions.
void testArrayFunctions( int32_t (*f1)(int32_t *, int32_t), int32_t (*f2)(int32_t *, int32_t), int32_t size)
Even stranger is the prototype for
in tester.h . It doesn’t contain
parameter names. No other programming language has a
void testArrayFunctions( int32_t (*)(int32_t *, int32_t), int32_t (*)(int32_t *, int32_t), int32_t) ;
By the way, most programmers would include the names.
Your task for today
First, comment out the
comment in the
This will cause your program to use the MIPS32 assembly routines rather than
their C equivalents.
// #define BORINGTEST 1 #define EXCITINGTEST 1
Debug your project. You should now have lots of errors for the Exciting tests.
One at a time, fix all of the four MIPS32 routines.