Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MiniMac is a virtual processor with a tiny but extendable memory and a tiny but extendable instruction set.Heres a screenshot of the MiniMac user interface:A

MiniMac is a virtual processor with a tiny but extendable memory and a tiny but extendable instruction set.Heres a screenshot of the MiniMac user interface:A screenshot of a computerDescription automatically generatedThe view panel on the right contains two lists (javax.swing.JList). The top list shows the contents of memory. The bottom list shows the program currently being executed. The control panel on the left contains three buttons (javax.swing.JButton). The first button prompts the user for a program to parse:A screenshot of a computer programDescription automatically generatedThe second button executes the program. The third button resets all memory cells to 0.These commands are duplicated under the Edit menu. The Help menu explains each command. The File menu contains the items: New, Save, Open, and Quit.The MiniMax memory is an array of integers:int size =32;Integer[] memory = new Integer[size];A MiniMax program is a list of instructions. An instruction pointer (ip) indicates the position in the list of the next instruction to be executed.GrammarHeres the instruction set grammar (note: ~ means followed by and all unquoted tokens are integers):Load ::= load ~ location ~ value // memory[location]= valueHalt ::= halt // terminates the programadd ::= add ~ src1 ~ src2 ~ dest // memory[dest]= memory[src1]+ memory[src2]mul ::= mul ~ src1 ~ src2 ~ dest // memory[dest]= memory[src1]* memory[src2]bgt ::= bgt ~ location ~ offset // if 0< memory[location] ip += offsetblt ::= blt ~ location ~ offset // if memory[location]<0 ip += offsetloop ::= loop ~ count ~ instruction // executes instruction count timesA block is a list of one or more instructions separated by semicolons and bracketed by curly braces:block ::={ ~ instruction ~ (; ~ instruction)* ~ }Executing a block sequentially executes each instruction in the blocks body.For example, the program shown in the screenshot computes kn, where n is stored in memory[0]. The base, k, is stored in memory[2]. In this case k =2, n was 7 and the result, 128, is stored in memory[1]. Memory[3] is the amount to decrement memory[0] each time the result is multiplied by k.

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

Students also viewed these Databases questions

Question

How can leaders be most effective?

Answered: 1 week ago

Question

Brief the importance of span of control and its concepts.

Answered: 1 week ago

Question

What is meant by decentralisation?

Answered: 1 week ago

Question

Write down the Limitation of Beer - Lamberts law?

Answered: 1 week ago