Apply formatter, optional problems, save actions to machine project
[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(),
21                                 50));
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 CoreMicroInstructionMemory getCoreMemory()
42         {
43                 return memory;
44         }
45
46         public void setCoreModelBinding(CoreMicroInstructionMemory memory)
47         {
48                 this.memory = memory;
49         }
50 }