public void ShouldBeAbleToStoreAConstantValueInARegister() { var source = new List <IOperation> { OpCodes.Move(DataType.VectorOfByte, new VectorConstantOperand <int>(Vector <int> .One), new RegisterOperand(1)) }; var cpu = BuildCpu(source); cpu.Tick(); Vector.AsVectorInt32(cpu.Registers[1]).ShouldBe(Vector <int> .One); cpu.ProgramCounter.ShouldBe(37UL); }
public void ShouldBeAbleToMoveAPieceOfDataFromOneMemoryLocationToAnother() { var source = new List <IOperation> { OpCodes.Move(DataType.VectorOfByte, new VectorConstantOperand <int>(Vector <int> .One), new AddressOperand(100)), OpCodes.Move(DataType.VectorOfByte, new AddressOperand(100), new AddressOperand(150)), OpCodes.Move(DataType.VectorOfByte, new AddressOperand(150), new RegisterOperand(1)) }; var cpu = BuildCpu(source); RunProgram(cpu, source); Vector.AsVectorInt32(cpu.Registers[1]).ShouldBe(Vector <int> .One); }
public void ShouldBeAbleToMoveContentsOfARegisterToAnotherRegister() { var source = new List <IOperation> { OpCodes.Move(DataType.VectorOfByte, new VectorConstantOperand <byte>(Vector <byte> .One), new RegisterOperand(1)), OpCodes.Move(DataType.VectorOfByte, new RegisterOperand(1), new RegisterOperand(2)) }; var cpu = BuildCpu(source); RunProgram(cpu, source); cpu.Registers[2][0].ShouldBe((byte)1); }
public void ShouldBeAbleToMoveAScalarPieceOfDataFromOneMemoryLocationToAnother() { var source = new List <IOperation> { OpCodes.Move(DataType.UByte, new ScalarConstantOperand <byte>(1), new AddressOperand(190)), OpCodes.Move(DataType.Int32, new ScalarConstantOperand <int>(1000), new AddressOperand(192)), OpCodes.Move(DataType.UByte, new AddressOperand(190), new RegisterOperand(1)), OpCodes.Move(DataType.Int32, new AddressOperand(192), new RegisterOperand(2)), OpCodes.Move(DataType.Int32, new RegisterOperand(2), new AddressOperand(196)) }; var cpu = BuildCpu(source); RunProgram(cpu, source); cpu.Registers[1][0].ShouldBe((byte)1); Vector.AsVectorInt32(cpu.Registers[2])[0].ShouldBe(1000); cpu.Memory.RetrieveAddress(196, 4).NonPortableCast <byte, int>()[0].ShouldBe(1000); }