Simple Machine

Machine
Class AbstractCPU

java.lang.Object
  extended by java.util.Observable
      extended by Machine.AbstractCPU
Direct Known Subclasses:
AbstractSM213CPU

public abstract class AbstractCPU
extends java.util.Observable


Nested Class Summary
static class AbstractCPU.InvalidInstructionException
          Exception indicating than an invalid instruction was just detected by the CPU.
static class AbstractCPU.MachineHaltException
          Exception indicating that the CPU just retired a halt instruction.
 
Field Summary
static java.lang.String CURRENT_INSTRUCTION_ADDRESS
           
protected  boolean isInterrupt
          Interrupt flag
protected  AbstractMainMemory mem
           
static java.lang.String PC
           
protected  java.util.Vector<RegisterSet> processorState
          Processor state registers.
protected  RegisterSet reg
          General purpose register file.
 
Constructor Summary
AbstractCPU(AbstractMainMemory aMem)
           
AbstractCPU(java.lang.String aName, AbstractMainMemory aMem)
           
 
Method Summary
protected abstract  void cycle()
          Abstract class that implements cpu control logic.
 AbstractMainMemory getMainMemory()
           
 java.lang.String getName()
          Name of this ISA implementation (optional).
 DataModel getPC()
          Export the PC register.
 java.util.Vector<RegisterSet> getProcessorState()
           
 RegisterSet getRegisterFile()
           
 void setPC(int aPC)
          Set PC to value
 boolean start()
          Start processor execution.
 void triggerInterrupt()
           
 
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

reg

protected RegisterSet reg
General purpose register file.


processorState

protected java.util.Vector<RegisterSet> processorState
Processor state registers.


PC

public static final java.lang.String PC
See Also:
Constant Field Values

CURRENT_INSTRUCTION_ADDRESS

public static final java.lang.String CURRENT_INSTRUCTION_ADDRESS
See Also:
Constant Field Values

isInterrupt

protected boolean isInterrupt
Interrupt flag


mem

protected AbstractMainMemory mem
Constructor Detail

AbstractCPU

public AbstractCPU(java.lang.String aName,
                   AbstractMainMemory aMem)

AbstractCPU

public AbstractCPU(AbstractMainMemory aMem)
Method Detail

getMainMemory

public AbstractMainMemory getMainMemory()

getRegisterFile

public RegisterSet getRegisterFile()

getProcessorState

public java.util.Vector<RegisterSet> getProcessorState()

getName

public java.lang.String getName()
Name of this ISA implementation (optional).


getPC

public DataModel getPC()
Export the PC register.


setPC

public void setPC(int aPC)
Set PC to value


cycle

protected abstract void cycle()
                       throws AbstractCPU.InvalidInstructionException,
                              AbstractCPU.MachineHaltException,
                              AbstractMainMemory.InvalidAddressException
Abstract class that implements cpu control logic.

Throws:
AbstractCPU.InvalidInstructionException
AbstractCPU.MachineHaltException
AbstractMainMemory.InvalidAddressException

triggerInterrupt

public void triggerInterrupt()

start

public boolean start()
              throws AbstractCPU.InvalidInstructionException,
                     AbstractMainMemory.InvalidAddressException
Start processor execution.

Throws:
AbstractCPU.InvalidInstructionException
AbstractMainMemory.InvalidAddressException

Simple Machine