Fixed a bug in Am2900; created dlatch8/80; relayouted some components
[Mograsim.git] / net.mograsim.machine / src / net / mograsim / machine / mi / components / ModelMicroInstructionMemory.java
index 34e7e80..b3c4174 100644 (file)
@@ -3,22 +3,23 @@ package net.mograsim.machine.mi.components;
 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.machine.Machine;
 import net.mograsim.machine.ModelMemory;
 import net.mograsim.machine.mi.MicroInstructionMemoryDefinition;
 
-public abstract class ModelMicroInstructionMemory extends ModelMemory
+public abstract class ModelMicroInstructionMemory<M extends Machine> extends ModelMemory<M>
 {
-       private final Pin addrPin, dataPin, clock;
+       private final Pin addrPin, dataPin;
        private CoreMicroInstructionMemory memory;
        private final MicroInstructionMemoryDefinition definition;
-       
+
        public ModelMicroInstructionMemory(LogicModelModifiable model, MicroInstructionMemoryDefinition definition, String name)
        {
-               super(model, 200, 100, name, "MPM", false);
+               super(model, 120, 150, name, "MPM", false);
                this.definition = definition;
-               addPin(addrPin = new Pin(model, this, "A", definition.getMemoryAddressBits(), PinUsage.INPUT, width / 2, 0));
-               addPin(dataPin = new Pin(model, this, "D", definition.getMicroInstructionDefinition().sizeInBits(), PinUsage.OUTPUT, 0, 30));
-               addPin(clock = new Pin(model, this, "C", 1, PinUsage.INPUT, 0, 60));
+               addPin(addrPin = new Pin(model, this, "A", definition.getMemoryAddressBits(), PinUsage.INPUT, getWidth(), 30));
+               addPin(dataPin = new Pin(model, this, "D", definition.getMicroInstructionDefinition().sizeInBits(), PinUsage.OUTPUT, getWidth(),
+                               50));
 
                init();
        }
@@ -27,7 +28,7 @@ public abstract class ModelMicroInstructionMemory extends ModelMemory
        {
                return definition;
        }
-       
+
        public Pin getAddressPin()
        {
                return addrPin;
@@ -38,16 +39,11 @@ public abstract class ModelMicroInstructionMemory extends ModelMemory
                return dataPin;
        }
 
-       public Pin getClockPin()
-       {
-               return clock;
-       }
-
        public CoreMicroInstructionMemory getCoreMemory()
        {
                return memory;
        }
-       
+
        public void setCoreModelBinding(CoreMicroInstructionMemory memory)
        {
                this.memory = memory;