Class: VM

VM(stdin, stdout)

class: VM

Constructor

new VM(stdin, stdout)

Virtual Machine for Simulator to Run
Parameters:
Name Type Description
stdin FileStream Standard Input for Virtual Machine
stdout FileStream Standard Output for Virtual Machine
Properties:
Name Type Description
register Array Register File for Virtual Machine
AddressTable Array Address Lookup Table
InstructionSet Array Parse Tree Generated by Parse
fenceSize Number Fence Register for Access Limitation
ProgramCounter Number Next Instruction Index
shouldRun boolean Execution State (Running | Halt)
Source:

Methods

encodeFromRegister(register, i)

Fetch Encoding Information from Register File
Parameters:
Name Type Description
register string Name of The Register
i Number Index of The Instruction
Source:

execute(InstructionSet, ProgramCounter)

Execution Module for Virtual Machine
Parameters:
Name Type Description
InstructionSet Array Set of Instructions to be Executed
ProgramCounter Number Index of Next Instruction
Source:

loadOnRegister(register, value, i)

Load Data Into Register File
Parameters:
Name Type Description
register string Name of The Register
value any Value to be Put
i Number Index of The Instruction
Source:

memory(target, value, i)

Store Data Into Main Memory
Parameters:
Name Type Description
target string Name of The Taget Address
value any Value to be Put
i Number Index of The Instruction
Source:

run(SymbolTable, SyntaxTree)

Invocation Method to ENtry POint of The Program
Parameters:
Name Type Description
SymbolTable Array Address Lookup Table
SyntaxTree Array Abstract Syntax Tree
Source:

updatePC(address)

Modify Program Counter in Case of Branching
Parameters:
Name Type Description
address Number Address of The Resolved Branch
Source:

valueFromLabel(label, i)

Load Data From Main Memory
Parameters:
Name Type Description
label string Name of The Address Label
i Number Index of The Instruction
Source:

valueFromRegister(register, i)

Fetch Data From Register File
Parameters:
Name Type Description
register string Name of The Register
i Number Index of The Instruction
Source: