0ed024f4d2095462dbde758df4c2656716e04182
[Mograsim.git] /
1 package net.mograsim.logic.model.am2900.machine;
2
3 import java.util.Objects;
4 import java.util.Set;
5
6 import net.mograsim.logic.model.model.LogicModelModifiable;
7 import net.mograsim.machine.ISASchema;
8 import net.mograsim.machine.MachineDefinition;
9 import net.mograsim.machine.MachineRegistry;
10 import net.mograsim.machine.Register;
11
12 public class Am2900MachineDefinition implements MachineDefinition
13 {
14         private Am2900MainMemoryDefinition memoryDefinition = new Am2900MainMemoryDefinition();
15         private Am2900MicroInstructionMemoryDefinition microInstMemoryDefinition = new Am2900MicroInstructionMemoryDefinition();
16         private final static Am2900MachineDefinition instance = new Am2900MachineDefinition();
17
18         public static Am2900MachineDefinition getInstance()
19         {
20                 return Objects.requireNonNullElseGet((Am2900MachineDefinition) MachineRegistry.getinstalledMachines().get("Am2900"),
21                                 () -> instance);
22         }
23
24         @Override
25         public Am2900Machine createNew()
26         {
27                 return createNew(new LogicModelModifiable());
28         }
29
30         public Am2900Machine createNew(LogicModelModifiable model)
31         {
32                 return new Am2900Machine(model, this);
33         }
34
35         @Override
36         public ISASchema getISASchema()
37         {
38                 // TODO Auto-generated method stub
39                 return null;
40         }
41
42         @Override
43         public Set<Register> getRegisters()
44         {
45                 // TODO Auto-generated method stub
46                 return null;
47         }
48
49         @Override
50         public int getAddressBits()
51         {
52                 return 16;
53         }
54
55         @Override
56         public Am2900MainMemoryDefinition getMainMemoryDefinition()
57         {
58                 return memoryDefinition;
59         }
60
61         @Override
62         public Am2900MicroInstructionMemoryDefinition getMicroInstructionMemoryDefinition()
63         {
64                 return microInstMemoryDefinition;
65         }
66 }