C++ code to MIPS code (assembly)

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2007
Posts: 2
Reputation: boja123 is an unknown quantity at this point 
Solved Threads: 0
boja123 boja123 is offline Offline
Newbie Poster

C++ code to MIPS code (assembly)

 
0
  #1
Sep 13th, 2007
Hi all, I have given this program to convert it to MIPS code in SPIM and print anapshot of the registers and the results
. and then assemble the MIPS instructions to machine code writing the out put in HEX format
thank you for help

//this program compile with C++
  1. #define N10
  2. main()
  3. {
  4. int i;
  5. int array[N]={2.4,7,8,14,5,13 ,23};
  6. int accumulate =0;
  7. for(i=N-1;i>=0;i--
  8. {
  9. accumulate += array[i];
  10. }
  11. cout<<"the result is"<<accumulate<<endl;
  12. }
Last edited by Ancient Dragon; Sep 13th, 2007 at 12:36 am. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,362
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1464
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: C++ code to MIPS code (assembly)

 
0
  #2
Sep 13th, 2007
If you use a compiler such as VC++ 2005 (Pro edition) or eVC++ 2.0, or eVC++ 3.0, or eVC++ 4.0 you can have it generate the MIPS assembly code.

>>and print anapshot of the registers and the results
Not sure how to do that because the value of the registers change on every instruction executed.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 2
Reputation: boja123 is an unknown quantity at this point 
Solved Threads: 0
boja123 boja123 is offline Offline
Newbie Poster

Re: C++ code to MIPS code (assembly)

 
0
  #3
Sep 13th, 2007
thank you for your constractive comment
I have VC2005 express on my machine can you tell me the procedure to convert the code in C++ to MIPS assembly?
thank you again
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC