Postfix Calculator

Tom Kelliher, CS 220

Due Nov. 13, 2009, with a milestone due Nov. 6

Simply, hand-compile the postfix.c program on the class home page to MIPS assembly and run under SPIM. Use typescript to record a session in which you run the expressions on the ``Postfix Calculator Test'' document (refer to the class web site) on your calculator in SPIM. Hand-in the typescript session and your commented MIPS source code.

Ground rules:

  1. Frames and a frame stack must be used for all functions, including main(). This is crucial for printVal(), as this function is recursive. You may NOT implement printVal() non-recursively.

    Note that registers $fp and $sp are for the frame stack. Use $t8 (see below) for the operand stack.

  2. Implement the following functions:
    int isEmpty(void);
    int isFull(void);
    void push(int item);
    int pop(void);
    int getValue(void);
    void compute(void);
    void output(void);
    void die(const char *s);
    void printVal(int v);
    int main();
    

  3. Use mnemonic register names.

  4. Adhere to the following MIPS conventions: call, register use, and memory use.

  5. $t8 and $t9 may be used to permanently store the two external pointers (stackPointer and next).

Nov. 6 milestone: Lay-out the frame structure and write the bodies of the functions, save for main. Do not consider the call or return code for now. Hand in hard copy.



Thomas P. Kelliher 2009-11-02
Tom Kelliher