Esempio n. 1
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. 2
0
        public TrortRegisterCircuit(IBusComponentOutput <Trort> dataIn, IComponentOutput rwState,
                                    IComponentOutput railX, IComponentOutput railY, IComponentOutput railZ, IComponentOutput railT)
        {
            TritMatchCircuit4 addr = new TritMatchCircuit4(Trit.Pos, Trit.Pos, Trit.Pos, Trit.Pos);

            railX.Output += addr.InputA;
            railY.Output += addr.InputB;
            railZ.Output += addr.InputC;
            railT.Output += addr.InputD;

            register = new TrortRegister();

            outIfPosGate = new OutIfPosCircuit(addr, rwState);

            outIfPosGate.Output += register.ReadWriteEnabled;

            dataIn.BusOutput += register.BusInput;

            register.BusOutput += (s, t) => BusOutput?.Invoke(this, t);
        }
Esempio n. 3
0
        public void Address(object sender, Tryte address)
        {
            int addr = address.ToInt();

            if (addr < 0)
            {
                throw new IndexOutOfRangeException();
            }
            else if (addr < TRIBBLE_SIZE)
            {
                trortRegister = null;
                tryteRegister.ReadWriteEnabled(this, Trit.Neu);
                tryteRegister = _TryteRegisters[addr];
                tryteRegister.ReadWriteEnabled(this, rwEnabledState);
            }
            else if (addr < TRIBBLE_SIZE * 2)
            {
                tryteRegister = null;
                trortRegister.ReadWriteEnabled(this, Trit.Neu);
                trortRegister = _TrortRegisters[addr];
                trortRegister.ReadWriteEnabled(this, rwEnabledState);
            }
        }