Made Memories look more like other 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;
12         private CoreMicroInstructionMemory memory;
13         private final MicroInstructionMemoryDefinition definition;
14
15         public ModelMicroInstructionMemory(LogicModelModifiable model, MicroInstructionMemoryDefinition definition, String name)
16         {
17                 super(model, 120, 150, name, "MPM", false);
18                 this.definition = definition;
19                 addPin(addrPin = new Pin(model, this, "A", definition.getMemoryAddressBits(), PinUsage.INPUT, getWidth(), 30));
20                 addPin(dataPin = new Pin(model, this, "D", definition.getMicroInstructionDefinition().sizeInBits(), PinUsage.OUTPUT, getWidth(), 50));
21
22                 init();
23         }
24
25         public MicroInstructionMemoryDefinition getDefinition()
26         {
27                 return definition;
28         }
29
30         public Pin getAddressPin()
31         {
32                 return addrPin;
33         }
34
35         public Pin getDataPin()
36         {
37                 return dataPin;
38         }
39
40         public CoreMicroInstructionMemory getCoreMemory()
41         {
42                 return memory;
43         }
44
45         public void setCoreModelBinding(CoreMicroInstructionMemory memory)
46         {
47                 this.memory = memory;
48         }
49 }