|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthades.simulator.SimObject
hades.models.rtlib.memory.GenericMemory
GenericMemory - the base class for all Hades RTLIB memory components. Currently, the word size of the memory is limited to 63 bits.
Field Summary | |
protected long |
bit_mask
|
protected long[] |
data
|
protected boolean |
enableAnimationFlag
|
protected int |
last_read_addr
|
protected long |
last_read_data
|
protected int |
last_write_addr
|
protected long |
last_write_data
|
protected MemoryEditorFrame |
MEF
|
protected int |
n_bits
|
protected int |
n_words
|
protected java.lang.String |
resourcename
|
static int |
TRISTATED
|
static int |
UNDEFINED
|
protected StdLogicVector |
vector_000
|
protected StdLogicVector |
vector_111
|
protected StdLogicVector |
vector_UUU
|
protected StdLogicVector |
vector_XXX
|
protected StdLogicVector |
vector_ZZZ
|
Fields inherited from class hades.simulator.SimObject |
classloader, console, debug, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible |
Constructor Summary | |
GenericMemory()
|
Method Summary | |
void |
addMemoryListener(MemoryListener ML)
|
void |
addMemoryListenerOld(MemoryListener ML)
|
boolean |
canChangeSize()
|
void |
checkInvalidateMemory()
called from evaluate() when an illegal input value combination is detected, for example an undefined address during a write cycle. |
void |
configure()
create and display a 'ConfigDialog' to set the parameters for a SimObject. |
protected void |
constructPorts()
|
protected void |
constructStandardValues()
|
void |
createMemory()
|
boolean |
dataAtAddressIsUndefined(int addr)
|
void |
dbg(java.lang.String msg)
|
void |
elaborate(java.lang.Object arg)
elaborate(): No use to call elaborate on a GenericMemory. |
void |
evaluate(java.lang.Object arg)
evaluate(): No use to call elaborate on a GenericMemory. |
int |
getAddressBusWidth()
|
int |
getAddrOffset()
utility method to support systems with different memory components mapped into a single address space at different offsets. |
int |
getBitsPerWord()
return the number of bits per word in this memory. |
PropertySheet |
getConfigDialog()
|
long[] |
getDataArray()
|
long |
getDataAt(int address)
|
boolean |
getEnableAnimationFlag()
|
java.lang.String[] |
getExternalResources()
return a String[] array of length 1 with our memory initialization file. |
int |
getHexDigitsPerWord()
|
protected java.lang.String |
getHexString(long value,
int n_chars)
|
InstructionDecoder |
getInstructionDecoder()
|
java.awt.Component |
getPropertySheet()
return a reference to the 'property sheet' or configuration window for this SimObject. |
java.lang.String |
getResourcename()
|
int |
getSize()
get the number of words in this memory. |
java.lang.String |
getToolTip(java.awt.Point position,
long millis)
construct a (not so short) tool tip message. |
boolean |
initialize(java.lang.String s)
initialize a GenericMemory from a String. |
void |
initializeWithDefaultValues()
|
void |
initializeWithRandomValues()
|
void |
initializeWithX()
|
void |
initializeWithZeroes()
|
boolean |
isConnected()
|
static void |
main(java.lang.String[] argv)
|
boolean |
merge(java.io.BufferedReader reader)
|
boolean |
needsExternalResources()
we use one external resource: the data file to initialize the memory. |
protected void |
notifyReadListeners(int address,
long value)
|
protected void |
notifyReadListenersOld(int address,
long value)
|
protected void |
notifyWriteListeners(int address,
long old_value,
long new_value)
|
protected void |
notifyWriteListenersOld(int address,
long old_value,
long new_value)
|
boolean |
parse(java.io.BufferedReader br)
parse RAM data from a file specified via its Java 1.1 resourcename. |
protected void |
parseLabelLine(java.lang.String line)
|
void |
parseRAM(java.lang.String resourcename)
|
void |
removeMemoryListener(MemoryListener ML)
|
void |
removeMemoryListenerOld(MemoryListener ML)
|
boolean |
resize(int n_words,
int n_bits_per_word)
|
boolean |
save(java.io.PrintWriter PW)
write the memory data in a trivial addr:data format, one address per line. |
void |
setBitsPerWord(int n_bits)
|
void |
setDataArray(long[] data)
|
void |
setDataAt(int address,
long value)
|
void |
setEnableAnimationFlag(boolean b)
|
void |
setEnableAnimationFlag(java.lang.String s)
|
void |
setInstructionDecoder(InstructionDecoder decoder)
|
void |
setResourcename(java.lang.String s)
|
void |
setSize(int n_words)
|
java.lang.String |
toString()
toString: generate a text description for this SimObject. |
void |
warning(java.lang.String s)
print a warning message to the Hades console, consisting of the actual message 's', the full name of this memory component and the current simulation time. |
void |
write(java.io.PrintWriter ps)
|
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, setSymbol, setVersionId, setVisible, tearDown |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String resourcename
protected int n_words
protected int n_bits
protected long[] data
protected long bit_mask
protected long last_read_data
protected long last_write_data
protected int last_read_addr
protected int last_write_addr
protected StdLogicVector vector_UUU
protected StdLogicVector vector_XXX
protected StdLogicVector vector_ZZZ
protected StdLogicVector vector_000
protected StdLogicVector vector_111
protected boolean enableAnimationFlag
public static final int UNDEFINED
public static final int TRISTATED
protected MemoryEditorFrame MEF
Constructor Detail |
public GenericMemory()
Method Detail |
public boolean needsExternalResources()
needsExternalResources
in class SimObject
public java.lang.String[] getExternalResources()
getExternalResources
in class SimObject
protected void constructPorts()
protected void constructStandardValues()
public boolean getEnableAnimationFlag()
public void setEnableAnimationFlag(boolean b)
public void setEnableAnimationFlag(java.lang.String s)
public void setInstructionDecoder(InstructionDecoder decoder)
public InstructionDecoder getInstructionDecoder()
public boolean isConnected()
public void createMemory()
public boolean dataAtAddressIsUndefined(int addr)
public void initializeWithZeroes()
public void initializeWithDefaultValues()
public void initializeWithX()
public void initializeWithRandomValues()
public java.lang.String getResourcename()
getResourcename
in interface Memory
public void setResourcename(java.lang.String s)
setResourcename
in interface Memory
public boolean initialize(java.lang.String s)
1002 n_words n_bits /hades/examples/b-tutorial/ampel-43.rom
initialize
in class SimObject
public void write(java.io.PrintWriter ps)
write
in class SimObject
public int getSize()
Memory
getSize
in interface Memory
public void setSize(int n_words) throws java.lang.Exception
setSize
in interface Memory
java.lang.Exception
public boolean resize(int n_words, int n_bits_per_word) throws java.lang.Exception
resize
in interface Memory
java.lang.Exception
public int getAddressBusWidth()
public void setDataAt(int address, long value)
setDataAt
in interface Memory
public long getDataAt(int address)
getDataAt
in interface Memory
public int getBitsPerWord()
Memory
getBitsPerWord
in interface Memory
public void setBitsPerWord(int n_bits) throws java.lang.Exception
setBitsPerWord
in interface Memory
java.lang.Exception
public int getHexDigitsPerWord()
public boolean canChangeSize()
canChangeSize
in interface Memory
public long[] getDataArray()
getDataArray
in interface Memory
public void setDataArray(long[] data)
setDataArray
in interface Memory
public boolean merge(java.io.BufferedReader reader)
merge
in interface Memory
public void addMemoryListener(MemoryListener ML)
addMemoryListener
in interface Memory
public void removeMemoryListener(MemoryListener ML)
removeMemoryListener
in interface Memory
public void addMemoryListenerOld(MemoryListener ML)
public void removeMemoryListenerOld(MemoryListener ML)
protected void notifyWriteListenersOld(int address, long old_value, long new_value)
protected void notifyReadListenersOld(int address, long value)
public void parseRAM(java.lang.String resourcename)
public boolean parse(java.io.BufferedReader br) throws java.lang.Exception
Each line of the RAM data file should contain the address and the corresponding data in hex format, seperated by a colon, e.g. '0001:D300000000FF' or '03FF:FEDCBA9876543210'.
The alternative DigLOG compact format, e.g. '0000:000102030405060708090A0B0C0D0E0F' is NOT accepted, because this is useful only for byte-oriented memories.
Input file lines starting with a '#' or ';' character are interpreted as comment lines and are ignored.
The RAM model will issue a warning message, if the same location is written multiple times.
parse
in interface Memory
java.lang.Exception
protected void parseLabelLine(java.lang.String line) throws java.lang.Exception
java.lang.Exception
protected java.lang.String getHexString(long value, int n_chars)
public boolean save(java.io.PrintWriter PW)
save
in interface Memory
public void configure()
SimObject
configure
in class SimObject
public java.awt.Component getPropertySheet()
SimObject
getPropertySheet
in class SimObject
public void elaborate(java.lang.Object arg)
elaborate
in interface Simulatable
elaborate
in class SimObject
public void evaluate(java.lang.Object arg)
evaluate
in interface Simulatable
evaluate
in class SimObject
arg
- an arbitrary object argumentprotected void notifyWriteListeners(int address, long old_value, long new_value)
protected void notifyReadListeners(int address, long value)
public void dbg(java.lang.String msg)
public void warning(java.lang.String s)
public void checkInvalidateMemory()
public java.lang.String getToolTip(java.awt.Point position, long millis)
getToolTip
in interface ContextToolTip
getToolTip
in class SimObject
public java.lang.String toString()
SimObject
toString
in class SimObject
public static void main(java.lang.String[] argv)
public int getAddrOffset()
Memory
For example, the D*CORE processor used in our T3 practical course uses one ROM mapped to addresses 0x000..0x6FFF with address offset 0, a RAM mapped to addresses 0x8000..0xFFFF with address offset 0x8000, and IO components mapped to 0x7000..0x7FFF. Standard memory components will usually return 0 here.
getAddrOffset
in interface Memory
public PropertySheet getConfigDialog()
getConfigDialog
in interface Memory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |