From 6579fc1c18c0f008f259c3c48c47e604adac2a4c Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Sat, 12 Oct 2019 15:10:29 +0200 Subject: [PATCH] Only BitDisplay now uses dashes instead of Z --- .../net/mograsim/logic/core/types/BitVectorFormatter.java | 8 ++++---- .../model/model/components/atomic/ModelBitDisplay.java | 2 +- .../model/model/components/atomic/ModelFixedOutput.java | 2 +- .../model/model/components/atomic/ModelManualSwitch.java | 2 +- .../src/net/mograsim/plugin/launch/MachineRegister.java | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVectorFormatter.java b/plugins/net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVectorFormatter.java index b24e342c..8ffe07aa 100644 --- a/plugins/net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVectorFormatter.java +++ b/plugins/net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVectorFormatter.java @@ -9,9 +9,9 @@ import net.mograsim.preferences.Preferences; public class BitVectorFormatter { - public static String formatValueAsString(ReadEnd end) + public static String formatValueAsString(ReadEnd end, boolean useDashInsteadOfZ) { - return formatAsString(end == null ? null : end.getValues()); + return formatAsString(end == null ? null : end.getValues(), useDashInsteadOfZ); } public static String toBitstring(BitVector bitVector) @@ -19,7 +19,7 @@ public class BitVectorFormatter return bitVector.toBitstring(); } - public static String formatAsString(BitVector bitVector) + public static String formatAsString(BitVector bitVector, boolean useDashInsteadOfZ) { if (bitVector == null) return "null"; @@ -32,7 +32,7 @@ public class BitVectorFormatter sb.append(hexdigits); return sb.toString(); } - if (bitVector.isHighImpedance()) + if (useDashInsteadOfZ && bitVector.isHighImpedance()) return "-"; return bitVector.toBitstring(); } diff --git a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelBitDisplay.java b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelBitDisplay.java index ac332665..1cf14e84 100644 --- a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelBitDisplay.java +++ b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelBitDisplay.java @@ -55,7 +55,7 @@ public class ModelBitDisplay extends ModelComponent if (foreground != null) gc.setForeground(foreground); gc.drawRectangle(getBounds()); - String label = BitVectorFormatter.formatAsString(bitDisplay == null ? null : bitDisplay.getDisplayedValue()); + String label = BitVectorFormatter.formatAsString(bitDisplay == null ? null : bitDisplay.getDisplayedValue(), true); Font oldFont = gc.getFont(); Font labelFont = new Font(oldFont.getName(), fontHeight, oldFont.getStyle()); gc.setFont(labelFont); diff --git a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelFixedOutput.java b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelFixedOutput.java index 1d3bb1ee..bdf6546f 100644 --- a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelFixedOutput.java +++ b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelFixedOutput.java @@ -58,7 +58,7 @@ public class ModelFixedOutput extends ModelComponent if (foreground != null) gc.setForeground(foreground); gc.drawRectangle(getBounds()); - String label = BitVectorFormatter.formatAsString(bits); + String label = BitVectorFormatter.formatAsString(bits, false); Font oldFont = gc.getFont(); Font labelFont = new Font(oldFont.getName(), fontHeight, oldFont.getStyle()); gc.setFont(labelFont); diff --git a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelManualSwitch.java b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelManualSwitch.java index d4e04376..04d3b42c 100644 --- a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelManualSwitch.java +++ b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelManualSwitch.java @@ -142,7 +142,7 @@ public class ModelManualSwitch extends ModelComponent if (foreground != null) gc.setForeground(foreground); gc.drawRectangle(getBounds()); - String label = BitVectorFormatter.formatAsString(manualSwitch == null ? null : getOutValues()); + String label = BitVectorFormatter.formatAsString(manualSwitch == null ? null : getOutValues(), false); Font oldFont = gc.getFont(); Font labelFont = new Font(oldFont.getName(), fontHeight, oldFont.getStyle()); gc.setFont(labelFont); diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineRegister.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineRegister.java index e4704204..88c6ba7d 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineRegister.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineRegister.java @@ -97,7 +97,7 @@ public class MachineRegister extends PlatformObject implements IRegister public String getValueString() { - return BitVectorFormatter.formatAsString(getMachine().getRegister(machineRegister)); + return BitVectorFormatter.formatAsString(getMachine().getRegister(machineRegister), false); } @Override -- 2.17.1