1 package net.mograsim.logic.model.am2900.am2910;
3 import net.mograsim.logic.core.components.CoreBitDisplay;
4 import net.mograsim.logic.core.components.CoreManualSwitch;
5 import net.mograsim.logic.core.types.BitVector;
6 import net.mograsim.logic.model.am2900.util.TestEnvironmentHelper;
7 import net.mograsim.logic.model.am2900.util.TestEnvironmentHelper.DebugState;
8 import net.mograsim.logic.model.model.components.ModelComponent;
10 public class TestableAm2910Impl implements TestableAm2910
13 private ModelComponent am2901;
14 private CoreManualSwitch I;
15 private CoreManualSwitch C;
16 private CoreManualSwitch CI;
17 private CoreManualSwitch D;
18 private CoreManualSwitch _CC;
19 private CoreManualSwitch _CCEN;
20 private CoreManualSwitch _RLD;
21 private CoreManualSwitch _OE;
22 private CoreBitDisplay _FULL;
23 private CoreBitDisplay Y;
24 private CoreBitDisplay _PL, _MAP, _VECT;
26 private final TestEnvironmentHelper testHelper = new TestEnvironmentHelper(this, "Am2910");
31 testHelper.setup(DebugState.NO_DEBUG);
37 return testHelper.run();
41 public void clockOn(boolean isClockOn)
50 public void setInstruction(Am2910_Inst inst)
52 I.setState(BitVector.from(inst.ordinal(), 4));
56 public void set_CCEN(String val_1_bit)
58 _CCEN.setState(BitVector.parse(val_1_bit));
62 public void setD(String val_12_bit)
64 D.setState(BitVector.parse(val_12_bit));
68 public void set_CC(String val_1_bit)
70 _CC.setState(BitVector.parse(val_1_bit));
74 public void setCI(String val_1_bit)
76 CI.setState(BitVector.parse(val_1_bit));
80 public void set_RLD(String val_1_bit)
82 _RLD.setState(BitVector.parse(val_1_bit));
86 public void set_OE(String val_1_bit)
88 _OE.setState(BitVector.parse(val_1_bit));
92 public void setDirectly(Register r, String val_X_bit)
94 am2901.setHighLevelState(regToStateID(r), BitVector.parse(val_X_bit));
100 return Y.getDisplayedValue().toString();
104 public String get_FULL()
106 return _FULL.getDisplayedValue().toString();
110 public String get_PL()
112 return _PL.getDisplayedValue().toString();
116 public String get_MAP()
118 return _MAP.getDisplayedValue().toString();
122 public String get_VECT()
124 return _VECT.getDisplayedValue().toString();
128 public String getDirectly(Register r)
130 return am2901.getHighLevelState(regToStateID(r)).toString();
133 private static String regToStateID(Register r)
142 return "stack.c" + BitVector.from(r.ordinal(), 3) + ".q";
150 throw new IllegalArgumentException("unknown: " + r);
155 public TestEnvironmentHelper getTestEnvironmentHelper()