Simple Machine

Arch.SM213.Machine
Class AbstractSM213CPU

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

public abstract class AbstractSM213CPU
extends AbstractCPU


Nested Class Summary
 
Nested classes/interfaces inherited from class Machine.AbstractCPU
AbstractCPU.InvalidInstructionException, AbstractCPU.MachineHaltException
 
Field Summary
protected  Register curInst
           
protected  Register insOp0
           
protected  Register insOp1
           
protected  Register insOp2
           
protected  Register insOpCode
           
protected  Register insOpExt
           
protected  Register insOpImm
           
protected  Register instruction
           
protected  Register pc
           
protected  RegisterSet ps
           
 
Fields inherited from class Machine.AbstractCPU
CURRENT_INSTRUCTION_ADDRESS, isInterrupt, mem, PC, processorState, reg
 
Constructor Summary
AbstractSM213CPU(AbstractMainMemory aMem)
           
 
Method Summary
protected  void cycle()
          Computes one cycle of the SM213 CPU
protected abstract  void execute()
          Impemented by STUDENTS to execute instruction currently loaded in processorState registers.
protected abstract  void fetch()
          Implemented by STUDENTS to fetch next instruction from memory into CPU processorState registers.
 void setPC(int aPC)
          Set PC to value
 
Methods inherited from class Machine.AbstractCPU
getMainMemory, getName, getPC, getProcessorState, getRegisterFile, start, 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

ps

protected RegisterSet ps

pc

protected Register pc

instruction

protected Register instruction

insOpCode

protected Register insOpCode

insOp0

protected Register insOp0

insOp1

protected Register insOp1

insOp2

protected Register insOp2

insOpImm

protected Register insOpImm

insOpExt

protected Register insOpExt

curInst

protected Register curInst
Constructor Detail

AbstractSM213CPU

public AbstractSM213CPU(AbstractMainMemory aMem)
Method Detail

cycle

protected void cycle()
              throws AbstractCPU.InvalidInstructionException,
                     AbstractCPU.MachineHaltException,
                     AbstractMainMemory.InvalidAddressException
Computes one cycle of the SM213 CPU

Specified by:
cycle in class AbstractCPU
Throws:
AbstractCPU.InvalidInstructionException
AbstractCPU.MachineHaltException
AbstractMainMemory.InvalidAddressException

setPC

public void setPC(int aPC)
Description copied from class: AbstractCPU
Set PC to value

Overrides:
setPC in class AbstractCPU

fetch

protected abstract void fetch()
                       throws AbstractMainMemory.InvalidAddressException
Implemented by STUDENTS to fetch next instruction from memory into CPU processorState registers.

Throws:
AbstractMainMemory.InvalidAddressException

execute

protected abstract void execute()
                         throws AbstractCPU.InvalidInstructionException,
                                AbstractCPU.MachineHaltException,
                                RegisterSet.InvalidRegisterNumberException,
                                AbstractMainMemory.InvalidAddressException
Impemented by STUDENTS to execute instruction currently loaded in processorState registers.

Throws:
AbstractCPU.InvalidInstructionException
AbstractCPU.MachineHaltException
RegisterSet.InvalidRegisterNumberException
AbstractMainMemory.InvalidAddressException

Simple Machine