|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Processor
The processor is responsible for stepping through instructions, and manipulating the stack and registers.
| Field Summary | |
|---|---|
static int |
FBR
The frame base register - points to the base of the current function frame |
static int |
HALT
The halt register - set to one to stop the processor |
static int |
PC
The program counter - contains the address of the instruction to be executed next |
static int |
SP
The stack pointer - points to the first free location on the stack |
| Method Summary | |
|---|---|
int |
dec(int register)
Decrements the register and returns the new value. |
int |
get(int register)
Returns the register value requested |
Program |
getProgram()
Returns the program that is currently in memory to be executed |
int[] |
getRegisters()
Returns a new copy of the register array. |
Sys |
getSystem()
Returns the system object of this processor |
int |
inc(int register)
Increments the register and returns the new value. |
void |
init()
Initializes all registers to their initial state |
void |
load(Program prog)
Loads the program that the processor must execute |
void |
run()
Execute the whole program. |
void |
set(int register,
int value)
Set value of the register |
void |
step()
Executes one instruction. |
void |
verify(int register,
int value)
Verifies if the value is valid for this registers and throws an exception if not. |
| Field Detail |
|---|
static final int PC
static final int SP
static final int FBR
static final int HALT
| Method Detail |
|---|
void load(Program prog)
throws SystemException
prog - The program to execute
SystemException - if the program was not loaded successfullyProgram getProgram()
Sys getSystem()
void step()
throws SystemException
SystemException - if there is an error during execution
void run()
throws SystemException
SystemException - if there is an error during executionvoid init()
int get(int register)
register - The register to query
int[] getRegisters()
void set(int register,
int value)
throws SystemException
register - The register to setvalue - The value to which to set the register
SystemException - if the register value is invalid
int inc(int register)
throws SystemException
register - The register to increment
SystemException - if the resulting register value is invalid
int dec(int register)
throws SystemException
register - The register to decrement
SystemException - if the resulting register value is invalid
void verify(int register,
int value)
throws SystemException
register - The register to verifyvalue - The value to verify
SystemException - if the value is invalid for this register
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||