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++

#define N10
main()
{
int i;
int array[N]={2.4,7,8,14,5,13 ,23};
int accumulate =0;
for(i=N-1;i>=0;i--
{
	accumulate += array[i];
}
cout<<"the result is"<<accumulate<<endl;
}

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.

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

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.