Question: Write this code as MIPS code: MIPS Programming 1 In this project, you are going to write a MIPS program to read an integer number

 Write this code as MIPS code: MIPS Programming 1 In this
project, you are going to write a MIPS program to read an
Write this code as MIPS code:
integer number and convert it to 8- bit signed binary in a

MIPS Programming 1 In this project, you are going to write a MIPS program to read an integer number and convert it to 8- bit signed binary in a string. Your program should do the followings: Part ll (50%, due date: March 1) for negative number o Write a non-leaf function to convert a negative integer number to 2's complement in string Two parameters: integer number, string array or pointer Get absolute value of the negative number Call a function that you implement from part I Flip each binary bit of the string (do 1's complement):O1 . .Add 1 to LSB Repeat adding a carry to higher bit // non-leaf function convert decimal (negative) to 2's complement in s void twosComplement (int num, char strNum(1) int i, absolute, carry absolute abs (num) toBinary (absolute, strNum) call toBinary for absolute value (positive) strNum); printf ("absolute value %s ", = // flip, complement if(strNum [ i ] -= '0') strNum[i-1 else strNum(i]0' printf ("'s complement sIn", strNum) // add1 for (i 7, carry 1: 1 -0&&carry i--) 1it carry is 0, stop!! int sum - (strNum(i-48) +carry // asci 0 is decimal 48, '1' s 49 strNum[i-0'+(sum &0x01): 11 logical and carry (sum 1)&0x01: shift right by 1 bit (divide by 2) logical and printf("2's complement- %s ", strNum)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!