Question: (Please give the answer in MIPS assembly) you are going to write functions to replace 4 existing MIPS instructions. therefore for this assignment, in some

(Please give the answer in MIPS assembly)

you are going to write functions to replace 4 existing MIPS instructions.

therefore for this assignment, in some places, you are not allowed to use the instructions we are replacing

There will be 1 function for each replaced instruction

functions to write

1) wordwise AND of values in registers a0 and a1

2) wordwise OR of values in registers a0 and a1

3) wordwise XOR of values in registers a0 and a1

4) wordwise NOT of value in register a0

in all cases registers a0 and a1 will not be destroyed in the function

and the result will be returned in register v0

The program

ask the user for 2 numbers n1 and n2

output n1 AND n2

in the form

0000 1110 0010 1011 0110 1101 1001 0101

AND 1110 1110 0010 1001 0010 0100 1110 1110

0000 1110 0010 1001 0010 0100 1000 0100

n1 OR n2

n1 XOR n2

in the same form as the output for AND

also not n1 and not n2

in the following form

NOT n1 1111 0001 1101 0100 1001 0010 0110 1010

your function names will be myAND, myOR, myXOR, myNOT

You may use anything we've done in class so far

you may use and, or, xor and not to extract or set bits

your myAND is not to be 1 instruction and a return

example

and $v0,$a0,$a1

jr $ra

same for your other functions

You are not to store any data in memory.

The only data in the .data section of your code allowed is

.asciiz directives

no function is to call another function, since we haven't learned how to do this yet

therefore ther may be some "brute force" needed

sample runs

(Please give the answer in MIPS assembly) you are

(Please give the answer in MIPS assembly) you are

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!