Starting from:

$20

Assignment I: MIPS instructions


Programming Assignment I
Problem Statement:

Transform the following code into MIPS instructions. Your programs should run correctly on the QtSPIM simulator. Your submission should include a single *.s file containing the neatly written/organized MIPS code. Important: you should use comments (‘#’ followed by text) in order to make your programs more readable.

A typical palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward. Famous examples include "A man, a plan, a canal, Panama!", "Amor, Roma", "race car", "taco cat”. Following code snippet is a palindrome checker for only positive integer numbers. Examples of palindrome numbers are “123454321”, “464”, “66”.

 

Code Snippet:

int num, reverse = 0, temp;

 

printf("Programming assignment 1 for CDA3101\n");

printf("This palindrome checker only deals with positive integer number.\n");

printf("Enter a number to check if it is a palindrome or not.\n");

scanf("%d",&num);

 

temp = num;

 

while( temp != 0 )

{

        reverse = reverse * 10;

        reverse = reverse + temp%10;

        temp = temp/10;

}

 

if ( num == reverse )

        printf("%d is a palindrome number.\n", num);

else

        printf("%d is not a palindrome number.\n", num);

 

More products