1 package net.mograsim.machine.mi.parameters;
3 import java.math.BigInteger;
5 import net.mograsim.logic.core.types.BitVector;
6 import net.mograsim.machine.mi.parameters.MicroInstructionParameter.ParameterType;
8 public class IntegerClassification implements ParameterClassification
10 private final int bits;
11 private final IntegerImmediate defaultValue;
14 * The default value is set to X.
16 public IntegerClassification(int bits)
19 this.defaultValue = new IntegerImmediate(this, null, bits);
22 public IntegerClassification(int defaultValue, int bits)
25 this.defaultValue = new IntegerImmediate(this, BitVector.from(defaultValue, bits));
29 public ParameterType getExpectedType()
31 return ParameterType.INTEGER_IMMEDIATE;
35 public int getExpectedBits()
41 public IntegerImmediate parse(String toParse)
43 return new IntegerImmediate(this, toParse.equals("X") ? null : new BigInteger(toParse), bits);
47 public MicroInstructionParameter getDefault()