Fixed bug in CoreWordAddressableMemory where signals were not cleared.
authorChristian Femers <femers@in.tum.de>
Mon, 16 Sep 2019 01:14:18 +0000 (03:14 +0200)
committerChristian Femers <femers@in.tum.de>
Mon, 16 Sep 2019 01:14:18 +0000 (03:14 +0200)
net.mograsim.machine/src/net/mograsim/machine/standard/memory/CoreWordAddressableMemory.java

index ca557a6..40abba9 100644 (file)
@@ -71,12 +71,12 @@ public class CoreWordAddressableMemory extends BasicCoreComponent
                        return e -> data.feedSignals(storedData);
                }
                BitVector transData = data.getValues();
-               if (transData.equals(memory.getCell(addressed)))
-                       return null;
+               boolean isNewData = !transData.equals(memory.getCell(addressed));
                return e ->
                {
                        data.clearSignals();
-                       memory.setCell(addressed, transData);
+                       if (isNewData)
+                               memory.setCell(addressed, transData);
                };
        }