Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+2 Why did OBI create Centers of Excellence?

Answered: 1 week ago

Question

=+professionalism and competency in handling global HR issues?

Answered: 1 week ago