1

I read that ADD and MUL instructions when implemented in Stack are zero address instructions but there is no discussion anywhere as to PUSH and POP instruction are one address instruction or zero address instructions. Here is an excerpt from Computer Architecture by Morris Mano: enter image description here

It was asked in our exams and answered as zero address instruction but I am pretty sure it must be a one address instruction. Please someone help.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847

1 Answers1

5

PUSH/POP are clearly 1 explicit address because they have one explicit operand. The other (implicit) operands being the stack pointer and stack contents.

The text you quote from your textbook even says PUSH and POP need one address field in their machine code.

Clearly a grading error on your exam, mixing PUSH/POP up with ADD/MUL instructions in that stack machine. Even in other ISAs like x86, PUSH/POP are 1-address instructions.

PUSH could only be 0-address if there was some fixed register whose contents were pushed, and you had to get data into that register first to push it.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • Thanks ! I think it solved my confusion but nevertheless, it would be impossible to get that question corrected by the teachers. – Pulkit Ahuja Nov 09 '20 at 13:04