X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=plugins%2Fnet.mograsim.machine%2Fsrc%2Fnet%2Fmograsim%2Fmachine%2Fmi%2Fcomponents%2FModelMicroInstructionMemory.java;h=706734f2b611445dd861caf95b7263922f016157;hb=0c97f70d199e1ffcd2bc13817f7bb12867ba033e;hp=aeffbd2c303b34508b2576da4956e7805a732aae;hpb=26cacc7d4e6dd00d52546754ecc478b129f84339;p=Mograsim.git diff --git a/plugins/net.mograsim.machine/src/net/mograsim/machine/mi/components/ModelMicroInstructionMemory.java b/plugins/net.mograsim.machine/src/net/mograsim/machine/mi/components/ModelMicroInstructionMemory.java index aeffbd2c..706734f2 100644 --- a/plugins/net.mograsim.machine/src/net/mograsim/machine/mi/components/ModelMicroInstructionMemory.java +++ b/plugins/net.mograsim.machine/src/net/mograsim/machine/mi/components/ModelMicroInstructionMemory.java @@ -4,6 +4,8 @@ import net.mograsim.logic.model.model.LogicModelModifiable; import net.mograsim.logic.model.model.wires.Pin; import net.mograsim.logic.model.model.wires.PinUsage; import net.mograsim.logic.model.modeladapter.LogicCoreAdapter; +import net.mograsim.logic.model.serializing.IdentifyParams; +import net.mograsim.logic.model.snippets.HighLevelStateHandler; import net.mograsim.machine.ModelMemory; import net.mograsim.machine.mi.MicroInstructionMemory; import net.mograsim.machine.mi.MicroInstructionMemoryDefinition; @@ -22,6 +24,38 @@ public abstract class ModelMicroInstructionMemory extends ModelMemory addPin(dataPin = new Pin(model, this, "D", definition.getMicroInstructionDefinition().sizeInBits(), PinUsage.OUTPUT, getWidth(), 50)); + setHighLevelStateHandler(new HighLevelStateHandler() + { + @Override + public Object getHighLevelState(String stateID) + { + if (stateID.equals("memory_binding")) + return memory.getMemory(); + throw new IllegalArgumentException("No high level state with ID " + stateID); + } + + @Override + public void setHighLevelState(String stateID, Object newState) + { + if (stateID.equals("memory_binding")) + memory.setMemory((MicroInstructionMemory) newState); + else + throw new IllegalArgumentException("No high level state with ID " + stateID); + } + + @Override + public String getIDForSerializing(IdentifyParams idParams) + { + return null; + } + + @Override + public Object getParamsForSerializing(IdentifyParams idParams) + { + return null; + } + }); + init(); } @@ -50,23 +84,6 @@ public abstract class ModelMicroInstructionMemory extends ModelMemory this.memory = memory; } - @Override - public void setHighLevelState(String stateID, Object newState) - { - if (stateID.equals("memory_binding")) - memory.setMemory((MicroInstructionMemory) newState); - else - super.setHighLevelState(stateID, newState); - } - - @Override - public Object getHighLevelState(String stateID) - { - if (stateID.equals("memory_binding")) - return memory.getMemory(); - return super.getHighLevelState(stateID); - } - static { LogicCoreAdapter.addComponentAdapter(new MicroInstructionMemoryAdapter());