|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthades.simulator.SimObject
hades.models.fsm.FsmWrapper
FsmWrapper - A simple adapter class that allows to integrate JavaFSM state machines into HADES designs.
For documentation about JavaFSM and the class/source files check the JavaFSM homepage
FsmWrapper provides all functionality required to integrate a JavaFSM
state machine into the HADES editor and simulation, namely the
SimObject interface, a (dynamically constructed) Symbol, and
the mapping from StdLogic1164 logic values to the 01X logic model
used in JavaFSM.
On the other hand, all state machine editing functions are provided
by JavaFSM. FsmWrapper will start the JavaFSM editor whenever
the user selects "edit..." from the HADES popup menu on a FsmWrapper
object.
On instantiation of a FsmWrapper, the following steps are taken:
Please note the following differences between the standalone JavaFSM application/applet and the JavaFSM state machines in HADES.
FSM
,
Serialized FormField Summary | |
protected boolean |
debug
|
(package private) java.lang.String |
DEFAULT_FSM_NAME
|
protected FSM |
fsm
|
protected FsmRenderer |
fsmRenderer
|
protected java.lang.String |
fsmResourceName
|
(package private) int |
n_inputs
|
(package private) int |
n_outputs
|
protected Port |
port_CLK
|
protected Port |
port_NR
|
protected Port |
port_STATE
|
protected double |
t_delay
|
protected StdLogic1164 |
value_0
|
protected StdLogic1164 |
value_1
|
protected StdLogic1164 |
value_U
|
protected StdLogic1164 |
value_X
|
Fields inherited from class hades.simulator.SimObject |
classloader, console, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible |
Constructor Summary | |
FsmWrapper()
FsmWrapper(): the default constructor as used for all SimObjects in HADES. |
Method Summary | |
void |
configure()
configure(): This method constructs the JavaFSM editor for our current FSM. |
void |
constructDynamicSymbol()
constructDynamicSymbol(): This method is called by the editor as soon as a Symbol for the FSM is needed. |
SimObject |
copy()
copy(): This function is used to create a clone of the current FSM. |
void |
elaborate(java.lang.Object arg)
elaborate(): we store a reference to our simulation engine. |
void |
evaluate(java.lang.Object arg)
evaluate(): |
java.lang.String[] |
getExternalResources()
return a String[] array of length 1 with our current FSM design name |
FSM |
getFSM()
return a reference to our FSM |
java.lang.String |
getFsmResourceName()
return the current (Java 1.1 resource-) name of our FSM data file. |
java.awt.Component |
getPropertySheet()
return a reference to the 'property sheet' or configuration window for this SimObject. |
boolean |
initialize(java.lang.String s)
initialize a FSM from a String which contains the integer version ID and the (Java 1.1) resource name of the FSM data file, e.g. |
void |
invalidateFSM()
mark the outputs of our FSM as invalid, because some inputs are not connected or have unknown ('X', 'U', 'Z') values. |
boolean |
mayChangeIO()
check whether it is possible to change the I/O of our FSM. |
boolean |
needsDynamicSymbol()
a FsmWrapper needs a dynamical symbol |
boolean |
needsExternalResources()
we use one external resource: the FSM file to initialize us. |
void |
rebuildFSM(FSM fsm)
rebuildFSM(): to be called by the FSM editor any time the FSM has changed. |
void |
resetFSM()
reset our FSM to its initial state and schedule all resulting output values. |
void |
scheduleStateOutput(double time)
|
void |
setFSM(FSM fsm)
set a new FSM. |
void |
setFsmResourceName(java.lang.String s)
set a new (Java 1.1 resource-) name for the FSM data file. |
void |
setValue(Port port,
StdLogic1164 value,
double time)
set a new output "value" for Port "p" at time "time": this method constructs and schedules the corresponding SimEvent. |
void |
taktFSM()
we had an rising edge on the CLK input. |
java.lang.String |
toString()
toString(): the usual info method. |
void |
updateMealyFSM()
calculate the new state of this Mealy machine. |
void |
updateMooreFSM()
update the internal state (activated transistions) of this Moore machine. |
void |
write(java.io.PrintWriter ps)
write all required state information to stream ps: currently this includes the versionID and the resource name of our FSM data file. |
Methods inherited from class hades.simulator.SimObject |
getBindkey, getClassLoader, getDebug, getEditor, getFullName, getName, getParent, getPort, getPorts, getResourceAsStream, getSimulator, getSymbol, getSymbolResourceName, getToolTip, getVersionId, isVisible, keyPressed, message, mousePressed, 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 FSM fsm
protected java.lang.String fsmResourceName
int n_inputs
int n_outputs
final java.lang.String DEFAULT_FSM_NAME
protected double t_delay
protected Port port_NR
protected Port port_CLK
protected Port port_STATE
protected StdLogic1164 value_U
protected StdLogic1164 value_X
protected StdLogic1164 value_0
protected StdLogic1164 value_1
protected FsmRenderer fsmRenderer
protected boolean debug
Constructor Detail |
public FsmWrapper()
Method Detail |
public boolean needsDynamicSymbol()
needsDynamicSymbol
in class SimObject
hades.models.fsm.FsmWrapper.buildSymbol
public void constructDynamicSymbol()
constructDynamicSymbol
in class SimObject
public boolean needsExternalResources()
needsExternalResources
in class SimObject
public java.lang.String[] getExternalResources()
getExternalResources
in class SimObject
public boolean initialize(java.lang.String s)
If the resource file cannot be found, the method tries to load the default state machine.
initialize
in class SimObject
public void write(java.io.PrintWriter ps)
write
in class SimObject
public java.lang.String getFsmResourceName()
public void setFsmResourceName(java.lang.String s)
public FSM getFSM()
public void setFSM(FSM fsm)
public boolean mayChangeIO()
At the moment, changing the I/O works reliably only if no signals are connected to the FSM. Later versions of FsmWrapper should probably be more user-friendly.
hades.models.fsm.FsmWrapper.rebuildFSM
public void rebuildFSM(FSM fsm)
hades.models.fsm.FsmWrapper.mayChangeIO
,
hades.models.fsm.FsmWrapper.setFSM
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 argumentpublic void resetFSM()
public void invalidateFSM()
public void taktFSM()
public void updateMooreFSM()
public void updateMealyFSM()
public void setValue(Port port, StdLogic1164 value, double time)
public void scheduleStateOutput(double time)
public void configure()
configure
in class SimObject
public java.awt.Component getPropertySheet()
SimObject
getPropertySheet
in class SimObject
public SimObject copy()
copy
in class SimObject
public java.lang.String toString()
toString
in class SimObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |