Implemented some infrastructure for MPROMs
[Mograsim.git] / plugins / net.mograsim.machine / src / net / mograsim / machine / mi / components / MPROMAdapter.java
1 package net.mograsim.machine.mi.components;
2
3 import java.util.Map;
4
5 import net.mograsim.logic.core.timeline.Timeline;
6 import net.mograsim.logic.core.wires.CoreWire;
7 import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
8 import net.mograsim.logic.core.wires.CoreWire.ReadWriteEnd;
9 import net.mograsim.logic.model.model.wires.Pin;
10 import net.mograsim.logic.model.modeladapter.CoreModelParameters;
11 import net.mograsim.logic.model.modeladapter.componentadapters.ComponentAdapter;
12
13 public class MPROMAdapter implements ComponentAdapter<ModelMPROM>
14 {
15         @Override
16         public Class<ModelMPROM> getSupportedClass()
17         {
18                 return ModelMPROM.class;
19         }
20
21         @Override
22         public void createAndLinkComponent(Timeline timeline, CoreModelParameters params, ModelMPROM modelComponent,
23                         Map<Pin, CoreWire> logicWiresPerPin)
24         {
25                 ReadWriteEnd data = logicWiresPerPin.get(modelComponent.getDataPin()).createReadWriteEnd();
26                 ReadEnd address = logicWiresPerPin.get(modelComponent.getAddressPin()).createReadOnlyEnd();
27                 CoreMPROM mem = new CoreMPROM(timeline, 2, modelComponent.getDefinition(), data, address);
28                 modelComponent.setCoreModelBinding(mem);
29         }
30 }