hades.models.rtlib.memory
Class MR

java.lang.Object
  extended byhades.simulator.SimObject
      extended byhades.models.rtlib.memory.GenericMemory
          extended byhades.models.rtlib.memory.MR
All Implemented Interfaces:
java.lang.Cloneable, ContextToolTip, Memory, java.io.Serializable, Simulatable
Direct Known Subclasses:
MR20

public class MR
extends GenericMemory

MR - a microcode ROM with some bus-, a state-, and 16 single outputs.

See Also:
Serialized Form

Field Summary
protected  java.lang.String[] alabel
           
protected  int cache_read_addr
           
protected  int D_SIZE
           
protected  int[][] fdata
           
protected  int[] fdefaultValues
           
protected  java.lang.String[] flabel
           
protected  int[] flength
           
protected  boolean[] fseparator
           
protected static int[] lengthMask
           
protected  MREditorFrame MEF
           
protected  int n_fields
           
protected  int n_words
           
protected  PortStdLogicVector port_A
           
protected  PortStdLogic1164[] port_D
           
protected  PortStdLogic1164 port_S0
           
protected  PortStdLogic1164 port_S1
           
protected  Port port_STATE
           
protected  PortStdLogicVector port_X
           
protected  PortStdLogicVector port_Y
           
protected  FatLabel stateLabel
           
static double t_access
           
static double t_tristate
           
static double t_undefined
           
 
Fields inherited from class hades.models.rtlib.memory.GenericMemory
bit_mask, data, enableAnimationFlag, last_read_addr, last_read_data, last_write_addr, last_write_data, n_bits, resourcename, TRISTATED, UNDEFINED, vector_000, vector_111, vector_UUU, vector_XXX, vector_ZZZ
 
Fields inherited from class hades.simulator.SimObject
classloader, console, debug, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible
 
Constructor Summary
MR()
          MR constructor
 
Method Summary
 void configure()
          create and display a 'ConfigDialog' to set the parameters for a SimObject.
protected  void constructPorts()
           
 void createDefaultValues(int[] data)
           
 void createField(int index, int length, java.lang.String name)
           
 void createTypesAndFieldsAndMemory()
           
 void elaborate(java.lang.Object arg)
          elaborate(): On elaboration, the inputs of the MR will be undefined.
 void evaluate(java.lang.Object arg)
          evaluate(): Return the data at address after t_access
 int getData(int addr, int field)
           
 int getFieldBits(int i)
           
 int getFieldChars(int i)
           
 java.lang.String getFieldName(int i)
           
 int getNumberOfFields()
           
 int getSize()
          get the number of words in this memory.
 java.lang.String getStateLabel(int i)
           
 java.lang.String getToolTip(java.awt.Point position, long millis)
          construct a (not so short) tool tip message.
 void initializeWithDefaultValues()
           
 boolean isDefaultValue(int addr, int field)
           
 boolean isSeparator(int i)
           
 boolean parse(java.io.BufferedReader reader)
          parse RAM data from a file specified via its Java 1.1 resourcename.
 boolean save(java.io.PrintWriter PW)
          write the memory data in a trivial addr:data format, one address per line.
 void schedulePortOutput(PortStdLogicVector port, int value, double time)
           
 void scheduleSingleOutput(Port port, int value, double time)
           
 void setData(int addr, int field, int value)
           
 void setDSize()
           
 void setFieldName(int f, java.lang.String s)
           
 void setStateLabel(int addr, java.lang.String s)
           
 void setSymbol(Symbol s)
           
 
Methods inherited from class hades.models.rtlib.memory.GenericMemory
addMemoryListener, addMemoryListenerOld, canChangeSize, checkInvalidateMemory, constructStandardValues, createMemory, dataAtAddressIsUndefined, dbg, getAddressBusWidth, getAddrOffset, getBitsPerWord, getConfigDialog, getDataArray, getDataAt, getEnableAnimationFlag, getExternalResources, getHexDigitsPerWord, getHexString, getInstructionDecoder, getPropertySheet, getResourcename, initialize, initializeWithRandomValues, initializeWithX, initializeWithZeroes, isConnected, main, merge, needsExternalResources, notifyReadListeners, notifyReadListenersOld, notifyWriteListeners, notifyWriteListenersOld, parseLabelLine, parseRAM, removeMemoryListener, removeMemoryListenerOld, resize, setBitsPerWord, setDataArray, setDataAt, setEnableAnimationFlag, setEnableAnimationFlag, setInstructionDecoder, setResourcename, setSize, toString, warning, write
 
Methods inherited from class hades.simulator.SimObject
constructDynamicSymbol, copy, getBindkey, getClassLoader, getDebug, getEditor, getFullName, getName, getParent, getPort, getPorts, getResourceAsStream, getSimulator, getSymbol, getSymbolResourceName, getVersionId, isVisible, keyPressed, message, mousePressed, needsDynamicSymbol, setClassLoader, setConsole, setDebug, setEditor, setName, setParent, setPorts, setSimulator, setVersionId, setVisible, tearDown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

n_words

protected int n_words

n_fields

protected int n_fields

alabel

protected java.lang.String[] alabel

flabel

protected java.lang.String[] flabel

flength

protected int[] flength

fdata

protected int[][] fdata

fdefaultValues

protected int[] fdefaultValues

fseparator

protected boolean[] fseparator

MEF

protected MREditorFrame MEF

D_SIZE

protected int D_SIZE

stateLabel

protected FatLabel stateLabel

cache_read_addr

protected int cache_read_addr

port_A

protected PortStdLogicVector port_A

port_S1

protected PortStdLogic1164 port_S1

port_S0

protected PortStdLogic1164 port_S0

port_X

protected PortStdLogicVector port_X

port_Y

protected PortStdLogicVector port_Y

port_D

protected PortStdLogic1164[] port_D

port_STATE

protected Port port_STATE

t_access

public static final double t_access
See Also:
Constant Field Values

t_tristate

public static final double t_tristate
See Also:
Constant Field Values

t_undefined

public static final double t_undefined
See Also:
Constant Field Values

lengthMask

protected static int[] lengthMask
Constructor Detail

MR

public MR()
MR constructor

Method Detail

setDSize

public void setDSize()

createTypesAndFieldsAndMemory

public void createTypesAndFieldsAndMemory()

createField

public void createField(int index,
                        int length,
                        java.lang.String name)

getSize

public int getSize()
Description copied from interface: Memory
get the number of words in this memory.

Specified by:
getSize in interface Memory
Overrides:
getSize in class GenericMemory

getNumberOfFields

public int getNumberOfFields()

getFieldBits

public int getFieldBits(int i)

getStateLabel

public java.lang.String getStateLabel(int i)

getFieldName

public java.lang.String getFieldName(int i)

isSeparator

public boolean isSeparator(int i)

getFieldChars

public int getFieldChars(int i)

getData

public int getData(int addr,
                   int field)

setData

public void setData(int addr,
                    int field,
                    int value)

setStateLabel

public void setStateLabel(int addr,
                          java.lang.String s)

setFieldName

public void setFieldName(int f,
                         java.lang.String s)

createDefaultValues

public void createDefaultValues(int[] data)

initializeWithDefaultValues

public void initializeWithDefaultValues()
Overrides:
initializeWithDefaultValues in class GenericMemory

isDefaultValue

public boolean isDefaultValue(int addr,
                              int field)

constructPorts

protected void constructPorts()
Overrides:
constructPorts in class GenericMemory

save

public boolean save(java.io.PrintWriter PW)
write the memory data in a trivial addr:data format, one address per line. Both address and data are hex-formatted and separated by a colon (and optionally, some blanks).

Specified by:
save in interface Memory
Overrides:
save in class GenericMemory

parse

public boolean parse(java.io.BufferedReader reader)
              throws java.lang.Exception
parse RAM data from a file specified via its Java 1.1 resourcename. If the file is not found or contains illegal data, the RAM is re-initialized to the all-invalid state.

Specified by:
parse in interface Memory
Overrides:
parse in class GenericMemory
Throws:
java.lang.Exception

elaborate

public void elaborate(java.lang.Object arg)
elaborate(): On elaboration, the inputs of the MR will be undefined. Correspondingly, the outputs are, too.

Specified by:
elaborate in interface Simulatable
Overrides:
elaborate in class GenericMemory

evaluate

public void evaluate(java.lang.Object arg)
evaluate(): Return the data at address after t_access

Specified by:
evaluate in interface Simulatable
Overrides:
evaluate in class GenericMemory

scheduleSingleOutput

public void scheduleSingleOutput(Port port,
                                 int value,
                                 double time)

schedulePortOutput

public void schedulePortOutput(PortStdLogicVector port,
                               int value,
                               double time)

configure

public void configure()
Description copied from class: SimObject
create and display a 'ConfigDialog' to set the parameters for a SimObject. The default ConfigDialog for the base class (SimObject) itself is empty except for the 'instance name' of the SimObject.

Overrides:
configure in class GenericMemory

setSymbol

public void setSymbol(Symbol s)
Overrides:
setSymbol in class SimObject

getToolTip

public java.lang.String getToolTip(java.awt.Point position,
                                   long millis)
construct a (not so short) tool tip message. We write the memory class, memory size, memory name, current output value, and last read and write addresses.

Specified by:
getToolTip in interface ContextToolTip
Overrides:
getToolTip in class GenericMemory