Need Help On Project

Discussion in 'Programmer's Corner' started by Jrockcapri78, Nov 9, 2007.

  1. Jrockcapri78

    Thread Starter New Member

    Nov 9, 2007
    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.
  2. Papabravo


    Feb 24, 2006
    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.
    Code ( (Unknown Language)):
    2. int adder(int a, int b)
    3. {
    4. long  la, lb ;
    5. long  lr ;
    7.     la = (long) a ;
    8.     lb = (long) b ;
    9.     lr = la + lb ;
    10.     if(lr & 0xFFFF0000) carry = 1 ;
    11.     else carry = 0 ;
    12.     return (int)(lr) ;
    13. }