"Write a program in MIPS assembly language which reads two integers a, b,
calculates a^3 + 3ab^2 + 3a^2b + b^3 and outputs the result."

My question is, how do I calculate powers of things in MIPS? Also I think I probably need to simplify that equation first...does anyone know how I should begin?

Recommended Answers

All 6 Replies

code a for loop using jump ,etc .

Sorry i'm an absolute beginner and I've not yet covered loops or jumps, any chance you could expand on that answer?

Just call mul several times in a row.

Thanks, that's what I ended up doing although it was hardly efficient...oh well I'm sure I will learn.

Well, it turns out we're not supposed to learn to do that yet, we were supposed to be learning to use mul so I've done it correctly for this particular piece of coursework. Thanks.

commented: ok :) looks like you're golden then for this one. +22
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.