Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


In this project, I made use of RAM to implement a stack-based four function calculator.  It uses a stack to hold the operands of an operation. The user first enters and pushes the operands, then selects an operation to execute that makes use of the top two operands on the stack.

2. Tasks

Testing my stacker:


State Machine Diagram:

At state "000," if Button 2 is presses, then the current value from the switches will be written to the MBR. Then Button 3 will push the MBR onto the stack. Button 4 will execute the operation specified by the two operation switches, using the MBR and the first value on the stack, putting the result back in the MBR.


Testing using the board:

4 + 5 = 9


I first set the value switches to the binary value for 4, and then clicked the Capture button (Button 2) to move 4 into the MBR. Next, I clicked the Enter button to push 4 (Button 3) onto the stack. Secondly, I set the value switches to the binary value for 5 and then clicked the Capture button to move 5 into the MBR. Thirdly, I set the operation switches to 00 for ADD and clicked the Action button (Button 4) to add the MBR to the top value of the stack. The result, 9, ended up in the MBR and on the display.


3 - 1 = 2



2 * 3 = 6



8 / 4 = 2


3. Extensions