Answered step by step
Verified Expert Solution
Question
1 Approved Answer
//using System; import java.util.Scanner; //import java.io.Console; //Create the class that would perform the simulation. public class Simulator public static void main(String[] args) //list of SML
//using System; import java.util.Scanner; //import java.io.Console; //Create the class that would perform the simulation. public class Simulator public static void main(String[] args) //list of SML instructions /*const int READ_INS = 10; const int WRITE_INS = 11; const int LOAD_INS = 20; const int STORE_INS = 21; const int ADD_INS = 30; const int SUBTRACT_INS = 31; const int MULTIPLY_INS = 32; const int DIVIDE_INS = 33; const int BRANCH_INS = 40; const int BRANCH_NEG_INS = 41; const int BRANCH_ZERO_INS = 42; const int HALT_INS = 43;*/ final int READ INS = 10; final int WRITE_INS = 11; final int LOAD_INS = 20; final int STORE_INS = 21; final int ADD_INS = 30; final int SUBTRACT_INS = 31; final int MULTIPLY_INS = 32; final int DIVIDE_INS = 33; final int BRANCH_INS = 40; final int BRANCH_NEG_INS = 41; final int BRANCH_ZERO_INS = 42; final int HALT_INS = 43; //variabes for storing the instruction and its details. int accumulator; int instruction Counter int op_oprnd; int op_Code; int instructionRegister; //simpletron memArray int[] memArray; /umber of instructions entered in memArray int index = 0; /* Method to run the simpletron simulator / public void Run Simulator // initialize the registers InitializeRegisters(); // Get the instructions from the user as input PrintInstructions(); Load Instructions(); //execute the program and display the memArray //dump when finished //using System; import java.util.Scanner; //import java.io.Console; //Create the class that would perform the simulation. public class Simulator public static void main(String[] args) //list of SML instructions /*const int READ_INS = 10; const int WRITE_INS = 11; const int LOAD_INS = 20; const int STORE_INS = 21; const int ADD_INS = 30; const int SUBTRACT_INS = 31; const int MULTIPLY_INS = 32; const int DIVIDE_INS = 33; const int BRANCH_INS = 40; const int BRANCH_NEG_INS = 41; const int BRANCH_ZERO_INS = 42; const int HALT_INS = 43;*/ final int READ INS = 10; final int WRITE_INS = 11; final int LOAD_INS = 20; final int STORE_INS = 21; final int ADD_INS = 30; final int SUBTRACT_INS = 31; final int MULTIPLY_INS = 32; final int DIVIDE_INS = 33; final int BRANCH_INS = 40; final int BRANCH_NEG_INS = 41; final int BRANCH_ZERO_INS = 42; final int HALT_INS = 43; //variabes for storing the instruction and its details. int accumulator; int instruction Counter int op_oprnd; int op_Code; int instructionRegister; //simpletron memArray int[] memArray; /umber of instructions entered in memArray int index = 0; /* Method to run the simpletron simulator / public void Run Simulator // initialize the registers InitializeRegisters(); // Get the instructions from the user as input PrintInstructions(); Load Instructions(); //execute the program and display the memArray //dump when finished
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