Question: Need help to write a java code for this lab: (Thanks) CS 13 Virtual Machine Proiect Implement the a virtual machine for the instructions listed

Need help to write a java code for this lab:

(Thanks)

Need help to write a java code for this lab: (Thanks) CS

13 Virtual Machine Proiect Implement the a virtual machine for the instructions

listed in the chart on page two Your VM class should have

the following fields: Field Description Function Program Counter; type int Array of

CS 13 Virtual Machine Proiect Implement the a virtual machine for the instructions listed in the chart on page two Your VM class should have the following fields: Field Description Function Program Counter; type int Array of type int Operand and CPU stack Contains the address of the next instruction to fetch memory Contains instructions (a program) and stack Used for processing arithmetic instructions and storing return address The pc should be initialized to 0 so the first instruction is fetched from memory location zero. The memory should contain a sample machine language program. This program could be loaded from a text file, or you can directly initialize the memory array when it is created. The stack is the integer stack discussed in part 1 of this assignment. The stack should be properly initialized by its constructor. To execute the program in memory you will need a method that: 1. Fetches the instruction at the address contained in the pc 2. Increments the pc 3. Decodes the instruction. This is done with a switch statement. 4. Executes the instruction 5. Repeats this process until a HALT is executed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!