895c58a51c9ea3782f65f06d67c363e860b3bf3d
[Mograsim.git] /
1 package net.mograsim.logic.model.am2900.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 import net.mograsim.machine.mi.components.CoreMicroInstructionMemory;
13
14 public class ModelAm2900MicroInstructionMemoryAdapter implements ComponentAdapter<ModelAm2900MicroInstructionMemory>
15 {
16
17         @Override
18         public Class<ModelAm2900MicroInstructionMemory> getSupportedClass()
19         {
20                 return ModelAm2900MicroInstructionMemory.class;
21         }
22
23         @Override
24         public void createAndLinkComponent(Timeline timeline, CoreModelParameters params, ModelAm2900MicroInstructionMemory modelComponent,
25                         Map<Pin, CoreWire> logicWiresPerPin)
26         {
27                 ReadWriteEnd data = logicWiresPerPin.get(modelComponent.getDataPin()).createReadWriteEnd();
28                 ReadEnd address = logicWiresPerPin.get(modelComponent.getAddressPin()).createReadOnlyEnd();
29                 CoreMicroInstructionMemory mem = new CoreMicroInstructionMemory(timeline, 2,
30                                 modelComponent.getMachine().getMicroInstructionMemory(), data, address);
31                 modelComponent.setCoreModelBinding(mem);
32         }
33
34 }