MIPs code (procedure calls)

Q.1 I'm suppose to write a MIPs code for the following procedure code but I'm confused about the fact that this function has 6 arguments while only 4 registers $a0 -$a3 are said to hold arguments ? Can I simply use $t0 etc to store the arguments?

Int array (int a, int b, int c, int i, int g, int j)
Int f;
a[i] = b[10] + c[j];
f = g + a[i];
return f;


Q.2 The following C code allocates three fields with a word labeled receiver: a 1-bit field
named ready, a 1-bit field named enable, and an 8-bit field named receivedByte. It copies
receivedByte into data, sets ready to 0, and sets enable to 1.
int data;
struct
{
unsigned int ready: 1;
unsigned int enable: 1;
unsigned int receivedByte: 8;
} receiver;
...
data = receiver.receivedByte;
receiver.ready = 0;
receiver.enable = 1;

What is the compiled MIPS code? Assume data and receiver are allocated to $s0 and $s1.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories