예제 #1
0
파일: ALU.cs 프로젝트: rbaker26/SAP1EMU
        //************************************************************************************************************************
        private void Exec(TicTok tictok)
        {
            string cw = SEQ.Instance().ControlWord;

            //  TODO - Find a better way of using the mask to get the value
            //          Currently is using hardcoded magic numbers

            //Allow the ALU to only set flags when the ALU is going to output to the bus.
            FlagEnable = tictok.ClockState == TicTok.State.Tic && cw[9] == '1';

            string temp;

            // Active Hi, SUB on Tic
            if (cw[8] == '1' && tictok.ClockState == TicTok.State.Tic)
            {
                temp = Compute(Areg.ToString(), Breg.ToString(), false);
            }
            else // ADD
            {
                temp = Compute(Areg.ToString(), Breg.ToString(), true);
            }

            // For Frame ToString support
            RegContent = temp;

            // Active Hi, Push on Tic
            if (cw[9] == '1' & tictok.ClockState == TicTok.State.Tic)
            {
                Wbus.Instance().Value = temp;
            }
        }
예제 #2
0
파일: SEQ.cs 프로젝트: rbaker26/SAP1EMU
        public static SEQ Instance()
        {
            // not thread safe
            if (_instance == null)
            {
                _instance = new SEQ();
                //_instance.ControlWord = "00‬1111100011";
                // TODO - this wasnt enough chars bc the words got longer, I fixed by addding _instance.ControlWord = ControlTable[0]; abouve
                // not a greate fix, but it works
            }

            return(_instance);
        }
예제 #3
0
        }                                                 // For ToString()

        private void Exec(TicTok tictok)
        {
            string cw = SEQ.Instance().ControlWord;

            //  TODO - Find a better way of using the mask to get the value
            //          Currently is using hardcoded magic numbers

            // Active Low, Push on Tic
            if (cw[3] == '0' && tictok.ClockState == TicTok.State.Tic)
            {
                string content        = GetWordAt(MARContents);
                Wbus.Instance().Value = content;
            }

            // LR_, Active Low, Pull on Tok
            if (cw[12] == '0' && tictok.ClockState == TicTok.State.Tok)
            {
                string word = Wbus.Instance().Value;
                SetWordAt(MARContents, word);
                RAM_Register_Content = word;
            }
        }