Convert two c code functions to mips. bool board_done(int board[GRID_SQUARED][GR
ID: 3591518 • Letter: C
Question
Convert two c code functions to mips.
bool
board_done(int board[GRID_SQUARED][GRID_SQUARED]) {
for (int i = 0 ; i < GRID_SQUARED ; ++ i) {
for (int j = 0 ; j < GRID_SQUARED ; ++ j) {
if (!singleton(board[i][j])) {
return false;
}
}
}
return true;
}
void
print_board(int board[GRID_SQUARED][GRID_SQUARED]) {
for (int i = 0 ; i < GRID_SQUARED ; ++ i) {
for (int j = 0 ; j < GRID_SQUARED ; ++ j) {
int value = board[i][j];
char c = '*';
if (singleton(value)) {
c = get_singleton(value) + '1';
}
printf("%c", c);
}
printf(" ");
}
}
Explanation / Answer
MIPS Code for board_done function:
MIPS Code for print_board function: