hades.models.register
Class LFSRAnalyzer

java.lang.Object
  extended byhades.simulator.SimObject
      extended byhades.models.gates.GenericGate
          extended byhades.models.register.LFSRAnalyzer
All Implemented Interfaces:
java.lang.Cloneable, ContextToolTip, java.io.Serializable, Simulatable
Direct Known Subclasses:
LFSRAnalyzer16, LFSRAnalyzer24, LFSRAnalyzer32, LFSRAnalyzer8

public class LFSRAnalyzer
extends GenericGate
implements Simulatable

LFSRAnalyzer: abstract base class for a 32-bit LFSR pseudorandom signature analyzer based on the (31 3 0) polynom.

Subclasses will sample their ports and generate an input value consisting of zeroes for the highest bits, and 0/1 values based on the inputs for the lowest bits. To keep things manageable, we interpret StdLogic1164 values '1' and 'H' as 1, all other StdLogic1164 values including 'U' and 'X' as 0. For example, when used with 8-bit inputs "UW010011", the signature will be updated by the 32-bits MSB "0000 0000 0000 0000 0000 0000" + "0001 0011" LSB Use setValue() and getValue() to initialize and read-out the LFSR value.

To allow detection of undefined ('U', 'X', 'Z', etc.) input values, this class also maintains an integer mask called 'uxz_mask' that is reset during elaborate() or when the reset input for the register is active. Whenever an data input to the LFSRAnalyzer has an StdLogic1164.is_UXZ() value, the corresponding bit in variable 'uxz_mask' is set. Use setUXZMask() and getUXZMask() to set and/or read the mask value.

See Also:
Serialized Form

Field Summary
protected  int n_inputs
           
protected  PortStdLogic1164 port_CLK
           
protected  PortStdLogic1164 port_NRESET
           
 
Fields inherited from class hades.models.gates.GenericGate
t_delay
 
Fields inherited from class hades.simulator.SimObject
classloader, console, debug, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible
 
Constructor Summary
LFSRAnalyzer(int n_inputs)
           
 
Method Summary
 void configure()
          create and display a 'ConfigDialog' to set the parameters for a SimObject.
 void elaborate(java.lang.Object arg)
          on elaboration, set the initial value of the LFSR32 to "seed".
 void evaluate(java.lang.Object arg)
          evaluate: on a rising-edge of the CLK input calculate a new shift-register value, and put the lower bits of the new value on the Q outputs.
 int getExpectedValue()
           
 int getSeed()
           
 java.lang.String getToolTip(java.awt.Point position, long millis)
          construct a (short) tool tip message for a logic gate with name, class name, and gate delay.
 int getUXZMask()
           
 int getValue()
           
 boolean initialize(java.lang.String s)
          initialize the LFSR from a String that contains the integer version id of this gate, its propagation delay (in seconds), and the initial (seed) value for the shift-register, e.g.
 void setExpectedValue(int value)
           
 void setExpectedValue(java.lang.String s)
           
 void setSeed(int seed)
           
 void setSeed(java.lang.String s)
           
 void setUXZMask(int mask)
           
 void setUXZMask(java.lang.String s)
           
 void setValue(int value)
           
 void setValue(java.lang.String s)
           
 void write(java.io.PrintWriter ps)
          write "versionId", gate delay "t_delay", seed "seed"
 
Methods inherited from class hades.models.gates.GenericGate
copy, getDelay, scheduleEvent, scheduleEventAfter, scheduleOutputValue, scheduleOutputValueAfter, setDelay, setDelay
 
Methods inherited from class hades.simulator.SimObject
constructDynamicSymbol, getBindkey, getClassLoader, getDebug, getEditor, getExternalResources, getFullName, getName, getParent, getPort, getPorts, getPropertySheet, getResourceAsStream, getSimulator, getSymbol, getSymbolResourceName, getVersionId, isVisible, keyPressed, message, mousePressed, needsDynamicSymbol, needsExternalResources, setClassLoader, setConsole, setDebug, setEditor, setName, setParent, setPorts, setSimulator, setSymbol, setVersionId, setVisible, tearDown, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface hades.simulator.Simulatable
message
 

Field Detail

n_inputs

protected int n_inputs

port_CLK

protected PortStdLogic1164 port_CLK

port_NRESET

protected PortStdLogic1164 port_NRESET
Constructor Detail

LFSRAnalyzer

public LFSRAnalyzer(int n_inputs)
Method Detail

elaborate

public void elaborate(java.lang.Object arg)
on elaboration, set the initial value of the LFSR32 to "seed".

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

evaluate

public void evaluate(java.lang.Object arg)
evaluate: on a rising-edge of the CLK input calculate a new shift-register value, and put the lower bits of the new value on the Q outputs. Input events on other ports than NR and CLK are ignored.

Specified by:
evaluate in interface Simulatable
Overrides:
evaluate in class SimObject
Parameters:
arg - an arbitrary object argument

write

public void write(java.io.PrintWriter ps)
write "versionId", gate delay "t_delay", seed "seed"

Overrides:
write in class GenericGate

initialize

public boolean initialize(java.lang.String s)
initialize the LFSR from a String that contains the integer version id of this gate, its propagation delay (in seconds), and the initial (seed) value for the shift-register, e.g. '1001 0.5E-8 12343775'.

Overrides:
initialize in class GenericGate

getValue

public int getValue()

setValue

public void setValue(java.lang.String s)

setValue

public void setValue(int value)

getExpectedValue

public int getExpectedValue()

setExpectedValue

public void setExpectedValue(int value)

setExpectedValue

public void setExpectedValue(java.lang.String s)

getSeed

public int getSeed()

setSeed

public void setSeed(java.lang.String s)

setSeed

public void setSeed(int seed)

getUXZMask

public int getUXZMask()

setUXZMask

public void setUXZMask(int mask)

setUXZMask

public void setUXZMask(java.lang.String s)

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 GenericGate

getToolTip

public java.lang.String getToolTip(java.awt.Point position,
                                   long millis)
Description copied from class: GenericGate
construct a (short) tool tip message for a logic gate with name, class name, and gate delay.

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