X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.machine%2Fsrc%2Fnet%2Fmograsim%2Fmachine%2Fmi%2Fcomponents%2FCoreMicroInstructionMemory.java;h=739402803fbf4420583034761bb77635296fa512;hb=9c98bb5456a7ead6d92fcc6acd9d1497688b244d;hp=eb4720995112128c18421e5252034158ba1ff6fd;hpb=88e1b4382640ee4e907e06572fe6794bc925f344;p=Mograsim.git diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/components/CoreMicroInstructionMemory.java b/net.mograsim.machine/src/net/mograsim/machine/mi/components/CoreMicroInstructionMemory.java index eb472099..73940280 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/components/CoreMicroInstructionMemory.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/components/CoreMicroInstructionMemory.java @@ -13,10 +13,9 @@ import net.mograsim.machine.mi.MicroInstructionMemory; public class CoreMicroInstructionMemory extends BasicCoreComponent { - private final ReadWriteEnd data; - private final ReadEnd address; - private final MicroInstructionMemory memory; - + private final ReadWriteEnd data; + private final ReadEnd address; + private final MicroInstructionMemory memory; public CoreMicroInstructionMemory(Timeline timeline, int processTime, MicroInstructionMemory memory, ReadWriteEnd data, ReadEnd address) { @@ -24,6 +23,8 @@ public class CoreMicroInstructionMemory extends BasicCoreComponent this.memory = memory; this.data = data; this.address = address; + memory.registerObserver(a -> update()); + address.registerObserver(this); } public MicroInstructionMemory getMemory() @@ -46,11 +47,11 @@ public class CoreMicroInstructionMemory extends BasicCoreComponent @Override protected TimelineEventHandler compute() { - if(!address.hasNumericValue()) + if (!address.getValues().isBinary()) { - return e -> data.feedSignals(Bit.U.toVector(data.width()));//TODO don't always feed U, but decide to feed X or U. + return e -> data.feedSignals(Bit.U.toVector(data.width()));// TODO don't always feed U, but decide to feed X or U. } - long addressed = address.getUnsignedValue(); + long addressed = address.getValues().getUnsignedValueLong(); BitVector storedData = memory.getCell(addressed).toBitVector(); return e -> data.feedSignals(storedData); }