Question

Please write a simple code in mars.mips 4.5 with simple mips commands a beginner would use...

Please write a simple code in mars.mips 4.5 with simple mips commands a beginner would use

Please make sure it works and goes through each step without crashing or dropping out from the bottom, thanks <3

#comments would really help

please read the text below carefully and answer it correctly

2. Write a MIPS assembly language version of the following C code segment:

int A[75], B[75];

for (i = 1; i < 73; i ++)

{ C[i] = (A[i + 1] + A[i]) * (B[i + 2] - A[i-1]); }

Arrays A, B and C start at memory location A000hex, B000hex and C000hex respectively. Try to reduce the total number of instructions and the number of expensive instructions such as multiplies.

0 0
Add a comment Improve this question Transcribed image text
Answer #1


.file 1 ""

.section .mdebug.abi32

.previous

.nan legacy

.module fp=32

.module nooddspreg

.abicalls

.text

.align 2

.global main

.set nomips16

.set nomicromips

.ent main

.type main, @function

main:

.frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, gp= 0

.mask 0x00000000,0

.fmask 0x00000000,0

.set noreorder

.set nomacro

li $2,72 # 0x48

addiu $2,$2,-1

$L4: bne $2,$0,$L4

addiu $2,$2,-1

j $31

addiu $2,$2,1

.set macro

.set reorder

.end main

.size main, .-main

.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609"

Add a comment
Know the answer?
Add Answer to:
Please write a simple code in mars.mips 4.5 with simple mips commands a beginner would use...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT