dioscuri.module
Class ModuleCPU

java.lang.Object
  extended by dioscuri.module.AbstractModule
      extended by dioscuri.module.ModuleCPU
All Implemented Interfaces:
Addressable, Module
Direct Known Subclasses:
CPU, Processor

public abstract class ModuleCPU
extends AbstractModule
implements Addressable

Interface representing a generic CPU module.


Nested Class Summary
 
Nested classes/interfaces inherited from interface dioscuri.interfaces.Module
Module.Type
 
Field Summary
 
Fields inherited from class dioscuri.module.AbstractModule
type
 
Constructor Summary
ModuleCPU()
           
 
Method Summary
abstract  java.lang.String dumpRegisters()
          Returns a dump of the current registers with their value
abstract  boolean getCpuInstructionDebug()
          Get CPU instruction debug.
abstract  long getCurrentInstructionNumber()
          Retrieve current number of instruction (instructions executed so far)
abstract  int getIPS()
          Get the Instructions Per Second (ips) for this CPU.
abstract  java.lang.String getNextInstructionInfo()
          Retrieve string with information about next instruction to be executed
abstract  java.lang.String getRegisterHex(int register)
           
protected abstract  byte[] getRegisterValue(java.lang.String registerName)
          Returns the value of a named register.
protected abstract  void incrementInstructionCounter()
          Increment current number of instruction by one
protected abstract  boolean initInstructionTables()
          Initialise the single and double byte opcode lookup arrays with instructions corresponding to the Intel hexadecimal machinecode values.
protected abstract  boolean initRegisters()
          Initialise registers
abstract  void interruptRequest(boolean value)
          Set the interrupt request (IRQ).
abstract  boolean isAbnormalTermination()
          Returns if CPU halted abnormally or not
abstract  boolean isShutdown()
          Returns if CPU halted due to full system shutdown or not
abstract  void setCpuInstructionDebug(boolean isDebugMode)
          Set the CPU instruction debug.
abstract  void setHoldRequest(boolean value, Module originator)
          Sets the CPU hold mode by asserting a Hold Request.
This informs the CPU to avoid using the (non-existent) bus as another device (usually via DMA) is using it; it should be scheduled as a asynchronous event in CPU.
abstract  void setIPS(int ips)
          Set the Instructions Per Second (ips) for this CPU.
abstract  void setIPS(int ips, int lowestUpdatePeriod)
          Set the Instructions Per Second (ips) for this CPU.
protected abstract  boolean setRegisterValue(java.lang.String registerName, byte[] value)
          Sets the value of a named register to given value.
protected abstract  void setRunning(boolean status)
          Set the boolean that starts and stops the CPU loop
 
Methods inherited from class dioscuri.module.AbstractModule
getConnection, getConnections, getDebugMode, getDump, getExpectedConnections, getType, isConnected, reset, setConnection, setDebugMode, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface dioscuri.interfaces.Addressable
getIOPortByte, getIOPortDoubleWord, getIOPortWord, setIOPortByte, setIOPortDoubleWord, setIOPortWord
 
Methods inherited from interface dioscuri.interfaces.Module
getConnection, getConnections, getDebugMode, getDump, getExpectedConnections, getType, isConnected, reset, setConnection, setDebugMode, start, stop
 

Constructor Detail

ModuleCPU

public ModuleCPU()
Method Detail

setIPS

public abstract void setIPS(int ips)
Set the Instructions Per Second (ips) for this CPU.

Parameters:
ips - the Instructions Per Second (ips) for this CPU.

getIPS

public abstract int getIPS()
Get the Instructions Per Second (ips) for this CPU.

Returns:
the Instructions Per Second (ips) for this CPU.

setIPS

public abstract void setIPS(int ips,
                            int lowestUpdatePeriod)
Set the Instructions Per Second (ips) for this CPU. Also, define what the smallest period is for sending a clockpulse (in microseconds)

Parameters:
ips -
lowestUpdatePeriod - the lowest update period in microseconds

getNextInstructionInfo

public abstract java.lang.String getNextInstructionInfo()
Retrieve string with information about next instruction to be executed

Returns:
string containing next instruction information

getCurrentInstructionNumber

public abstract long getCurrentInstructionNumber()
Retrieve current number of instruction (instructions executed so far)

Returns:
long containing number of instructions

incrementInstructionCounter

protected abstract void incrementInstructionCounter()
Increment current number of instruction by one


dumpRegisters

public abstract java.lang.String dumpRegisters()
Returns a dump of the current registers with their value

Returns:
String containing a register dump

initRegisters

protected abstract boolean initRegisters()
Initialise registers

Returns:
true if initialisation is successful, false otherwise

initInstructionTables

protected abstract boolean initInstructionTables()
Initialise the single and double byte opcode lookup arrays with instructions corresponding to the Intel hexadecimal machinecode values.

Returns:

setRunning

protected abstract void setRunning(boolean status)
Set the boolean that starts and stops the CPU loop

Parameters:
status - sets the isRunning boolean

getRegisterValue

protected abstract byte[] getRegisterValue(java.lang.String registerName)
Returns the value of a named register.

Parameters:
registerName -
Returns:
int[] with value of register, null otherwise

setRegisterValue

protected abstract boolean setRegisterValue(java.lang.String registerName,
                                            byte[] value)
Sets the value of a named register to given value.

Parameters:
registerName -
value - containing the value
Returns:
true if set was successful, false otherwise

interruptRequest

public abstract void interruptRequest(boolean value)
Set the interrupt request (IRQ).

Parameters:
value -

setHoldRequest

public abstract void setHoldRequest(boolean value,
                                    Module originator)
Sets the CPU hold mode by asserting a Hold Request.
This informs the CPU to avoid using the (non-existent) bus as another device (usually via DMA) is using it; it should be scheduled as a asynchronous event in CPU.

Parameters:
value - state of the Hold Request
originator - -

getRegisterHex

public abstract java.lang.String getRegisterHex(int register)
Parameters:
register -
Returns:

getCpuInstructionDebug

public abstract boolean getCpuInstructionDebug()
Get CPU instruction debug.

Returns:
cpuInstructionDebug.

setCpuInstructionDebug

public abstract void setCpuInstructionDebug(boolean isDebugMode)
Set the CPU instruction debug.

Parameters:
isDebugMode - status of instructionDebug (on/off)

isAbnormalTermination

public abstract boolean isAbnormalTermination()
Returns if CPU halted abnormally or not

Returns:
boolean abnormalTermination true if abnormal, false otherwise

isShutdown

public abstract boolean isShutdown()
Returns if CPU halted due to full system shutdown or not

Returns:
boolean shutDown true if emulator should shutdown, false otherwise