- var bits = BitVector.parse(val_4_bit);
- A3.setToValueOf(bits.getBit(0));
- A2.setToValueOf(bits.getBit(1));
- A1.setToValueOf(bits.getBit(2));
- A0.setToValueOf(bits.getBit(3));
+ // reverse because the BitVector.parse() expects the LSBit at the beginning and the MSBit at the end
+ var bits = BitVector.parse(new StringBuilder(val_4_bit).reverse().toString());
+ A3.setToValueOf(bits.getBit(3));
+ A2.setToValueOf(bits.getBit(2));
+ A1.setToValueOf(bits.getBit(1));
+ A0.setToValueOf(bits.getBit(0));