# Need Help On Project

#### Jrockcapri78

Joined Nov 9, 2007
9
I'm a third year EE major,and I'm having pronlems in m yComputer class. The project is for me to take a mini processor simulator called minSpim and implement some of its fuctions in C. I guess the program should act like MIPS and handle the 32 (gpr). I've only had I little bit of C, but the main problem is I don't know were to start. I have the machine code for the fuctions, but don't know what to do with them. The teacher is not very clear on what the process is. If you think you may be able to help me, let me know and I can go into more detail. Thanks in advance.

#### Papabravo

Joined Feb 24, 2006
18,108
Are you trying to say that you need to write some of the functions of a processor simulator in C. Since the project is not to write a complete simulator in C I think you will have trouble knowing what done is.

Can you give me an example of the specification for one or more of these functions?

As an example lets say you want to write a function that takes two operands, adds them together and puts the result in a general purpose register, and also sets a global carry flag if there is one.
Rich (BB code):
int adder(int a, int b)
{
long  la, lb ;
long  lr ;

la = (long) a ;
lb = (long) b ;
lr = la + lb ;
if(lr & 0xFFFF0000) carry = 1 ;
else carry = 0 ;
return (int)(lr) ;
}