Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Lab Please help CS 13 Virtual Machine Proiect Implement the a virtual machine for the instructions listed in the chart on page two Your

Java Lab

Please help

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

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. 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

How should a consultant be selected?

Answered: 1 week ago

Question

1 What demand is and what affects it.

Answered: 1 week ago