public void Register_can_be_set_when_clock_is_false()
        {
            var register16Bit = new Register16Bit();

            register16Bit.Do(true, new Byte2(17), false);
            var output = register16Bit.Do(false, new Byte2(0), true);

            output.ToInt16().Should().Be(17);
        }
        public Byte2 Do(bool store, Byte2 data, bool clock)
        {
            var invertedClock = Gates.Invert(clock);

            incremented = Arithmetics.Increment(registeredOutput);

            _selectedData = Select16.Do(store,
                                        data,
                                        incremented);

            registeredOutput = register.Do(invertedClock,
                                           _selectedData,
                                           clock);

            return(registeredOutput);
        }
Example #3
0
        public Byte2 Do(bool address, bool store, Byte2 data, bool clock)
        {
            var storeAtBank1 = Gates.And(address, store);

            var invertedAddress = Gates.Invert(address);
            var storeAtBank0    = Gates.And(invertedAddress, store);

            _output1 = _register1.Do(storeAtBank1, data, clock);

            _output0 = _register0.Do(storeAtBank0, data, clock);

            var outputTotal = Select16.Do(address,
                                          _output1,
                                          _output0);

            return(outputTotal);
        }