use of de.neemann.digital.TestExecuter in project Digital by hneemann.
the class BarrelShifterTest method testNormalUnsignedLeft.
public void testNormalUnsignedLeft() throws Exception {
TestExecuter bsTest = getTestExecuter(BarrelShifterMode.logical, false, LeftRightFormat.left, 6, 3);
bsTest.check(0b001100, 0, 0b001100);
bsTest.check(0b001100, 1, 0b011000);
bsTest.check(0b001100, 2, 0b110000);
bsTest.check(0b010001, 2, 0b000100);
bsTest.check(0b001100, 3, 0b100000);
bsTest.check(0b001100, 5, 0b000000);
bsTest.check(0b001100, -1, 0b000000);
bsTest.check(0b001100, -4, 0b000000);
bsTest.check(0b001100, -5, 0b100000);
for (int s = 0; s < 7; s++) bsTest.check(1, s, (1 << s) & 0b111111);
}
use of de.neemann.digital.TestExecuter in project Digital by hneemann.
the class BarrelShifterTest method testArithmeticUnsignedRight.
public void testArithmeticUnsignedRight() throws Exception {
TestExecuter bsTest = getTestExecuter(BarrelShifterMode.arithmetic, false, LeftRightFormat.right, 6, 3);
bsTest.check(0b001100, 0, 0b001100);
bsTest.check(0b001100, 1, 0b000110);
bsTest.check(0b001100, 2, 0b000011);
bsTest.check(0b010001, 2, 0b000100);
bsTest.check(0b001100, 3, 0b000001);
bsTest.check(0b001100, 5, 0b000000);
bsTest.check(0b001100, -1, 0b000000);
bsTest.check(0b001100, -4, 0b000000);
bsTest.check(0b001100, -5, 0b000001);
bsTest.check(0b101000, 0, 0b101000);
bsTest.check(0b101000, 1, 0b110100);
bsTest.check(0b101000, 2, 0b111010);
bsTest.check(0b101000, 3, 0b111101);
bsTest.check(0b101000, 5, 0b111111);
bsTest.check(0b101000, -1, 0b111111);
bsTest.check(0b101000, -4, 0b111110);
bsTest.check(0b101000, -5, 0b111101);
}
use of de.neemann.digital.TestExecuter in project Digital by hneemann.
the class BarrelShifterTest method testRotateSignedLeft.
public void testRotateSignedLeft() throws Exception {
TestExecuter bsTest = getTestExecuter(BarrelShifterMode.rotate, true, LeftRightFormat.left, 6, 4);
bsTest.check(0b001100, 0, 0b001100);
bsTest.check(0b001100, 1, 0b011000);
bsTest.check(0b001100, 2, 0b110000);
bsTest.check(0b010001, 2, 0b000101);
bsTest.check(0b001100, 3, 0b100001);
bsTest.check(0b001100, 5, 0b000110);
bsTest.check(0b001100, -1, 0b000110);
bsTest.check(0b001100, -4, 0b110000);
bsTest.check(0b001100, -5, 0b011000);
}
use of de.neemann.digital.TestExecuter in project Digital by hneemann.
the class BarrelShifterTest method testArithmeticUnsignedRight32.
public void testArithmeticUnsignedRight32() throws Exception {
TestExecuter bsTest = getTestExecuter(BarrelShifterMode.arithmetic, false, LeftRightFormat.right, 32, 6);
bsTest.check(0x80000000L, 0, 0x80000000L);
bsTest.check(0x80000000L, 1, 0xc0000000L);
bsTest.check(0x80000000L, 2, 0xe0000000L);
bsTest.check(0x80000000L, 3, 0xf0000000L);
bsTest.check(0x80000000L, 4, 0xf8000000L);
}
use of de.neemann.digital.TestExecuter in project Digital by hneemann.
the class BitCountTest method testBitCount64.
public void testBitCount64() throws Exception {
ObservableValue a = new ObservableValue("a", 64);
Model model = new Model();
BitCount node = new BitCount(new ElementAttributes().setBits(64));
node.setInputs(a.asList());
model.add(node);
TestExecuter sc = new TestExecuter(model).setInputs(a).setOutputs(node.getOutputs());
sc.check(0, 0);
sc.check(-1, 64);
sc.check(1, 1);
}
Aggregations