Highlights the input connection port in the multiplexer when the input is selected; closes #1299

This commit is contained in:
hneemann 2024-07-14 09:57:16 +02:00
parent 7e3ebcdf03
commit 426a1e1170
3 changed files with 34 additions and 12 deletions

View File

@ -7,6 +7,8 @@ HEAD, planned as v0.31
- Allows disabling LED's in the measurement graph
- Adds drivers with inverted output
- Adds a minified circuit as a new shape for embedded circuits
- Highlights the input connection port in the multiplexer when the
input is selected.
- Allows recovering from oscillations.
- Supports XDG_CONFIG_HOME environment variable
- Fixes a bug in max path len calculation

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<circuit>
<version>1</version>
<version>2</version>
<attributes>
<entry>
<string>Description</string>
@ -158,10 +158,6 @@ Single-Cycle CPU.}}</string>
<visualElement>
<elementName>Clock</elementName>
<elementAttributes>
<entry>
<string>runRealTime</string>
<boolean>true</boolean>
</entry>
<entry>
<string>Label</string>
<string>Clock</string>
@ -777,13 +773,15 @@ Single-Cycle CPU.}}</string>
</entry>
<entry>
<string>Data</string>
<data>8000,961,8190,951,a90,a83,a25,a3a,10e1,afc,2bef,3d5f,c21,212f,38f9,3d20,105,116,a30,
a20,aa0,8035,3ac0,4380,2180,3505,2172,3505,2173,3503,3d03,2173,3801,aa3,401a,c01,
c11,c21,8014,2020,38eb,c31,8014,2030,38e6,1991,ffff,3e09,146,165,154,4400,3ddb,a70,
1031,8014,f00,8060,3ab0,c21,c01,8060,3ab0,c31,8014,b00,8060,3ab0,c31,8014,b00,8060,
3ab0,1021,1001,8060,3ab0,1021,1001,8060,3ab0,1031,8014,f00,8060,3ab0,1031,8014,f00,
8060,3ab0,c21,c31,8015,b00,3b0c,8014,2020,3707,8014,2030,3704,4380,2180,3501,c71,
3b0b,143,8014,1c40,242,246,4048,2cfe,ce1,3b0f</data>
<data>8000,961,8190,951,a90,a83,a25,a3a,10e1,afc,2bef,3d5f,c21,212f
,38f9,3d20,105,116,a30,a20,aa0,8035,3ac0,4380,2180,3505,2172,3505
,2173,3503,3d03,2173,3801,aa3,401a,c01,c11,c21,8014,2020,38eb
,c31,8014,2030,38e6,1991,ffff,3e09,146,165,154,4400,3ddb,a70,1031
,8014,f00,8060,3ab0,c21,c01,8060,3ab0,c31,8014,b00,8060,3ab0,c31
,8014,b00,8060,3ab0,1021,1001,8060,3ab0,1021,1001,8060,3ab0,1031
,8014,f00,8060,3ab0,1031,8014,f00,8060,3ab0,c21,c31,8015,b00,3b0c
,8014,2020,3707,8014,2030,3704,4380,2180,3501,c71,3b0b,143,8014
,1c40,242,246,4048,2cfe,ce1,3b0f</data>
</entry>
<entry>
<string>lastDataFile</string>

View File

@ -5,6 +5,8 @@
*/
package de.neemann.digital.draw.shapes;
import de.neemann.digital.core.ObservableValue;
import de.neemann.digital.core.Value;
import de.neemann.digital.core.element.ElementAttributes;
import de.neemann.digital.core.element.Keys;
import de.neemann.digital.core.element.PinDescriptions;
@ -14,6 +16,7 @@ import de.neemann.digital.draw.elements.Pins;
import de.neemann.digital.draw.graphics.*;
import static de.neemann.digital.draw.shapes.GenericShape.SIZE;
import static de.neemann.digital.draw.shapes.GenericShape.SIZE2;
/**
* The Muxer shape
@ -24,6 +27,8 @@ public class MuxerShape implements Shape {
private final PinDescriptions inputs;
private final PinDescriptions outputs;
private Pins pins;
private ObservableValue selector;
private Value selectorValue;
/**
* Creates a new instance
@ -58,9 +63,16 @@ public class MuxerShape implements Shape {
@Override
public Interactor applyStateMonitor(IOState ioState) {
selector = ioState.getInput(0);
return null;
}
@Override
public void readObservableValues() {
if (selector != null)
selectorValue = selector.getCopy();
}
@Override
public void drawTo(Graphic graphic, Style heighLight) {
graphic.drawPolygon(new Polygon(true)
@ -69,5 +81,15 @@ public class MuxerShape implements Shape {
.add(SIZE * 2 - 1, inputCount * SIZE - 5)
.add(1, inputCount * SIZE + 4), Style.NORMAL);
graphic.drawText(new Vector(3, 2), "0", Orientation.LEFTTOP, Style.SHAPE_PIN);
if (selectorValue != null) {
int in = (int) selectorValue.getValue() + 1;
Pins p = getPins();
if (in < p.size()) {
Vector pos = p.get(in).getPos();
int s = SIZE2 / 2;
graphic.drawCircle(pos.add(-s, -s), pos.add(s, s), Style.THIN);
}
}
}
}