From: Daniel Kirschten Date: Sat, 12 Oct 2019 14:11:48 +0000 (+0200) Subject: Improved BitVectorFormatter for bitvectors of length 1 X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=719565e1035534787c913683b6099694c5186408;p=Mograsim.git Improved BitVectorFormatter for bitvectors of length 1 --- 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 8ffe07aa..a369b051 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 @@ -23,6 +23,10 @@ public class BitVectorFormatter { if (bitVector == null) return "null"; + if (useDashInsteadOfZ && bitVector.isHighImpedance()) + return "-"; + if (bitVector.length() == 1) + return bitVector.toBitstring(); if (bitVector.isBinary()) { String hexdigits = bitVector.getUnsignedValue().toString(16); @@ -32,8 +36,6 @@ public class BitVectorFormatter sb.append(hexdigits); return sb.toString(); } - if (useDashInsteadOfZ && bitVector.isHighImpedance()) - return "-"; return bitVector.toBitstring(); }