Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
Write this code as MIPS code:
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions

Question

How do cultural norms shape behaviorpg18

Answered: 1 week ago