112k views
2 votes
From this, you surmise that ROW and COL must have been compile-time constants. What are their values? (Hint: in order to answer this question, it helps to know how 2-dimensional arrays are stored in memory in row-major order.)

User EL MOJO
by
5.6k points

1 Answer

2 votes

Answer:

The number of ROW or row of the 2-dimensional array is 2

The number of COL or column of the 2-dimensional array is 3

Step-by-step explanation:

The C source code function fetch_aval which is programmed to return an integer value was compiled to the MIPS assemble code;

fetch_aval:

andi $5, $5,0x0007

sll $6,$6,2

sll $2,$5,3

subu $2,$2,$5

sll $2,$2,3

addu $2,$2,$4

addu $6,$6,$2

lw $2,0($6)

j $31

Where the statement "sll $6,$6,2" defines the row length of the array to be 2 (at the end of the statement) and "sll $2,$5,3" gives the column length of 3.

User Hasienda
by
6.0k points