Presentation is loading. Please wait.

Presentation is loading. Please wait.

Designing a Virtual Machine. Basic Approach Object-oriented design Try to model the hardware. Seek a level of detail that is appropriate for interpretation.

Similar presentations


Presentation on theme: "Designing a Virtual Machine. Basic Approach Object-oriented design Try to model the hardware. Seek a level of detail that is appropriate for interpretation."— Presentation transcript:

1 Designing a Virtual Machine

2 Basic Approach Object-oriented design Try to model the hardware. Seek a level of detail that is appropriate for interpretation of a machine language program Consider tool-building mode to bottom up design a structure that will make the problem manageable

3 A Simple Computer Memory CPU 1. Fetch2. Decode 3. Fetch Operands 4. Execute & Store Results Basic instruction cycle to execute instructions.

4 CPU object Define registers –Programmable and internal Method to execute single instruction –switch to check for opcode –Methods for each instruction Execution selection to either: –Loop until STOP or BREAK location found Only once for a single instruction

5 Memory Lots of latitude in designing memory Do not be concerned with storing “binary” values. Design a “run-time” memory that allows storing what you need stored. –Distinguish data and instructions –Instructions have opcode/operand1/operand2 Maintain a table of tokens and locations for both instructions and data. –Build a lookup method to find names

6 Other Utilities Loader –Parse input –Store instructions in memory –Build label table Debug routines –Examine memory and label table after loading –Dump basic registers to an output file as executing

7 Design/Testing Strategies Try to divide the lines with simple but limited interaction (like good method design) Build incrementally –Build a loader – dump to see if working –Build an interpreter – test with “manually” defined instructions and data –Being with a limited instruction set

8 Problem Areas Visualize the result. If you don’t have a vision of your work, you haven’t designed sufficiently. You should be able to see the end. Define problem areas early and solve those –Don’t start doing the easy things, ignoring problems Ask for help when there is a problem area.

9 Time Line Develop a reasonable time line Stick with it. Work effort may not be proportional. –Time –Personal workload Meet your responsibility to the group. Work with the strengths of each person.


Download ppt "Designing a Virtual Machine. Basic Approach Object-oriented design Try to model the hardware. Seek a level of detail that is appropriate for interpretation."

Similar presentations


Ads by Google