Esempio n. 1
0
        public TrortAdder()
        {
            _Adders[0].CarryOutput += _Adders[1].InputCarry;
            _Adders[0].SumOutput   += (s, t) => { _Trits[0] = t; };

            _Adders[1].CarryOutput += _Adders[2].InputCarry;
            _Adders[1].SumOutput   += (s, t) => { _Trits[1] = t; };

            _Adders[2].CarryOutput += _Adders[3].InputCarry;
            _Adders[2].SumOutput   += (s, t) => { _Trits[2] = t; };

            _Adders[3].CarryOutput += _Adders[4].InputCarry;
            _Adders[3].SumOutput   += (s, t) => { _Trits[3] = t; };

            _Adders[4].CarryOutput += _Adders[5].InputCarry;
            _Adders[4].SumOutput   += (s, t) => { _Trits[4] = t; };

            _Adders[5].CarryOutput += _Adders[6].InputCarry;
            _Adders[5].SumOutput   += (s, t) => { _Trits[5] = t; };

            _Adders[6].CarryOutput += _Adders[7].InputCarry;
            _Adders[6].SumOutput   += (s, t) => { _Trits[6] = t; };

            _Adders[7].CarryOutput += _Adders[8].InputCarry;
            _Adders[7].SumOutput   += (s, t) => { _Trits[7] = t; };

            _Adders[8].CarryOutput += _Adders[9].InputCarry;
            _Adders[8].SumOutput   += (s, t) => { _Trits[8] = t; };

            _Adders[9].CarryOutput += _Adders[10].InputCarry;
            _Adders[9].SumOutput   += (s, t) => { _Trits[9] = t; };

            _Adders[10].CarryOutput += _Adders[11].InputCarry;
            _Adders[10].SumOutput   += (s, t) => { _Trits[10] = t; };

            _Adders[Trort.NUMBER_OF_TRITS - 1].CarryOutput += (s, carry) =>
            {
                CarryOutState = carry;

                if (!locker)
                {
                    CarryOut?.Invoke(this, carry);
                }
            };

            _Adders[Trort.NUMBER_OF_TRITS - 1].SumOutput += (s, sum) =>
            {
                _Trits[Trort.NUMBER_OF_TRITS - 1] = sum;

                if (!locker)
                {
                    BusOutput?.Invoke(this, BusValue);
                }
            };
        }
Esempio n. 2
0
 public TryteRegister()
 {
     _TernaryLatchGates[0].Output += (s, t) => { _Trits[0] = t; };
     _TernaryLatchGates[1].Output += (s, t) => { _Trits[1] = t; };
     _TernaryLatchGates[2].Output += (s, t) => { _Trits[2] = t; };
     _TernaryLatchGates[3].Output += (s, t) => { _Trits[3] = t; };
     _TernaryLatchGates[4].Output += (s, t) => { _Trits[4] = t; };
     _TernaryLatchGates[Tryte.NUMBER_OF_TRITS - 1].Output += (s, t) =>
     {
         _Trits[Tryte.NUMBER_OF_TRITS - 1] = t;
         BusOutput?.Invoke(this, Value);
     };
 }
Esempio n. 3
0
        public GPRegisters()
        {
            for (int i = 0; i < TRIBBLE_SIZE; i++)
            {
                TryteRegister treg = new TryteRegister();
                _TryteDataWire.BusOutput += treg.BusInput;
                treg.BusOutput           += (s, t) => BusOutput?.Invoke(this, new Trort(t));
                _TryteRegisters[i]        = treg;

                TrortRegister treg2 = new TrortRegister();
                _TrortDataWire.BusOutput += treg2.BusInput;
                treg2.BusOutput          += (s, t) => BusOutput?.Invoke(this, t);
                _TrortRegisters[i]        = treg2;
            }
        }
Esempio n. 4
0
        public TryteRegisterCircuit(IBusComponentOutput <Tryte> dataIn, IComponentOutput rwState, IComponentOutput railX, IComponentOutput railY)
        {
            TritMatchCircuit addr = new TritMatchCircuit(Trit.Pos, Trit.Pos);

            railX.Output += addr.InputA;
            railY.Output += addr.InputB;

            register = new TryteRegister();

            outIfPosGate = new OutIfPosCircuit(addr, rwState);

            outIfPosGate.Output += register.ReadWriteEnabled;

            dataIn.BusOutput += register.BusInput;

            register.BusOutput += (s, t) => BusOutput?.Invoke(this, t);
        }
Esempio n. 5
0
        public TryteMemory()
        {
            for (int x = 0; x < TRIBBLE_SIZE; x++)
            {
                for (int y = 0; y < TRIBBLE_SIZE; y++)
                {
                    TryteRegisterCircuit regComp = new TryteRegisterCircuit(_DataBus, _ReadWriteEnableWire, _XRails[x], _YRails[y]);

                    regComp.BusOutput += (s, t) => BusOutput?.Invoke(this, t);

                    _Addresses[x, y] = regComp;
                }
            }

            int c = 0;

            for (int i = -1; i < 2; i++)
            {
                for (int j = -1; j < 2; j++)
                {
                    for (int k = -1; k < 2; k++)
                    {
                        Muxer             muxer     = new Muxer(inputStateA: Trit.Neg, inputStateC: Trit.Pos);
                        TritMatchCircuit3 matchGate = new TritMatchCircuit3((Trit)i, (Trit)j, (Trit)k);
                        matchGate.Output += muxer.InputSelect;
                        muxer.Output     += _XRails[c].Input;
                        _XRailMatch[c]    = matchGate;

                        muxer             = new Muxer(inputStateA: Trit.Neg, inputStateC: Trit.Pos);
                        matchGate         = new TritMatchCircuit3((Trit)i, (Trit)j, (Trit)k);
                        matchGate.Output += muxer.InputSelect;
                        muxer.Output     += _YRails[c].Input;
                        _YRailMatch[c]    = matchGate;

                        c++;
                    }
                }
            }

#if DEBUG
            ComponentTools.SetComponentNames(this);
#endif
        }
Esempio n. 6
0
 public TrortRegister()
 {
     _TernaryLatchGates[0].Output  += (s, t) => { _Trits[0] = t; };
     _TernaryLatchGates[1].Output  += (s, t) => { _Trits[1] = t; };
     _TernaryLatchGates[2].Output  += (s, t) => { _Trits[2] = t; };
     _TernaryLatchGates[3].Output  += (s, t) => { _Trits[3] = t; };
     _TernaryLatchGates[4].Output  += (s, t) => { _Trits[4] = t; };
     _TernaryLatchGates[5].Output  += (s, t) => { _Trits[5] = t; };
     _TernaryLatchGates[6].Output  += (s, t) => { _Trits[6] = t; };
     _TernaryLatchGates[7].Output  += (s, t) => { _Trits[7] = t; };
     _TernaryLatchGates[8].Output  += (s, t) => { _Trits[8] = t; };
     _TernaryLatchGates[9].Output  += (s, t) => { _Trits[9] = t; };
     _TernaryLatchGates[10].Output += (s, t) => { _Trits[10] = t; };
     _TernaryLatchGates[Trort.NUMBER_OF_TRITS - 1].Output += (s, t) =>
     {
         _Trits[Trort.NUMBER_OF_TRITS - 1] = t;
         BusOutput?.Invoke(this, Value);
     };
 }
Esempio n. 7
0
        public STrortAddrTryteMemory()
        {
            for (int x = 0; x < TRIBBLE_SIZE; x++)
            {
                for (int y = 0; y < TRIBBLE_SIZE; y++)
                {
                    for (int z = 0; z < TRIBBLE_SIZE; z++)
                    {
                        for (int t = 0; t < TRIBBLE_SIZE; t++)
                        {
                            TryteRegister register = new TryteRegister();

                            _DataBus.BusOutput += register.BusInput;

                            register.BusOutput += (s, val) => BusOutput?.Invoke(this, val);

                            _Registers[x, y, z, t] = register;
                        }
                    }
                }
            }
        }
Esempio n. 8
0
 protected void InvokeOutput(object sender, T output)
 {
     OutputState = output;
     BusOutput?.Invoke(sender, output);
 }
Esempio n. 9
0
 protected void InvokeBusOutput(T data, object sender = null)
 {
     BusOutput?.Invoke(sender ?? this, data);
 }
Esempio n. 10
0
 protected void InvokeOutput(object sender, Tryte output)
 {
     BusValue = output;
     BusOutput?.Invoke(this, output);
 }