hades.models.memory
Interface Memory

All Known Implementing Classes:
GenericMemory, IDT6116, IDT6164, RAM_256x8, ROM_1Kx8, ROM_256x8, ROM_64Kx8, ROM_64x8, ROM_8Kx8, SN74189, SN74219

public interface Memory

Memory - The base interface model for HADES memories, with several access and utility functions. All memory SimObjects should implement this interface, in order to be used with hades.gui.MemoryEditorFrame and similar utility classes.

For performance reasons, we assume that the memory array is realized as an array of long values, with optional parallel arrays for additional information like 'X' or 'U' values, access statistics, ...


Method Summary
 void addMemoryListener(MemoryListener ML)
           
 boolean canChangeSize()
           
 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)
           
 java.lang.String getResourcename()
           
 int getSize()
          get the number of words in this memory.
 boolean merge(java.io.BufferedReader reader)
           
 boolean parse(java.io.BufferedReader reader)
           
 void removeMemoryListener(MemoryListener ML)
           
 boolean resize(int n_words, int n_bits_per_word)
           
 boolean save(java.io.PrintWriter PW)
           
 void setBitsPerWord(int n_bits)
           
 void setDataArray(long[] data)
           
 void setDataAt(int address, long value)
           
 void setResourcename(java.lang.String name)
           
 void setSize(int n_words)
           
 

Method Detail

getAddrOffset

public int getAddrOffset()
utility method to support systems with different memory components mapped into a single address space at different offsets. Note that the value returned is just used for displaying the addresses in the GUI (e.g. MemoryHexEditorField or MRCanvas), while the simulation uses the raw adresses (always starting at 0).

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.


getSize

public int getSize()
get the number of words in this memory.


setSize

public void setSize(int n_words)
             throws java.lang.Exception
Throws:
java.lang.Exception

getBitsPerWord

public int getBitsPerWord()
return the number of bits per word in this memory. This should typically be in the range 1 .. 64.


setBitsPerWord

public void setBitsPerWord(int n_bits)
                    throws java.lang.Exception
Throws:
java.lang.Exception

canChangeSize

public boolean canChangeSize()

resize

public boolean resize(int n_words,
                      int n_bits_per_word)
               throws java.lang.Exception
Throws:
java.lang.Exception

getDataAt

public long getDataAt(int address)

setDataAt

public void setDataAt(int address,
                      long value)

getDataArray

public long[] getDataArray()

setDataArray

public void setDataArray(long[] data)

parse

public boolean parse(java.io.BufferedReader reader)
              throws java.lang.Exception
Throws:
java.lang.Exception

merge

public boolean merge(java.io.BufferedReader reader)
              throws java.lang.Exception
Throws:
java.lang.Exception

save

public boolean save(java.io.PrintWriter PW)
             throws java.lang.Exception
Throws:
java.lang.Exception

getResourcename

public java.lang.String getResourcename()

setResourcename

public void setResourcename(java.lang.String name)

getConfigDialog

public PropertySheet getConfigDialog()

addMemoryListener

public void addMemoryListener(MemoryListener ML)

removeMemoryListener

public void removeMemoryListener(MemoryListener ML)