Shortened the memory test a bit because it was longer than necessary
[Mograsim.git] / net.mograsim.machine / src / net / mograsim / machine / mi / parameters / IntegerClassification.java
index d5ba964..c24cabe 100644 (file)
@@ -1,14 +1,19 @@
 package net.mograsim.machine.mi.parameters;
 
+import java.math.BigInteger;
+
+import net.mograsim.logic.core.types.BitVector;
 import net.mograsim.machine.mi.parameters.MicroInstructionParameter.ParameterType;
 
 public class IntegerClassification implements ParameterClassification
 {
        private final int bits;
-       
-       public IntegerClassification(int bits)
+       private final IntegerImmediate defaultValue;
+
+       public IntegerClassification(int defaultValue, int bits)
        {
                this.bits = bits;
+               this.defaultValue = new IntegerImmediate(BitVector.from(defaultValue, bits));
        }
 
        @Override
@@ -22,4 +27,16 @@ public class IntegerClassification implements ParameterClassification
        {
                return bits;
        }
+
+       @Override
+       public IntegerImmediate parse(String toParse)
+       {
+               return new IntegerImmediate(new BigInteger(toParse), bits);
+       }
+
+       @Override
+       public MicroInstructionParameter getDefault()
+       {
+               return defaultValue;
+       }
 }