hades.models.register
Class LFSRAnalyzer
java.lang.Object
hades.simulator.SimObject
hades.models.gates.GenericGate
hades.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.
- See Also:
- Serialized Form
Fields inherited from class hades.simulator.SimObject |
classloader, console, debug, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible |
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 |
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 |
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 |
setSeed(int seed)
|
void |
setSeed(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.simulator.SimObject |
constructDynamicSymbol, getClassLoader, getDebug, getEditor, getExternalResources, getFullName, getName, getParent, getPort, getPorts, getPropertySheet, getResourceAsStream, getSimulator, getSymbol, getSymbolResourceName, getVersionId, isVisible, message, mousePressed, needsDynamicSymbol, needsExternalResources, setClassLoader, setConsole, setDebug, setEditor, setName, setParent, setPorts, setSimulator, setSymbol, setVersionId, setVisible, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
n_inputs
protected int n_inputs
port_CLK
protected PortStdLogic1164 port_CLK
port_NRESET
protected PortStdLogic1164 port_NRESET
LFSRAnalyzer
public LFSRAnalyzer(int n_inputs)
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)
getSeed
public int getSeed()
setSeed
public void setSeed(java.lang.String s)
setSeed
public void setSeed(int seed)
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