mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-28 07:28:20 -04:00
added outputs for state variables if a circuit is created
This commit is contained in:
parent
98132c8055
commit
e4073ff41f
@ -301,6 +301,8 @@ public class CircuitBuilder implements BuilderInterface<CircuitBuilder> {
|
||||
if (!flipflops.isEmpty())
|
||||
addClockTpFlipFlops(circuit);
|
||||
|
||||
if (!createdNets.isEmpty())
|
||||
addNetConnections(circuit, maxWidth + SIZE * 5);
|
||||
|
||||
circuit.setNotModified();
|
||||
return circuit;
|
||||
@ -339,4 +341,23 @@ public class CircuitBuilder implements BuilderInterface<CircuitBuilder> {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user