Improved BitVectorFormatter for bitvectors of length 1
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Sat, 12 Oct 2019 14:11:48 +0000 (16:11 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Sat, 12 Oct 2019 14:11:48 +0000 (16:11 +0200)
plugins/net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVectorFormatter.java

index 8ffe07a..a369b05 100644 (file)
@@ -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();
        }