MIPS programming help...powers?

Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2008
Posts: 11
Reputation: cherryduck is an unknown quantity at this point 
Solved Threads: 0
cherryduck cherryduck is offline Offline
Newbie Poster

MIPS programming help...powers?

 
0
  #1
Oct 10th, 2008
"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?
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,852
Reputation: ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all 
Solved Threads: 119
ithelp's Avatar
ithelp ithelp is offline Offline
Posting Virtuoso

Re: MIPS programming help...powers?

 
0
  #2
Oct 10th, 2008
code a for loop using jump ,etc .
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 11
Reputation: cherryduck is an unknown quantity at this point 
Solved Threads: 0
cherryduck cherryduck is offline Offline
Newbie Poster

Re: MIPS programming help...powers?

 
0
  #3
Oct 10th, 2008
Sorry i'm an absolute beginner and I've not yet covered loops or jumps, any chance you could expand on that answer?
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: MIPS programming help...powers?

 
0
  #4
Oct 10th, 2008
Just call mul several times in a row.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 11
Reputation: cherryduck is an unknown quantity at this point 
Solved Threads: 0
cherryduck cherryduck is offline Offline
Newbie Poster

Re: MIPS programming help...powers?

 
0
  #5
Oct 14th, 2008
Originally Posted by Salem View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: MIPS programming help...powers?

 
0
  #6
Oct 14th, 2008
So keep reading and figure out how to make a function out of it then.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 11
Reputation: cherryduck is an unknown quantity at this point 
Solved Threads: 0
cherryduck cherryduck is offline Offline
Newbie Poster

Re: MIPS programming help...powers?

 
1
  #7
Oct 14th, 2008
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Assembly Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC