nl.kbna.dioscuri.module.motherboard
Class Motherboard

java.lang.Object
  extended by nl.kbna.dioscuri.module.Module
      extended by nl.kbna.dioscuri.module.ModuleMotherboard
          extended by nl.kbna.dioscuri.module.motherboard.Motherboard

public class Motherboard
extends ModuleMotherboard

An implementation of a motherboard module. This module is responsible for allowing devices to communicate with the CPU and vice versa.

See Also:
Metadata module ******************************************** general.type : motherboard general.name : General x86 motherboard general.architecture : Von Neumann general.description : imitates an x86 motherboard including I/O address space, ... general.creator : Tessella Support Services, Koninklijke Bibliotheek, Nationaal Archief of the Netherlands general.version : 1.0 general.keywords : motherboard, mainboard, ioports, ... general.relations : cpu, devices general.yearOfIntroduction : general.yearOfEnding : general.ancestor : general.successor : motherboard.ioAddressSpaceSize : 65536 bytes motherboard.architecture : ISA, EISA, PCI Rule: This module should always be initialised before I/O devices.

Field Summary
private  boolean A20Enabled
           
private  ModuleClock clock
           
private  ModuleCPU cpu
           
private  boolean debugMode
           
private  Devices devices
           
private  Emulator emu
           
 ModuleDevice[] ioAddressSpace
           
static int IOSPACE_EISA_SIZE
           
static int IOSPACE_ISA_SIZE
           
protected  int ioSpaceSize
           
private  boolean isObserved
           
private static java.util.logging.Logger logger
           
private  ModuleMemory memory
           
static int MODULE_ID
           
static java.lang.String MODULE_NAME
           
static java.lang.String MODULE_TYPE
           
private  java.lang.String[] moduleConnections
           
static int SYSTEM_CONTROL_PORT_A
           
 
Constructor Summary
Motherboard(Emulator owner)
          Class constructor
 
Method Summary
 boolean getA20()
          Return A20 address line status
 java.lang.String[] getConnection()
          Returns a String[] with all names of modules it needs to be connected to
 long getCurrentInstructionNumber()
          Retrieve current number of instruction (instructions executed so far)
 byte[] getData(Module requester)
          Returns data from this module
 boolean getDebugMode()
          Returns the status of the debug mode toggle
 java.lang.String getDump()
          Returns a dump of this module
 int getID()
          Returns the ID of the module
 byte getIOPortByte(int portAddress)
          Return I/O port data from I/O address space
 byte[] getIOPortDoubleWord(int portAddress)
          Return a double word from I/O address space at given port
 byte[] getIOPortWord(int portAddress)
          Return a word from I/O address space at given port
 java.lang.String getName()
          Returns the name of the module
 java.lang.String getType()
          Returns the type of the module
 boolean isConnected()
          Checks if this module is connected to operate normally NOTE: not all devices are required, so they are not checked
 boolean isObserved()
          Returns the status of observed toggle
 boolean registerClock(ModuleClock clock)
          Registers a clock to motherboard
 boolean requestTimer(ModuleDevice device, int updateInterval, boolean continuous)
          Requests a timer for given device at clock
 boolean reset()
          Reset all parameters of module
 boolean resetTimer(ModuleDevice device, int updateInterval)
          Resets the timer of device (if any)
 void setA20(boolean a20)
          Set A20 address line status
 boolean setConnection(Module module)
          Sets up a connection with another module
 boolean setData(byte[] data, Module sender)
          Set data for this module
 boolean setData(java.lang.String[] data, Module sender)
          Set String[] data for this module
 void setDebugMode(boolean status)
          Sets the debug mode toggle
 boolean setIOPort(int portAddress, ModuleDevice device)
          Set I/O address port to given device
 void setIOPortByte(int portAddress, byte dataByte)
          Set a byte in I/O address space at given port
 void setIOPortDoubleWord(int portAddress, byte[] dataDoubleWord)
          Set a double word in I/O address space at given port
 void setIOPortWord(int portAddress, byte[] dataWord)
          Set a word in I/O address space at given port
 void setObserved(boolean status)
          Sets the observed toggle
 boolean setTimerActiveState(ModuleDevice device, boolean activeState)
          Set a timer to start/stop running
 void start()
          Starts the module
 void stop()
          Stops the module
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

emu

private Emulator emu

moduleConnections

private java.lang.String[] moduleConnections

cpu

private ModuleCPU cpu

memory

private ModuleMemory memory

devices

private Devices devices

clock

private ModuleClock clock

isObserved

private boolean isObserved

debugMode

private boolean debugMode

A20Enabled

private boolean A20Enabled

ioSpaceSize

protected int ioSpaceSize

ioAddressSpace

public ModuleDevice[] ioAddressSpace

logger

private static java.util.logging.Logger logger

MODULE_ID

public static final int MODULE_ID
See Also:
Constant Field Values

MODULE_TYPE

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

MODULE_NAME

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

IOSPACE_ISA_SIZE

public static final int IOSPACE_ISA_SIZE
See Also:
Constant Field Values

IOSPACE_EISA_SIZE

public static final int IOSPACE_EISA_SIZE
See Also:
Constant Field Values

SYSTEM_CONTROL_PORT_A

public static final int SYSTEM_CONTROL_PORT_A
See Also:
Constant Field Values
Constructor Detail

Motherboard

public Motherboard(Emulator owner)
Class constructor

Method Detail

getID

public int getID()
Returns the ID of the module

Specified by:
getID in class Module
Returns:
string containing the ID of module
See Also:
Module

getType

public java.lang.String getType()
Returns the type of the module

Specified by:
getType in class Module
Returns:
string containing the type of module
See Also:
Module

getName

public java.lang.String getName()
Returns the name of the module

Specified by:
getName in class Module
Returns:
string containing the name of module
See Also:
Module

getConnection

public java.lang.String[] getConnection()
Returns a String[] with all names of modules it needs to be connected to

Specified by:
getConnection in class Module
Returns:
String[] containing the names of modules, or null if no connections

setConnection

public boolean setConnection(Module module)
Sets up a connection with another module

Specified by:
setConnection in class Module
Parameters:
mod - Module that is to be connected to this class
Returns:
true if connection has been established successfully, false otherwise
See Also:
Module

isConnected

public boolean isConnected()
Checks if this module is connected to operate normally NOTE: not all devices are required, so they are not checked

Specified by:
isConnected in class Module
Returns:
true if this module is connected successfully, false otherwise

reset

public boolean reset()
Reset all parameters of module

Specified by:
reset in class Module
Returns:
boolean true if module has been reset successfully, false otherwise

start

public void start()
Starts the module

Specified by:
start in class Module
See Also:
Module

stop

public void stop()
Stops the module

Specified by:
stop in class Module
See Also:
Module

isObserved

public boolean isObserved()
Returns the status of observed toggle

Specified by:
isObserved in class Module
Returns:
state of observed toggle
See Also:
Module

setObserved

public void setObserved(boolean status)
Sets the observed toggle

Specified by:
setObserved in class Module
Parameters:
status -
See Also:
Module

getDebugMode

public boolean getDebugMode()
Returns the status of the debug mode toggle

Specified by:
getDebugMode in class Module
Returns:
state of debug mode toggle
See Also:
Module

setDebugMode

public void setDebugMode(boolean status)
Sets the debug mode toggle

Specified by:
setDebugMode in class Module
Parameters:
status -
See Also:
Module

getData

public byte[] getData(Module requester)
Returns data from this module

Specified by:
getData in class Module
Parameters:
Module - requester, the requester of the data
Returns:
byte[] with data
See Also:
Module

setData

public boolean setData(byte[] data,
                       Module sender)
Set data for this module

Specified by:
setData in class Module
Parameters:
byte[] - data
Module - sender, the sender of the data
Returns:
boolean true if successful, false otherwise
See Also:
Module

setData

public boolean setData(java.lang.String[] data,
                       Module sender)
Set String[] data for this module

Specified by:
setData in class Module
Parameters:
String[] - data
Module - sender, the sender of the data
Returns:
boolean true is successful, false otherwise
See Also:
Module

getDump

public java.lang.String getDump()
Returns a dump of this module

Specified by:
getDump in class Module
Returns:
string
See Also:
Module

registerClock

public boolean registerClock(ModuleClock clock)
Registers a clock to motherboard

Specified by:
registerClock in class ModuleMotherboard
Returns:
boolean true if registration is successfully, false otherwise

requestTimer

public boolean requestTimer(ModuleDevice device,
                            int updateInterval,
                            boolean continuous)
Requests a timer for given device at clock

Specified by:
requestTimer in class ModuleMotherboard
Parameters:
ModuleDevice - device that requests the timer
int - updateInterval defining the frequency that update has to be done in microseconds
Returns:
boolean true if registration is successfully, false otherwise

setTimerActiveState

public boolean setTimerActiveState(ModuleDevice device,
                                   boolean activeState)
Set a timer to start/stop running

Specified by:
setTimerActiveState in class ModuleMotherboard
Parameters:
ModuleDevice - device that request a timer to be set
boolean - runState the state to set the timer to (start/stop)
Returns:
boolean true if timer is reset successfully, false otherwise

resetTimer

public boolean resetTimer(ModuleDevice device,
                          int updateInterval)
Resets the timer of device (if any)

Specified by:
resetTimer in class ModuleMotherboard
Parameters:
ModuleDevice - device that requests the timer reset
int - updateInterval defining the frequency that update has to be done in microseconds
Returns:
boolean true if reset is successfully, false otherwise

setIOPort

public boolean setIOPort(int portAddress,
                         ModuleDevice device)
Set I/O address port to given device

Specified by:
setIOPort in class ModuleMotherboard
Parameters:
int - portAddress containing the address of the I/O port
ModuleDevice - device
Returns:
boolean true if data is set successfully, false otherwise

getIOPortByte

public byte getIOPortByte(int portAddress)
                   throws ModuleException
Return I/O port data from I/O address space

Specified by:
getIOPortByte in class ModuleMotherboard
Parameters:
int - portAddress containing the address of the I/O port
Returns:
byte containing the data at given I/O address port
Throws:
ModuleException

setIOPortByte

public void setIOPortByte(int portAddress,
                          byte dataByte)
                   throws ModuleException
Set a byte in I/O address space at given port

Specified by:
setIOPortByte in class ModuleMotherboard
Parameters:
int - portAddress containing the address of the I/O port
byte - data
Throws:
ModuleException, - ModuleWriteOnlyPortException
ModuleException

getIOPortWord

public byte[] getIOPortWord(int portAddress)
                     throws ModuleException
Return a word from I/O address space at given port

Specified by:
getIOPortWord in class ModuleMotherboard
Parameters:
int - portAddress containing the address of the I/O port
Returns:
byte[] containing the word at given I/O address port
Throws:
ModuleException

setIOPortWord

public void setIOPortWord(int portAddress,
                          byte[] dataWord)
                   throws ModuleException
Set a word in I/O address space at given port

Specified by:
setIOPortWord in class ModuleMotherboard
Parameters:
int - portAddress containing the address of the I/O port
byte[] - word
Throws:
ModuleException, - ModuleWriteOnlyPortException
ModuleException

getIOPortDoubleWord

public byte[] getIOPortDoubleWord(int portAddress)
                           throws ModuleException
Return a double word from I/O address space at given port

Specified by:
getIOPortDoubleWord in class ModuleMotherboard
Parameters:
int - portAddress containing the address of the I/O port
Returns:
byte[] containing the double word at given I/O address port
Throws:
ModuleException

setIOPortDoubleWord

public void setIOPortDoubleWord(int portAddress,
                                byte[] dataDoubleWord)
                         throws ModuleException
Set a double word in I/O address space at given port

Specified by:
setIOPortDoubleWord in class ModuleMotherboard
Parameters:
int - portAddress containing the address of the I/O port
byte[] - double word
Throws:
ModuleException, - ModuleWriteOnlyPortException
ModuleException

getA20

public boolean getA20()
Return A20 address line status

Specified by:
getA20 in class ModuleMotherboard
Returns:
boolean true if A20 is enabled, false otherwise

setA20

public void setA20(boolean a20)
Set A20 address line status

Specified by:
setA20 in class ModuleMotherboard
Parameters:
boolean - true to enable A20, false otherwise

getCurrentInstructionNumber

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

Specified by:
getCurrentInstructionNumber in class ModuleMotherboard
Returns:
long containing number of instructions