1 package net.mograsim.logic.model.am2900.components.am2904;
3 import static net.mograsim.logic.core.types.Bit.ONE;
4 import static net.mograsim.logic.core.types.Bit.U;
5 import static net.mograsim.logic.core.types.Bit.X;
6 import static net.mograsim.logic.core.types.Bit.ZERO;
10 import net.mograsim.logic.core.types.Bit;
11 import net.mograsim.logic.core.types.BitVector;
12 import net.mograsim.logic.core.wires.Wire.ReadEnd;
13 import net.mograsim.logic.core.wires.Wire.ReadWriteEnd;
14 import net.mograsim.logic.model.model.ViewModelModifiable;
15 import net.mograsim.logic.model.model.components.atomic.SimpleRectangularHardcodedGUIComponent;
16 import net.mograsim.logic.model.model.wires.Pin;
17 import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
18 import net.mograsim.logic.model.snippets.symbolrenderers.PinNamesSymbolRenderer.PinNamesParams.Position;
20 public class GUIAm2904RegCTInstrDecode extends SimpleRectangularHardcodedGUIComponent
22 public GUIAm2904RegCTInstrDecode(ViewModelModifiable model, String name)
24 super(model, name, "Instruction\ndecode");
26 addPin(new Pin(this, "I", 6, 0, 40), Usage.INPUT, Position.RIGHT);
32 addPin(new Pin(this, "muSR_MUX", 2, 80, 10), Usage.OUTPUT, Position.LEFT);
33 addPin(new Pin(this, "muSR_OVRRET", 1, 80, 20), Usage.OUTPUT, Position.LEFT);
34 addPin(new Pin(this, "muSR_CINV", 1, 80, 30), Usage.OUTPUT, Position.LEFT);
35 addPin(new Pin(this, "muSR__WEZ", 1, 80, 40), Usage.OUTPUT, Position.LEFT);
36 addPin(new Pin(this, "muSR__WEC", 1, 80, 50), Usage.OUTPUT, Position.LEFT);
37 addPin(new Pin(this, "muSR__WEN", 1, 80, 60), Usage.OUTPUT, Position.LEFT);
38 addPin(new Pin(this, "muSR__WEOVR", 1, 80, 70), Usage.OUTPUT, Position.LEFT);
46 // 110: Swap OVR and C
48 addPin(new Pin(this, "MSR_MUX", 3, 40, 0), Usage.OUTPUT, Position.BOTTOM);
54 addPin(new Pin(this, "CT_SRC_MUX", 2, 10, 80), Usage.OUTPUT, Position.TOP);
56 // see Am2900 Family Data Book, Am2904, Table 4 (CT_MUX2-0 = I3-1)
57 addPin(new Pin(this, "CT_MUX", 3, 30, 80), Usage.OUTPUT, Position.TOP);
58 addPin(new Pin(this, "CT_INV", 1, 50, 80), Usage.OUTPUT, Position.TOP);
59 addPin(new Pin(this, "CT_EXP", 1, 70, 80), Usage.OUTPUT, Position.TOP);
63 protected Object recalculate(Object lastState, Map<String, ReadEnd> readEnds, Map<String, ReadWriteEnd> readWriteEnds)
65 Bit[] IBits = readEnds.get("I").getValues().getBits();
67 for (int i = 0; i < 6; i++)
74 for (ReadWriteEnd e : readWriteEnds.values())
75 e.feedSignals(BitVector.of(U, e.length()));
79 for (ReadWriteEnd e : readWriteEnds.values())
80 e.feedSignals(BitVector.of(X, e.length()));
85 throw new IllegalArgumentException("Unknown enum constant: " + IBits[i]);
91 readWriteEnds.get("muSR_MUX").feedSignals(ZERO, ONE);
92 readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
93 readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
94 readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
95 readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
96 readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
97 readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
100 readWriteEnds.get("muSR_MUX").feedSignals(ONE, ZERO);
101 readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
102 readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
103 readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
104 readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
105 readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
106 readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
109 readWriteEnds.get("muSR_MUX").feedSignals(ZERO, ZERO);
110 readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
111 readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
112 readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
113 readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
114 readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
115 readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
119 readWriteEnds.get("muSR_MUX").feedSignals(ONE, ONE);
120 readWriteEnds.get("muSR_OVRRET").feedSignals(ONE);
121 readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
122 readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
123 readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
124 readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
125 readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
128 readWriteEnds.get("muSR_MUX").feedSignals(ZERO, ZERO);
129 readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
130 readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
131 readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
132 readWriteEnds.get("muSR__WEC").feedSignals(ONE);
133 readWriteEnds.get("muSR__WEN").feedSignals(ONE);
134 readWriteEnds.get("muSR__WEOVR").feedSignals(ONE);
137 readWriteEnds.get("muSR_MUX").feedSignals(ONE, ZERO);
138 readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
139 readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
140 readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
141 readWriteEnds.get("muSR__WEC").feedSignals(ONE);
142 readWriteEnds.get("muSR__WEN").feedSignals(ONE);
143 readWriteEnds.get("muSR__WEOVR").feedSignals(ONE);
146 readWriteEnds.get("muSR_MUX").feedSignals(ZERO, ZERO);
147 readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
148 readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
149 readWriteEnds.get("muSR__WEZ").feedSignals(ONE);
150 readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
151 readWriteEnds.get("muSR__WEN").feedSignals(ONE);
152 readWriteEnds.get("muSR__WEOVR").feedSignals(ONE);
155 readWriteEnds.get("muSR_MUX").feedSignals(ONE, ZERO);
156 readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
157 readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
158 readWriteEnds.get("muSR__WEZ").feedSignals(ONE);
159 readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
160 readWriteEnds.get("muSR__WEN").feedSignals(ONE);
161 readWriteEnds.get("muSR__WEOVR").feedSignals(ONE);
164 readWriteEnds.get("muSR_MUX").feedSignals(ZERO, ZERO);
165 readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
166 readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
167 readWriteEnds.get("muSR__WEZ").feedSignals(ONE);
168 readWriteEnds.get("muSR__WEC").feedSignals(ONE);
169 readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
170 readWriteEnds.get("muSR__WEOVR").feedSignals(ONE);
173 readWriteEnds.get("muSR_MUX").feedSignals(ONE, ZERO);
174 readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
175 readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
176 readWriteEnds.get("muSR__WEZ").feedSignals(ONE);
177 readWriteEnds.get("muSR__WEC").feedSignals(ONE);
178 readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
179 readWriteEnds.get("muSR__WEOVR").feedSignals(ONE);
182 readWriteEnds.get("muSR_MUX").feedSignals(ZERO, ZERO);
183 readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
184 readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
185 readWriteEnds.get("muSR__WEZ").feedSignals(ONE);
186 readWriteEnds.get("muSR__WEC").feedSignals(ONE);
187 readWriteEnds.get("muSR__WEN").feedSignals(ONE);
188 readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
191 readWriteEnds.get("muSR_MUX").feedSignals(ONE, ZERO);
192 readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
193 readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
194 readWriteEnds.get("muSR__WEZ").feedSignals(ONE);
195 readWriteEnds.get("muSR__WEC").feedSignals(ONE);
196 readWriteEnds.get("muSR__WEN").feedSignals(ONE);
197 readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
205 readWriteEnds.get("muSR_MUX").feedSignals(ONE, ONE);
206 readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
207 readWriteEnds.get("muSR_CINV").feedSignals(ONE);
208 readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
209 readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
210 readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
211 readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
214 readWriteEnds.get("muSR_MUX").feedSignals(ONE, ONE);
215 readWriteEnds.get("muSR_OVRRET").feedSignals(ZERO);
216 readWriteEnds.get("muSR_CINV").feedSignals(ZERO);
217 readWriteEnds.get("muSR__WEZ").feedSignals(ZERO);
218 readWriteEnds.get("muSR__WEC").feedSignals(ZERO);
219 readWriteEnds.get("muSR__WEN").feedSignals(ZERO);
220 readWriteEnds.get("muSR__WEOVR").feedSignals(ZERO);
225 readWriteEnds.get("MSR_MUX").feedSignals(ONE, ONE, ZERO);
228 readWriteEnds.get("MSR_MUX").feedSignals(ONE, ZERO, ZERO);
231 readWriteEnds.get("MSR_MUX").feedSignals(ZERO, ONE, ZERO);
234 readWriteEnds.get("MSR_MUX").feedSignals(ZERO, ZERO, ZERO);
237 readWriteEnds.get("MSR_MUX").feedSignals(ZERO, ONE, ONE);
240 readWriteEnds.get("MSR_MUX").feedSignals(ONE, ONE, ONE);
250 readWriteEnds.get("MSR_MUX").feedSignals(ONE, ZERO, ONE);
253 readWriteEnds.get("MSR_MUX").feedSignals(ZERO, ZERO, ONE);
256 readWriteEnds.get("CT_SRC_MUX").feedSignals(IBits[0], IBits[1]);
257 readWriteEnds.get("CT_INV").feedSignals(IBits[5]);
258 readWriteEnds.get("CT_MUX").feedSignals(IBits[2], IBits[3], IBits[4]);
259 readWriteEnds.get("CT_EXP").feedSignals((IAsInt & 0b1110) == 0b1110 ? ONE : ZERO);
265 IndirectGUIComponentCreator.setComponentSupplier(GUIAm2904RegCTInstrDecode.class.getCanonicalName(),
266 (m, p, n) -> new GUIAm2904RegCTInstrDecode(m, n));