Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Pre-Execution state of Register/Memory Location values: PC: 35 Memory Location V

ID: 3602260 • Letter: P

Question

Pre-Execution state of Register/Memory Location values:

PC: 35

Memory Location

Value

35

901 (INPUT) [Assume user inputs “500” from keyboard]

36

181 (ADD 81)

37

383 (STORE 83)

38

901 (INPUT) [Assume user inputs “901” from keyboard]

39

583 (SUBTRACT 83)

40

902 (OUTPUT A)

41

HALT

81

400

82

000

83

000

* Note: 901 and 902 are instruction for input and output contents of Accumulator.

The following code is executed. Compute the result. Show the values of the registers in each of the following step. Mark Fetch/Execute Cycles within the code. Write a summary on what this program does.

Instruction: 901 (Input)

PC -> MAR
MDR -> IR
IOR -> A

PC+1 -> PC

Instruction: ADD 81

PC -> MAR
MDR -> IR

IR[address] -> MAR

A+MDR -> A

PC +1 -> PC

Instruction: STORE 83

PC -> MAR
MDR -> IR
IR[address] -> MAR

A -> MDR
PC+1 -> PC


Instruction: 901 (Input)

PC -> MAR
MDR -> IR
IOR -> A

PC+1 -> PC

Instruction: SUBTRACT 83

PC -> MAR
MDR -> IR

IR[address] -> MAR

A-MDR -> A

PC+1 -> PC

Instruction: 902 (OUTPUT A)

PC -> MAR
MDR -> IR

A -> IOR

PC+1 -> PC

// This is the halt instruction. Assume the content on that memory location is “HALT” and the system knows to halt the program when that instruction is loaded.

PC -> MAR
MDR -> IR

WHAT IS DISPLAYED AS THE FINAL ANSWER? __________

Memory Location

Value

35

901 (INPUT) [Assume user inputs “500” from keyboard]

36

181 (ADD 81)

37

383 (STORE 83)

38

901 (INPUT) [Assume user inputs “901” from keyboard]

39

583 (SUBTRACT 83)

40

902 (OUTPUT A)

41

HALT

81

400

82

000

83

000

Explanation / Answer

Instruction: 901 (Input)

PC -> MAR
MDR -> IR
IOR -> A

PC+1 -> PC

Instruction: ADD 81

PC -> MAR
MDR -> IR

IR[address] -> MAR

A+MDR -> A

PC +1 -> PC

Instruction: STORE 83

PC -> MAR
MDR -> IR
IR[address] -> MAR

A -> MDR
PC+1 -> PC


Instruction: 901 (Input)

PC -> MAR
MDR -> IR
IOR -> A

PC+1 -> PC

Instruction: SUBTRACT 83

PC -> MAR
MDR -> IR

IR[address] -> MAR

A-MDR -> A

PC+1 -> PC

Instruction: 902 (OUTPUT A)

PC -> MAR
MDR -> IR

A -> IOR

PC+1 -> PC  

HALT

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote