Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Trace the execution of the following Simple Computer Assembly program. As each line is executed record the values stored in the given register or variable
Trace the execution of the following Simple Computer Assembly program. As each line is executed record the values stored in the given register or variable in a table formatted as per the table below the program. Assume that you are recording the state at the very end of the fetch-execute loop. Note: All values in the IR (Instruction Register) column of the CPU Table must be recorded in hexadecimal (base-16)!
Simple Computer Code
\begin{tabular}{|c|c|c|c|c|} \hline ADDRESS & LABEL & OPERATION & MODE & OPERAND \\ \hline 0x00 & & LOAD & A & x \\ \hline 0x01 & & MODI & A & 5 \\ \hline 0x02 & & SUBI & A & 3 \\ \hline 0x03 & & JUMPIFZERO & & else \\ \hline 0x04 & & LOAD & A & y \\ \hline 0x05 & loop & JUMPIFZERO & & after \\ \hline 0x06 & & LOAD & A & y \\ \hline 0x07 & & LOAD & B & total \\ \hline 0x08 & & ADD & REG & \\ \hline 0x09 & & STORE & A & total \\ \hline 0x0A & & LOAD & A & y \\ \hline 0x0B & & SUBI & A & y \\ \hline 0x0C & & STORE & A & y \\ \hline 0x0D & & JUMP & & loop \\ \hline 0x0E & else & LOAD & A & x \\ \hline 0x0F & & LOAD & B & x \\ \hline 0x10 & & MUL & REG & \\ \hline 0x11 & & MUL & REG & \\ \hline 0x12 & & STORE & A & total \\ \hline 0x13 & after & LOAD & A & total \\ \hline 0x14 & & WRITE & & \\ \hline 0x15 & & HALT & & \\ \hline 0x16 & x & & & 4 \\ \hline 0x17 & y & & & 3 \\ \hline 0x18 & total & & & 0 \\ \hline \end{tabular} CPU Table \begin{tabular}{|l|l|l|l|l|l|l|l|} \hline TIME & \multicolumn{1}{|l|}{ A } & \multicolumn{1}{|c|}{ PC } & \multicolumn{1}{|l|}{ I } & TOTAL \\ \hline 0 & 0 & 0 & - & 0 & 4 & 3 & 0 \\ \hline 1 & & & & & & & \\ \hline 2 & & & & & & & \\ \hline 3 & & & & & & & \\ \hline 4 & & & & & & & \\ \hline 5 & & & & & & & \\ \hline 6 & & & & & & & \\ \hline 7 & & & & & & & \\ \hline 8 & & & & & & & \\ \hline 9 & & & & & & & \\ \hline 10 & & & & & & & \\ \hline 11 & & & & & & & \\ \hline 12 & & & & & & & \\ \hline 13 & & & & & & & \\ \hline 14 & & & 0 & & & & \\ \hline 15 & & & & & & & \\ \hline 16 & & & & & & & \\ \hline 17 & & & & & & & \\ \hline 18 & & & & & & & \\ \hline 19 & & & & & & & \\ \hline 20 & & & & & & & \\ \hline 21 & & & & & & & \\ \hline 22 & & & & & & & \\ \hline 23 & & & & & & & \\ \hline 26 & & & & & & & \\ \hline \end{tabular} \begin{tabular}{|c|c|c|c|c|} \hline ADDRESS & LABEL & OPERATION & MODE & OPERAND \\ \hline 0x00 & & LOAD & A & x \\ \hline 0x01 & & MODI & A & 5 \\ \hline 0x02 & & SUBI & A & 3 \\ \hline 0x03 & & JUMPIFZERO & & else \\ \hline 0x04 & & LOAD & A & y \\ \hline 0x05 & loop & JUMPIFZERO & & after \\ \hline 0x06 & & LOAD & A & y \\ \hline 0x07 & & LOAD & B & total \\ \hline 0x08 & & ADD & REG & \\ \hline 0x09 & & STORE & A & total \\ \hline 0x0A & & LOAD & A & y \\ \hline 0x0B & & SUBI & A & y \\ \hline 0x0C & & STORE & A & y \\ \hline 0x0D & & JUMP & & loop \\ \hline 0x0E & else & LOAD & A & x \\ \hline 0x0F & & LOAD & B & x \\ \hline 0x10 & & MUL & REG & \\ \hline 0x11 & & MUL & REG & \\ \hline 0x12 & & STORE & A & total \\ \hline 0x13 & after & LOAD & A & total \\ \hline 0x14 & & WRITE & & \\ \hline 0x15 & & HALT & & \\ \hline 0x16 & x & & & 4 \\ \hline 0x17 & y & & & 3 \\ \hline 0x18 & total & & & 0 \\ \hline \end{tabular} CPU Table \begin{tabular}{|l|l|l|l|l|l|l|l|} \hline TIME & \multicolumn{1}{|l|}{ A } & \multicolumn{1}{|c|}{ PC } & \multicolumn{1}{|l|}{ I } & TOTAL \\ \hline 0 & 0 & 0 & - & 0 & 4 & 3 & 0 \\ \hline 1 & & & & & & & \\ \hline 2 & & & & & & & \\ \hline 3 & & & & & & & \\ \hline 4 & & & & & & & \\ \hline 5 & & & & & & & \\ \hline 6 & & & & & & & \\ \hline 7 & & & & & & & \\ \hline 8 & & & & & & & \\ \hline 9 & & & & & & & \\ \hline 10 & & & & & & & \\ \hline 11 & & & & & & & \\ \hline 12 & & & & & & & \\ \hline 13 & & & & & & & \\ \hline 14 & & & 0 & & & & \\ \hline 15 & & & & & & & \\ \hline 16 & & & & & & & \\ \hline 17 & & & & & & & \\ \hline 18 & & & & & & & \\ \hline 19 & & & & & & & \\ \hline 20 & & & & & & & \\ \hline 21 & & & & & & & \\ \hline 22 & & & & & & & \\ \hline 23 & & & & & & & \\ \hline 26 & & & & & & & \\ \hline \end{tabular}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started