hades.models.pic
Class PicEeprom

java.lang.Object
  extended byhades.models.pic.PicEeprom
All Implemented Interfaces:
PicMemory

public class PicEeprom
extends java.lang.Object
implements PicMemory

PicEeprom - The Eeprom-data-memory implemented in Microchip-microcontrollers


Field Summary
protected  int bits
           
protected  int bytes
           
protected  PicReg eeadr
           
protected  PicReg eecon1
           
protected  PicReg eedata
           
protected  long[] eeprom
           
protected  java.lang.String filename
           
protected  long maxWord
           
protected  boolean nextWrite
           
 
Constructor Summary
PicEeprom(int size, int bitsPerWord, PicReg newEedata, PicReg newEeadr, PicReg newEecon1)
          Constructor with the opportunity to change the size and the number of bits per word the Eprom is using
 
Method Summary
 java.lang.String getFilename()
           
 int getMemorySize()
          getMemorySize reports the size of the eprom in words
 int getWordWidth()
          getWordWidth reports the width of one word in bits
 boolean load(java.lang.Object parent, java.lang.String resourcename)
          load the PicEprom contents from a resource called "resourcename" and belonging to SimObject "parent".
 void load(java.lang.String name, java.lang.String dir)
          Open the given filename and load the content into the EEPROM.
 boolean loadHEX(java.io.InputStream is)
           
 boolean loadROM(java.io.InputStream is)
           
 void por()
          Power-on-reset, just call reset
 void readEeprom()
          Read a word from the eeprom: address is taken from eeadr and value will be written to eedata
 int readMemory(int address)
          Read a word, from interface PicMemory
 void reset()
          Reset, report aborted write requests
 boolean resize(int i, int j)
           
 void save(java.lang.String name, java.lang.String dir)
           
 void setFilename(java.lang.String name)
           
 void setFilename(java.lang.String name, java.lang.String dir)
           
 void wakeup()
          Is called from every wakeup event in Pic16C84 and performs the write operation.
 void writeEeprom()
          Write a word to the eeprom: eepromWakeup() will write, this method informs eepromWakeup() to write
 void writeMemory(int address, int word)
          Write a word, from interface PicMemory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bits

protected int bits

maxWord

protected long maxWord

bytes

protected int bytes

eeprom

protected long[] eeprom

filename

protected java.lang.String filename

eedata

protected PicReg eedata

eeadr

protected PicReg eeadr

eecon1

protected PicReg eecon1

nextWrite

protected boolean nextWrite
Constructor Detail

PicEeprom

public PicEeprom(int size,
                 int bitsPerWord,
                 PicReg newEedata,
                 PicReg newEeadr,
                 PicReg newEecon1)
Constructor with the opportunity to change the size and the number of bits per word the Eprom is using

Method Detail

por

public void por()
Power-on-reset, just call reset


reset

public void reset()
Reset, report aborted write requests


resize

public boolean resize(int i,
                      int j)

getMemorySize

public int getMemorySize()
getMemorySize reports the size of the eprom in words

Specified by:
getMemorySize in interface PicMemory

getWordWidth

public int getWordWidth()
getWordWidth reports the width of one word in bits

Specified by:
getWordWidth in interface PicMemory

readMemory

public int readMemory(int address)
Read a word, from interface PicMemory

Specified by:
readMemory in interface PicMemory

writeMemory

public void writeMemory(int address,
                        int word)
Write a word, from interface PicMemory

Specified by:
writeMemory in interface PicMemory

setFilename

public void setFilename(java.lang.String name)

setFilename

public void setFilename(java.lang.String name,
                        java.lang.String dir)

getFilename

public java.lang.String getFilename()

load

public void load(java.lang.String name,
                 java.lang.String dir)
Open the given filename and load the content into the EEPROM. Format: Hex-Numbers seperated by spaces and line-feeds are stored beginning by address 0. If a number ends with a colon, it is the address the following numbers are stored at.


load

public boolean load(java.lang.Object parent,
                    java.lang.String resourcename)
load the PicEprom contents from a resource called "resourcename" and belonging to SimObject "parent". This method uses DesignManager to lookup an InputStream for the resource; if the name ends with ".hex" we expect Intel HEX-format data, and raw ".rom" data otherwise.


loadROM

public boolean loadROM(java.io.InputStream is)

loadHEX

public boolean loadHEX(java.io.InputStream is)

save

public void save(java.lang.String name,
                 java.lang.String dir)

writeEeprom

public void writeEeprom()
Write a word to the eeprom: eepromWakeup() will write, this method informs eepromWakeup() to write


readEeprom

public void readEeprom()
Read a word from the eeprom: address is taken from eeadr and value will be written to eedata


wakeup

public void wakeup()
Is called from every wakeup event in Pic16C84 and performs the write operation. The address is taken from eeadr, the value to be written is taken from eedata. After the completion some bits in eecon1 get set