1 package net.mograsim.logic.model.am2900.am2904;
3 import java.util.Collections;
4 import java.util.HashMap;
7 import net.mograsim.logic.model.am2900.TestableCircuit;
9 public interface TestableAm2904 extends TestableCircuit
12 void setInstruction(Am2904_Inst inst);
14 void setCarry(Am2904_Carry carry);
16 void setShiftCode(String val_4_bit);
18 void setI10(Am2904_ShiftDir dir);
20 void setCX(String val_1_bit);
22 void setY(String ovr_n_c_z);
24 void setIZ(String val_1_bit);
26 void setIC(String val_1_bit);
28 void setIOVR(String val_1_bit);
30 void setIN(String val_1_bit);
32 default void setI(String z_c_n_ovr)
34 setIZ(z_c_n_ovr.substring(0, 1));
35 setIC(z_c_n_ovr.substring(1, 2));
36 setIN(z_c_n_ovr.substring(2, 3));
37 setIOVR(z_c_n_ovr.substring(3, 4));
40 void set_CEM(String val_1_bit);
42 void set_CEµ(String val_1_bit);
44 void set_OEY(String val_1_bit);
46 void set_OECT(String val_1_bit);
48 void set_SE(String val_1_bit);
50 void set_EZ(String val_1_bit);
52 void set_EC(String val_1_bit);
54 void set_EOVR(String val_1_bit);
56 void set_EN(String val_1_bit);
58 default void set_E(String z_c_n_ovr)
60 set_EZ(z_c_n_ovr.substring(0, 1));
61 set_EC(z_c_n_ovr.substring(1, 2));
62 set_EN(z_c_n_ovr.substring(2, 3));
63 set_EOVR(z_c_n_ovr.substring(3, 4));
66 void setSIO0(String val_1_bit);
68 void setSIO3(String val_1_bit);
70 void setQIO0(String val_1_bit);
72 void setQIO3(String val_1_bit);
74 void setDirectly(Register r, String val_1_bit);
90 String getDirectly(Register r);
104 * [microSR]_[machineSR]_[condCodeSource]_[condCode]<br>
106 * <li>Load = load from I inputs (Am2904s)</li>
107 * <li>condCodeSource = µ, M, I (and a special case: I and M)</li>
108 * <li>condCode = the boolean term defining the CT output</li>
114 LoadM_LoadY_µ_NxorOVRorZ(0_00),
115 Set_Set_µ_NxnorOVRornotZ(0_01),
116 Swap_Swap_µ_NxorOVR(0_02),
117 Reset_Reset_µ_NxnorOVR(0_03),
118 Load_LoadForShiftThroughOvr_µ_Z(0_04),
119 Load_Invert_µ_notZ(0_05),
120 LoadOvrRetain_Load_µ_OVR(0_06),
121 LoadOvrRetain_Load_µ_notOVR(0_07),
122 ResetZ_LoadCarryInvert_µ_CorZ(0_10),
123 SetZ_LoadCarryInvert_µ_notCandnotZ(0_11),
124 ResetC_Load_µ_C(0_12),
125 SetC_Load_µ_notC(0_13),
126 ResetN_Load_µ_notCorZ(0_14),
127 SetN_Load_µ_CandnotZ(0_15),
128 ResetOvr_Load_IM_NxorN(0_16),
129 SetOvr_Load_IM_NxnorN(0_17),
130 Load_Load_µ_NxorOVRorZ(0_20),
131 Load_Load_µ_NxnorOVRornotZ(0_21),
132 Load_Load_µ_NxorOVR(0_22),
133 Load_Load_µ_NxnorOVR(0_23),
135 Load_Load_µ_notZ(0_25),
136 Load_Load_µ_OVR(0_26),
137 Load_Load_µ_notOVR(0_27),
138 LoadCarryInvert_LoadCarryInvert_µ_CorZ(0_30),
139 LoadCarryInvert_LoadCarryInvert_µ_notCandnotZ(0_31),
141 Load_Load_µ_notC(0_33),
142 Load_Load_µ_notCorZ(0_34),
143 Load_Load_µ_CandnotZ(0_35),
145 Load_Load_µ_notN(0_37),
146 Load_Load_M_NxorOVRorZ(0_40),
147 Load_Load_M_NxnorOVRornotZ(0_41),
148 Load_Load_M_NxorOVR(0_42),
149 Load_Load_M_NxnorOVR(0_43),
151 Load_Load_M_notZ(0_45),
152 Load_Load_M_OVR(0_46),
153 Load_Load_M_notOVR(0_47),
154 LoadCarryInvert_LoadCarryInvert_M_CorZ(0_50),
155 LoadCarryInvert_LoadCarryInvert_M_notCandnotZ(0_51),
157 Load_Load_M_notC(0_53),
158 Load_Load_M_notCorZ(0_54),
159 Load_Load_M_CandnotZ(0_55),
161 Load_Load_M_notN(0_57),
162 Load_Load_I_NxorOVRorZ(0_60),
163 Load_Load_I_NxnorOVRornotZ(0_61),
164 Load_Load_I_NxorOVR(0_62),
165 Load_Load_I_NxnorOVR(0_63),
167 Load_Load_I_notZ(0_65),
168 Load_Load_I_OVR(0_66),
169 Load_Load_I_notOVR(0_67),
170 LoadCarryInvert_LoadCarryInvert_I_notCorZ(0_70),
171 LoadCarryInvert_LoadCarryInvert_I_CandnotZ(0_71),
173 Load_Load_I_notC(0_73),
174 Load_Load_I_notCorZ(0_74),
175 Load_Load_I_CandnotZ(0_75),
177 Load_Load_I_notN(0_77);
180 public final int code;
182 private Am2904_Inst(int code)
187 private static final Map<Integer, Am2904_Inst> instCodes;
191 Map<Integer, Am2904_Inst> instCodesMod = new HashMap<>();
192 Am2904_Inst[] vals = values();
193 for (Am2904_Inst inst : vals)
195 assert inst.code == inst.ordinal();
196 instCodesMod.put(inst.code, inst);
198 if (instCodesMod.size() != 64)
199 throw new IllegalStateException("There must be exactly 64 Am2904 instruction codes, but was " + instCodesMod.size());
200 instCodes = Collections.unmodifiableMap(instCodesMod);
203 public static Am2904_Inst getInstFor(int I_543210)
205 Am2904_Inst inst = instCodes.get(I_543210);
208 throw new IllegalArgumentException("Invaild Am2904 instruction code: " + I_543210);
211 public int getBlock()
216 public boolean isLoadCarryInvert()
218 return (code & 0b001_110) == 0b001_000;
224 µZ, µC, µN, µOVR, MZ, MC, MN, MOVR;