public Byte2 Do(Byte address, bool store, Byte2 data, bool clock) { var invertedAddress = Gates.Invert(address.Four); var storeAtRam0 = Gates.And(invertedAddress, store); var storeAtRam1 = Gates.And(address.Four, store); var output0 = _ram0.Do(address.Low, storeAtRam0, data, clock); var output1 = _ram1.Do(address.Low, storeAtRam1, data, clock); var outputTotal = Select16.Do(address.Four, output1, output0); return(outputTotal); }
public void Store_different_values_at_different_addresses3() { // Arrange var ram = new RandomAccessMemory4(); var byte2A = new Byte2(42); var byte2B = new Byte2(3); var byte2C = new Byte2(999); var addressA = new Nibble(2); var addressB = new Nibble(7); // Act ram.Do(addressA, false, byte2A, false); ram.Do(addressA, true, byte2A, false); ram.Do(addressA, true, byte2A, true); ram.Do(addressB, true, byte2B, false); ram.Do(addressB, true, byte2B, true); var output = ram.Do(addressB, false, byte2C, false); // Assert output.ToInt16().Should().Be(3); }