From 254716460f879db0b318294bb66b9c9de52844b7 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Mon, 7 Oct 2019 02:24:16 +0200 Subject: [PATCH] Added register for muIR --- .../machine/AbstractAm2900MachineDefinition.java | 4 +++- .../logic/model/am2900/machine/Am2900Machine.java | 4 +++- .../am2900/machine/registers/muInstrRegister.java | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/registers/muInstrRegister.java diff --git a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/AbstractAm2900MachineDefinition.java b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/AbstractAm2900MachineDefinition.java index d9431daf..665c9a3a 100644 --- a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/AbstractAm2900MachineDefinition.java +++ b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/AbstractAm2900MachineDefinition.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import net.mograsim.logic.model.am2900.machine.registers.muInstrRegister; import net.mograsim.logic.model.am2900.machine.registers.am2901.Am2901RegisterGroup; import net.mograsim.logic.model.am2900.machine.registers.am2904.Am2904RegisterGroup; import net.mograsim.logic.model.am2900.machine.registers.am2910.Am2910RegisterGroup; @@ -26,7 +27,8 @@ public class AbstractAm2900MachineDefinition implements MachineDefinition static { List unsortedRegistersModifiable = new ArrayList<>(); - // TODO MIR, IR, PC/BZ... + unsortedRegistersModifiable.add(muInstrRegister.instance); + // TODO IR, PC/BZ... unsortedRegisters = Collections.unmodifiableList(unsortedRegistersModifiable); List registerGroupsModifiable = new ArrayList<>(); registerGroupsModifiable.add(Am2901RegisterGroup.instance); diff --git a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/Am2900Machine.java b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/Am2900Machine.java index fa281db4..9cd8adcc 100644 --- a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/Am2900Machine.java +++ b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/Am2900Machine.java @@ -10,6 +10,7 @@ import net.mograsim.logic.core.timeline.Timeline; import net.mograsim.logic.core.types.Bit; import net.mograsim.logic.core.types.BitVector; import net.mograsim.logic.model.am2900.machine.registers.Am2900Register; +import net.mograsim.logic.model.am2900.machine.registers.muInstrRegister; import net.mograsim.logic.model.model.LogicModel; import net.mograsim.logic.model.model.LogicModelModifiable; import net.mograsim.logic.model.model.components.ModelComponent; @@ -98,7 +99,8 @@ public class Am2900Machine implements Machine private void setRegistersToZero(List registers) { for (Register r : registers) - setRegister(r, BitVector.of(Bit.ZERO, r.getWidth())); + if (r != muInstrRegister.instance)// don't reset; sometimes causes a glitch + setRegister(r, BitVector.of(Bit.ZERO, r.getWidth())); } private void setRegisterGroupToZero(List registerGroups) diff --git a/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/registers/muInstrRegister.java b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/registers/muInstrRegister.java new file mode 100644 index 00000000..453dcd82 --- /dev/null +++ b/plugins/net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/registers/muInstrRegister.java @@ -0,0 +1,14 @@ +package net.mograsim.logic.model.am2900.machine.registers; + +import net.mograsim.logic.model.am2900.machine.registers.Am2900Register; +import net.mograsim.machine.registers.HighLevelStateBasedRegister; + +public class muInstrRegister extends HighLevelStateBasedRegister implements Am2900Register +{ + public static final muInstrRegister instance = new muInstrRegister(); + + private muInstrRegister() + { + super("\u00b5IR", "muir_2.q", 80);// 00b5 = micro symbol + } +} \ No newline at end of file -- 2.17.1