Use the solved example of programmers model for 32bit CPU in

Use the solved example of programmer’s model for 32-bit CPU in module 5; Implement the programmer’s model for the following instructions:

Load D4,S2,b

Subt D4,S2,a   (this command is the subtract command)

Store D4,S2,c

Use the same memory values as lecture example.

Start with the programmer’s model given in module 6, slide 27, and show every step (like the solved example in slide 29) accordingly. Attach your screenshots for the 4 cycles of instruction processing (fetch, decode, execute, writeback); include the Tick-Tock phases for each and submit as a MS document (Please note than for each instruction, you need to submit 4x2 = 8 screenshots). (A screenshot of the programmer’s model is also attached in the next page).

Solution

import java.util.*;

public category EvaluateExpressionUsingStacks
produce stacks for operators and operands */
Stack<Integer> op = new Stack<Integer>();
Stack<Double> val = new Stack<Double>();
/* produce temporary stacks for operators and operands */
Stack<Integer> optmp = new Stack<Integer>();
Stack<Double> valtmp = new Stack<Double>();
/* settle for expression */
System.out.println(\"Evaluation Of Arithmetic Expression exploitation Stacks Test\ \");
System.out.println(\"Enter expression\ \");
String input = scan.next();
input = \"0\" + input;
input = input.replaceAll(\"-\",\"+-\");
/* Store operands and operators in several stacks */
String worker = \"\";
for (int i = 0;i < input.length();i++)
{
char ch = input.charAt(i);
if (ch == \'-\')
worker = \"-\" + temp;
else if (ch != \'+\' && ch != \'*\' && ch != \'/\')
worker = worker + ch;
else
Boolean it = false;
while (!op.isEmpty())
valuate and store in temporary stack */
if (i == 0)
  
else if (i == 1)
  
else if (i == 2)
  
}
else
  
}
/* bar all components from temporary stacks to main stacks */
whereas (!valtmp.isEmpty())
val.push(valtmp.pop());
whereas (!optmp.isEmpty())
op.push(optmp.pop());
/* ingeminate once more for same operator */
if (it)
i--;
}
System.out.println(\"\ Result = \"+val.pop());
}
}

Use the solved example of programmer’s model for 32-bit CPU in module 5; Implement the programmer’s model for the following instructions: Load D4,S2,b Subt D4,S
Use the solved example of programmer’s model for 32-bit CPU in module 5; Implement the programmer’s model for the following instructions: Load D4,S2,b Subt D4,S

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site