CS 2734 Computer Organization II

Laboratory 4

Laboratory 4 will meet in the Sun lab Laboratory 4 involves writing simple functions in Sparc assembly language. Each function takes parameters passed in registers, performs an arithmetic computation involving addition, subtraction, multiplication, and division. The function returns its value in register i0.

You will meet in 3.02.04SB for both laboratory 4a (9/18/96) and laboratory 4b (9/23/96). During both sessions, 10 workstations will be reserved for checkoff only. Do not log into these workstations unless you are ready to be checked off or everyone who is ready to be checked off has been checked off. You must log off of these workstations after being checked off so that others can have a chance.

To prepare for this laboratory, write the following functions in Sparc assembly language:

In problem 1 assume that x is passed in i0, y is passed in i1, and z is passed in i2. Make a similiar assumption for problem 2.

The functions return their values in i0. Assume all variables are integers. Write two short C programs to test each of these functions. Pass the three parameter values as command line arguments to the C function. Use a makefile.

To get checked off you must turn in a copy of the source files including your makefile. You will be asked to run your test programs for a specified set of values during the laboratory check-off period.