added outputs for state variables if a circuit is created

This commit is contained in:
hneemann 2017-04-01 13:43:20 +02:00
parent 98132c8055
commit e4073ff41f

View File

@ -301,6 +301,8 @@ public class CircuitBuilder implements BuilderInterface<CircuitBuilder> {
if (!flipflops.isEmpty()) if (!flipflops.isEmpty())
addClockTpFlipFlops(circuit); addClockTpFlipFlops(circuit);
if (!createdNets.isEmpty())
addNetConnections(circuit, maxWidth + SIZE * 5);
circuit.setNotModified(); circuit.setNotModified();
return circuit; return circuit;
@ -339,4 +341,23 @@ public class CircuitBuilder implements BuilderInterface<CircuitBuilder> {
circuit.add(clock); circuit.add(clock);
} }
private void addNetConnections(Circuit circuit, int xPos) {
int y = -SIZE * 5;
ArrayList<String> list = new ArrayList<>(createdNets);
Collections.sort(list);
for (String name : list) {
VisualElement t = new VisualElement(Tunnel.DESCRIPTION.getName()).setShapeFactory(shapeFactory);
t.getElementAttributes().set(Keys.NETNAME, name);
t.setPos(new Vector(xPos, y));
t.setRotation(2);
circuit.add(t);
VisualElement o = new VisualElement(Out.DESCRIPTION.getName()).setShapeFactory(shapeFactory);
o.getElementAttributes().set(Keys.LABEL, name);
o.setPos(new Vector(xPos + SIZE, y));
circuit.add(o);
circuit.add(new Wire(new Vector(xPos, y), new Vector(xPos + SIZE, y)));
y += SIZE * 2;
}
}
} }