Fixed test setup and added support for high level state access
[Mograsim.git] / net.mograsim.logic.model.am2900 / test / net / mograsim / logic / model / am2900 / am2910 / TestableAm2910.java
index 115f9cb..5290c5a 100644 (file)
@@ -1,5 +1,8 @@
 package net.mograsim.logic.model.am2900.am2910;
 
+import java.util.Arrays;
+import java.util.stream.Stream;
+
 import net.mograsim.logic.model.am2900.TestableCircuit;
 
 public interface TestableAm2910 extends TestableCircuit
@@ -19,6 +22,8 @@ public interface TestableAm2910 extends TestableCircuit
 
        void set_OE(String val_1_bit);
 
+       void setDirectly(Register r, String val_X_bit);
+
        String getY();
 
        String get_FULL();
@@ -29,8 +34,27 @@ public interface TestableAm2910 extends TestableCircuit
 
        String get_VECT();
 
+       String getDirectly(Register r);
+
        enum Am2910_Inst
        {
                JZ, CJS, JMAP, CJP, PUSH, JSRP, CJV, JRP, RFCT, RPCT, CRTN, CJPP, LDCT, LOOP, CONT, TWB;
        }
+
+       enum Register
+       {
+               S_0, S_1, S_2, S_3, S_4, SP, PC, REG_COUNT;
+
+               public static Stream<Register> stream()
+               {
+                       return Arrays.stream(values());
+               }
+
+               public int size()
+               {
+                       if (this == SP)
+                               return 3;
+                       return 12;
+               }
+       }
 }