1 package net.mograsim.logic.model.am2900.machine;
3 import net.mograsim.logic.core.components.CoreClock;
4 import net.mograsim.logic.core.timeline.Timeline;
5 import net.mograsim.logic.core.types.BitVector;
6 import net.mograsim.logic.model.am2900.components.ModelAm2900MainMemory;
7 import net.mograsim.logic.model.am2900.components.ModelAm2900MicroInstructionMemory;
8 import net.mograsim.logic.model.model.LogicModel;
9 import net.mograsim.logic.model.model.LogicModelModifiable;
10 import net.mograsim.logic.model.modeladapter.CoreModelParameters;
11 import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
12 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
13 import net.mograsim.machine.Machine;
14 import net.mograsim.machine.MachineDefinition;
15 import net.mograsim.machine.MainMemory;
16 import net.mograsim.machine.Register;
17 import net.mograsim.machine.mi.MicroInstructionMemory;
18 import net.mograsim.machine.mi.StandardMicroInstructionMemory;
19 import net.mograsim.machine.standard.memory.WordAddressableMemory;
21 public class Am2900Machine implements Machine
23 private Am2900MachineDefinition machineDefinition;
24 private LogicModelModifiable logicModel;
25 private Timeline timeline;
26 private MainMemory mainMemory;
27 private MicroInstructionMemory instMemory;
28 private CoreClock clock;
30 public Am2900Machine(Am2900MachineDefinition am2900MachineDefinition)
32 this.machineDefinition = am2900MachineDefinition;
33 logicModel = new LogicModelModifiable();
34 IndirectModelComponentCreator.createComponent(logicModel,
35 "resloader:Am2900Loader:jsonres:net/mograsim/logic/model/am2900/components/Am2900.json", "Am2900");
36 CoreModelParameters params = new CoreModelParameters();
37 params.gateProcessTime = 50;
38 params.wireTravelTime = 10;
39 mainMemory = new WordAddressableMemory(am2900MachineDefinition.getMainMemoryDefinition());
40 instMemory = new StandardMicroInstructionMemory(am2900MachineDefinition.getMicroInstructionMemoryDefinition());
41 logicModel.getComponentBySubmodelPath("Am2900.Am2900MainMemory#0", ModelAm2900MainMemory.class).setMachine(this);
42 logicModel.getComponentBySubmodelPath("Am2900.Am2900MicroInstructionMemory#0", ModelAm2900MicroInstructionMemory.class)
44 timeline = LogicCoreAdapter.convert(logicModel, params);
48 public MachineDefinition getDefinition()
50 return machineDefinition;
56 // TODO Auto-generated method stub
61 public LogicModel getModel()
67 public Timeline getTimeline()
73 public CoreClock getClock()
79 public BitVector getRegister(Register r)
81 // TODO Auto-generated method stub
86 public void setRegister(Register r, BitVector value)
88 // TODO Auto-generated method stub
93 public MainMemory getMainMemory()
99 public MicroInstructionMemory getMicroInstructionMemory()