|
Simple Machine | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
machine.AbstractCPU
public abstract class AbstractCPU
Nested Class Summary | |
---|---|
class |
AbstractCPU.ImplementationException
Exception indicating an internal error in CPU implementation. |
static class |
AbstractCPU.InternalState
AbstractCPU internal state. |
class |
AbstractCPU.InvalidInstructionException
Exception indicating that an invalid instruction was just detected by the CPU. |
class |
AbstractCPU.MachineHaltException
Exception indicating that the CPU just retired a halt instruction. |
Field Summary | |
---|---|
AbstractCPU.InternalState |
is
Internal state not accessed by concerete sub-classes. |
protected AbstractMainMemory.Port |
mem
Link to CPU's main memory. |
protected RegisterSet.Ports |
reg
General purpose register file. |
Constructor Summary | |
---|---|
AbstractCPU(String aName,
AbstractMainMemory aMem)
Create a new CPU. |
Method Summary | |
---|---|
protected abstract void |
cycle()
Compute one cycle of CPU. |
AbstractMainMemory |
getMainMemory()
Get value of CPU's main memory. |
String |
getName()
Get fully-qualified name of this implementation. |
DataModel |
getPC()
Get the program-counter value. |
Vector<RegisterSet> |
getProcessorState()
Get the CPU's processor state. |
RegisterSet |
getRegisterFile()
Get the CPU's register file. |
boolean |
isInterrupt()
Determing whether CPU has a pending interrupt. |
static AbstractCPU |
newInstance(AbstractCPU aCPU)
Create a new instance of the same underlying type and with the same constructor parameters as existing cpu. |
void |
setPC(int aPC)
Set program-counter value |
void |
start()
Start processor execution. |
void |
triggerInterrupt()
Trigger an interrupt on CPU. |
Methods inherited from class java.util.Observable |
---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final AbstractCPU.InternalState is
protected RegisterSet.Ports reg
protected AbstractMainMemory.Port mem
Constructor Detail |
---|
public AbstractCPU(String aName, AbstractMainMemory aMem)
aName
- fully-qualified name of CPU implementation.aMem
- main memory used by CPU.Method Detail |
---|
public static AbstractCPU newInstance(AbstractCPU aCPU)
aCPU
- CPU object who's class and value is used as the basis of the new CPU.public AbstractMainMemory getMainMemory()
public RegisterSet getRegisterFile()
public Vector<RegisterSet> getProcessorState()
public String getName()
public DataModel getPC()
public void setPC(int aPC)
protected abstract void cycle() throws AbstractCPU.InvalidInstructionException, AbstractCPU.MachineHaltException, AbstractMainMemory.InvalidAddressException, Register.TimingException, AbstractCPU.ImplementationException
AbstractCPU.InvalidInstructionException
- attempted to execute an invalid instruction.
AbstractCPU.MachineHaltException
- halt instruction executed.
AbstractMainMemory.InvalidAddressException
- attempted to execute an instruction that accesses an invalid memory address.
Register.TimingException
- if instruction stalls on reading register input port.
AbstractCPU.ImplementationException
- wrapper for all other exception for reporting to UI.public void triggerInterrupt()
public boolean isInterrupt()
public void start() throws AbstractCPU.InvalidInstructionException, AbstractCPU.MachineHaltException, AbstractMainMemory.InvalidAddressException, Register.TimingException, AbstractCPU.ImplementationException
AbstractCPU.InvalidInstructionException
- attempted to execute an invalid instruction.
AbstractCPU.MachineHaltException
- halt instruction executed.
AbstractMainMemory.InvalidAddressException
- attempted to execute an instruction that accesses an invalid memory address.
Register.TimingException
- if instruction stalls on reading register input port.
AbstractCPU.ImplementationException
- wrapper for all other exception for reporting to UI.
|
Simple Machine | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |