Setting a memory cell no longer causes an infinite loop
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Sun, 15 Sep 2019 16:00:16 +0000 (18:00 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Sun, 15 Sep 2019 16:02:45 +0000 (18:02 +0200)
net.mograsim.machine/src/net/mograsim/machine/standard/memory/CoreWordAddressableMemory.java

index 6dc5da2..dcbd25e 100644 (file)
@@ -69,15 +69,15 @@ public class CoreWordAddressableMemory extends BasicCoreComponent
                {
                        BitVector storedData = memory.getCell(addressed);
                        return e -> data.feedSignals(storedData);
-               } else
-               {
-                       BitVector transData = data.getValues();
-                       return e ->
-                       {
-                               data.clearSignals();
-                               memory.setCell(addressed, transData);
-                       };
                }
+               BitVector transData = data.getValues();
+               if (transData.equals(memory.getCell(addressed)))
+                       return null;
+               return e ->
+               {
+                       data.clearSignals();
+                       memory.setCell(addressed, transData);
+               };
        }
 
        @Override