You are on page 1of 2

HW 2

1 (2.1.1) a. f=g+h+i+j;

b. f=g+(h+5);

For the C statements above, what is the corresponding MIPS assembly code? Use a minimal number of
MIPS assembly instructions

2. (2.4.1) a. f=g+h+B[4];

b. f=g-a[b[4]];

For the C statements above, what is the corresponding MIPS assembly code? Use the minimum number
of instructions and registers

3. (2.18)

b. while(a<10){

d[a]=b+a;

d+=1;

For the C statements above, what is the corresponding MIPS assembly code? Use the minimum number
of instructions and registers
4. (2.19.1) Assume the first function listed in the table is called first. Translate the routines to C

b. int fib_iter(int a, int b, int n){

if(n==0)

return b;

else

return fib_iter(a+b, a, n-1);

5. Follow the tutorial to create an ALU using xilinx (the tutorial is posted in angel) Print and turn in the
resulting waveform

You might also like