mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-15 07:48:29 -04:00
Fixed a bug that made it impossible to analyze a model created with the fsm editor.
This commit is contained in:
parent
23ff923a9d
commit
b7e8ba7b9a
@ -75,6 +75,7 @@ public class Model implements Iterable<Node>, SyncAccess {
|
|||||||
private boolean isInvalidSignal = false;
|
private boolean isInvalidSignal = false;
|
||||||
private AsyncSeq asyncInfos;
|
private AsyncSeq asyncInfos;
|
||||||
private boolean asyncMode = false;
|
private boolean asyncMode = false;
|
||||||
|
private boolean allowGlobalValues = false;
|
||||||
|
|
||||||
private final ArrayList<ModelStateObserver> observers;
|
private final ArrayList<ModelStateObserver> observers;
|
||||||
private ArrayList<ModelStateObserver> observersStep;
|
private ArrayList<ModelStateObserver> observersStep;
|
||||||
@ -740,6 +741,27 @@ public class Model implements Iterable<Node>, SyncAccess {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a global value.
|
||||||
|
*
|
||||||
|
* @param name the name
|
||||||
|
* @param value the value
|
||||||
|
*/
|
||||||
|
public void registerGlobalValue(String name, ObservableValue value) {
|
||||||
|
if (allowGlobalValues)
|
||||||
|
GlobalValues.getInstance().register(name, value, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set or denies the creation of global values.
|
||||||
|
*
|
||||||
|
* @param allowGlobalValues if true, global values are published
|
||||||
|
* @return this for chained calls
|
||||||
|
*/
|
||||||
|
public Model setAllowGlobalValues(boolean allowGlobalValues) {
|
||||||
|
this.allowGlobalValues = allowGlobalValues;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets async execution infos
|
* Sets async execution infos
|
||||||
|
@ -54,7 +54,7 @@ public class Probe implements Element {
|
|||||||
@Override
|
@Override
|
||||||
public void registerNodes(Model model) {
|
public void registerNodes(Model model) {
|
||||||
model.addSignal(new Signal(label, value).setFormat(format));
|
model.addSignal(new Signal(label, value).setFormat(format));
|
||||||
GlobalValues.getInstance().register(label, value, model);
|
model.registerGlobalValue(label, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,7 @@ public class ModelCreator implements Iterable<ModelEntry> {
|
|||||||
* @throws NodeException NodeException
|
* @throws NodeException NodeException
|
||||||
*/
|
*/
|
||||||
public Model createModel(boolean attachWires) throws PinException, NodeException {
|
public Model createModel(boolean attachWires) throws PinException, NodeException {
|
||||||
Model m = new Model();
|
Model m = new Model().setAllowGlobalValues(attachWires);
|
||||||
|
|
||||||
for (Net n : netList)
|
for (Net n : netList)
|
||||||
n.interconnect(m, attachWires);
|
n.interconnect(m, attachWires);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user