Added Am2900 MainMemory and MicroInstructionMemory Core/Model Components
[Mograsim.git] / net.mograsim.machine / src / net / mograsim / machine / mi / components / ModelMicroInstructionMemory.java
1 package net.mograsim.machine.mi.components;
2
3 import net.mograsim.logic.model.model.LogicModelModifiable;
4 import net.mograsim.logic.model.model.wires.Pin;
5 import net.mograsim.logic.model.model.wires.PinUsage;
6 import net.mograsim.machine.ModelMemory;
7 import net.mograsim.machine.mi.MicroInstructionMemoryDefinition;
8
9 public abstract class ModelMicroInstructionMemory extends ModelMemory
10 {
11         private final Pin addrPin, dataPin, clock;
12         private CoreMicroInstructionMemory memory;
13         private final MicroInstructionMemoryDefinition definition;
14         
15         public ModelMicroInstructionMemory(LogicModelModifiable model, MicroInstructionMemoryDefinition definition, String name)
16         {
17                 super(model, 200, 100, name, "MPM", false);
18                 this.definition = definition;
19                 addPin(addrPin = new Pin(model, this, "A", definition.getMemoryAddressBits(), PinUsage.INPUT, width / 2, 0));
20                 addPin(dataPin = new Pin(model, this, "D", definition.getMicroInstructionDefinition().sizeInBits(), PinUsage.OUTPUT, 0, 30));
21                 addPin(clock = new Pin(model, this, "C", 1, PinUsage.INPUT, 0, 60));
22
23                 init();
24         }
25
26         public MicroInstructionMemoryDefinition getDefinition()
27         {
28                 return definition;
29         }
30         
31         public Pin getAddressPin()
32         {
33                 return addrPin;
34         }
35
36         public Pin getDataPin()
37         {
38                 return dataPin;
39         }
40
41         public Pin getClockPin()
42         {
43                 return clock;
44         }
45
46         public CoreMicroInstructionMemory getCoreMemory()
47         {
48                 return memory;
49         }
50         
51         public void setCoreModelBinding(CoreMicroInstructionMemory memory)
52         {
53                 this.memory = memory;
54         }
55 }