Constructor and Description |
---|
SimpleCPUCore() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDescription()
Textual description of the hardware
|
<T> T |
getRegister(int i)
Obtain the value of a given register
|
java.lang.Object[] |
getRegisters()
Obtain the core's register array
|
void |
handleInterrupt(Interrupt interrupt)
Handle an interrupt
|
void |
load(Context context)
Load context to the core
|
void |
setRegisters(int register,
java.lang.Object... values)
Set the value of a sequence of registers
|
void |
tick()
The fetch-decode-execute loop
|
java.lang.String |
toString() |
getContext
public void load(Context context)
CPUCore
public void tick()
public java.lang.String getDescription()
Clockable
public void handleInterrupt(Interrupt interrupt) throws java.lang.Exception
CPUCore
handleInterrupt
in class CPUCore
interrupt
- The interrupt to handlejava.lang.Exception
public void setRegisters(int register, java.lang.Object... values) throws InvalidRegisterException
CPUCore
setRegisters
in class CPUCore
register
- The initial register to affectvalues
- The values to storeInvalidRegisterException
- Thrown if the sequence of registers to affect goes beyond the number of registers supported by the CPU corepublic <T> T getRegister(int i) throws InvalidRegisterException
CPUCore
getRegister
in class CPUCore
i
- The number of the register to readInvalidRegisterException
- Thrown if number is not a valid registerpublic java.lang.Object[] getRegisters()
CPUCore
getRegisters
in class CPUCore
public java.lang.String toString()
toString
in class java.lang.Object