-5

I need this translated into MIPS Assembly (to work on Mars Assembler)

void mm ( double x[][], double y[][], double z[][], int n)
{
    int i,j;
    for (i=0; i !=n; i++)
        for (j=0; j !=n; j++)
            z[i][j] = 0.0;
    for (k=0; k !=n; k++)
        z[i][j] = z[i][j] + x[i][k] * y[k][j];
}
trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • 10
    Why don't you use a compiler? – sinelaw Apr 25 '12 at 13:21
  • 2
    The first set of loops is trivial to implement. The second loop requires some floating point architecture knowledge. You can find help with both in this [lovely PDF](http://www.eit.lth.se/fileadmin/eit/courses/edi021/datablad/Processors/MIPS_Soft.pdf). We're going to need to see some work on your part towards solving this problem. – user7116 Apr 25 '12 at 13:32
  • Would you like fries with that? – Tim Post Apr 25 '12 at 14:15
  • Duplicate of un-answered [Tweak mips-gcc output to work with MARS](https://stackoverflow.com/q/13052444). Related: an answer on [Is there a way to use gcc to convert C to MIPS?](https://stackoverflow.com/a/63386888) covers some basics – Peter Cordes Aug 19 '20 at 07:09

1 Answers1

5

This seems a little bit like a "Do My Homework" question, but i'll give you a hint.

Passing the -S switch to gcc will cause it to emit assembly code. Note, this code may need to be tweaked for the mars assembler.

Good luck!

user7116
  • 63,008
  • 17
  • 141
  • 172
Woodrow Douglass
  • 2,605
  • 3
  • 25
  • 41