Question: b Consider a special CPU with a stack-point register (SP), no other general purpose registers, and the following instructions: Opcode Instruction Action Stop program execution

 b Consider a special CPU with a stack-point register (SP), no

b Consider a special CPU with a stack-point register (SP), no other general purpose registers, and the following instructions: Opcode Instruction Action Stop program execution STOP LOAD [Addri SP Memoryl Addrl 0010 STORE [Addrl 0011 PUSH [Addr] 0100 POP [Addr] 0101 0110 SUB 0111 1000 Memory[Addr-SP SP SP -1 MemoryISPl-Memory Addrl Memory[Addr]-Memory[SP] SP SP+1 Memory[SP+1 ]= Memory[SP+1?Memory[SP] SP SP+1 Memory[SP+1]-Memory[SP+1]- Memory[SP] SP = SP+1 Memory[SP+1]-Memory[SP+1]'Memory[SP SP = SP+1 ADD MULT Memory?-Memory[SP+1JMemorylSPJ SP = SP+1 DIV +1 The SP register points to the "top" of the stack memory, which is accessed in the last-in-first-out order. When an operand is pushed onto or popped from the stack, the SP register is decreased or increased by 1, respectively. Each memory location stores one variable (operand). Write an assembly program to compute A-(X Y+5* Z)* (X-Y) where X, Yand Z are input variables, A is the result variable and 5 is a fixed value, all stored in some memory locations. We assume that the computation does not cause any overflow or underflow. Specify the memory locations for the stack memory, variables and your assembly instructions in hexadecimal numbers. Define other temporary variables, if needed, and provide their memory locations. b Consider a special CPU with a stack-point register (SP), no other general purpose registers, and the following instructions: Opcode Instruction Action Stop program execution STOP LOAD [Addri SP Memoryl Addrl 0010 STORE [Addrl 0011 PUSH [Addr] 0100 POP [Addr] 0101 0110 SUB 0111 1000 Memory[Addr-SP SP SP -1 MemoryISPl-Memory Addrl Memory[Addr]-Memory[SP] SP SP+1 Memory[SP+1 ]= Memory[SP+1?Memory[SP] SP SP+1 Memory[SP+1]-Memory[SP+1]- Memory[SP] SP = SP+1 Memory[SP+1]-Memory[SP+1]'Memory[SP SP = SP+1 ADD MULT Memory?-Memory[SP+1JMemorylSPJ SP = SP+1 DIV +1 The SP register points to the "top" of the stack memory, which is accessed in the last-in-first-out order. When an operand is pushed onto or popped from the stack, the SP register is decreased or increased by 1, respectively. Each memory location stores one variable (operand). Write an assembly program to compute A-(X Y+5* Z)* (X-Y) where X, Yand Z are input variables, A is the result variable and 5 is a fixed value, all stored in some memory locations. We assume that the computation does not cause any overflow or underflow. Specify the memory locations for the stack memory, variables and your assembly instructions in hexadecimal numbers. Define other temporary variables, if needed, and provide their memory locations

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!