From 28bd84e7a569624922c8fd96df511b7e6581315a Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Wed, 2 Oct 2019 15:41:40 +0200 Subject: [PATCH] Made WireForcingAtomicHighLevelStateHandler.getHighLevelState cleaner --- ...WireForcingAtomicHighLevelStateHandler.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/WireForcingAtomicHighLevelStateHandler.java b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/WireForcingAtomicHighLevelStateHandler.java index 276f5415..aa509c9d 100644 --- a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/WireForcingAtomicHighLevelStateHandler.java +++ b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/WireForcingAtomicHighLevelStateHandler.java @@ -99,14 +99,20 @@ public class WireForcingAtomicHighLevelStateHandler implements AtomicHighLevelSt @Override public Object getHighLevelState() { - BitVector result = BitVector.of(Bit.ZERO, logicWidth); - for (ModelWire wire : wiresToForceInverted) - if (wire.hasCoreModelBinding()) - result = result.or(wire.getWireValues()); - result = result.not(); + BitVector result = BitVector.of(Bit.Z, logicWidth); + + if (!wiresToForceInverted.isEmpty()) + { + for (ModelWire wire : wiresToForceInverted) + if (wire.hasCoreModelBinding()) + result = result.join(wire.getWireValues()); + result = result.not(); + } + for (ModelWire wire : wiresToForce) if (wire.hasCoreModelBinding()) - result = result.and(wire.getWireValues()); + result = result.join(wire.getWireValues()); + return result; } -- 2.17.1