Esempio n. 1
0
        public const int TOTAL_COG_MEMORY = 0x200;  // 512 longs of memory

        /// @brief Default constructor.
        public Cog(PropellerCPU host, uint programAddress, uint param, uint frequency, PLLGroup pll)
        {
            Hub = host;

            Memory         = new uint[TOTAL_COG_MEMORY];
            ProgramAddress = programAddress;
            ParamAddress   = param;

            FreqA           = new FreqGenerator(host, pll, true);
            FreqB           = new FreqGenerator(host, pll, false);
            Video           = new VideoGenerator(host);
            PhaseLockedLoop = pll;

            // Attach the video generator to PLLs
            PhaseLockedLoop.SetupPLL(Video);

            PC = 0;
            BreakPointCogCursor = -1;    // Breakpoint disabled initially

            // We are in boot time load
            Memory[(int)CogSpecialAddress.PAR] = param;
            State      = CogRunState.WAIT_LOAD_PROGRAM;
            StateCount = 0;

            // Clear the special purpose registers
            for (int i = (int)CogSpecialAddress.CNT; i <= 0x1FF; i++)
            {
                this[i] = 0;
            }

            SetClock(frequency);
        }