Esempio n. 1
0
        static void initialize()
        {
            //processors

            //crossbar
            xbar = new Xbar();

            //ddr3
            DDR3DRAM ddr3 = new DDR3DRAM(Config.mem.ddr3_type, Config.mem.clock_factor, Config.mem.tWR, Config.mem.tWTR);
            uint     cmax = (uint)Config.mem.channel_max;
            uint     rmax = (uint)Config.mem.rank_max;

            //randomized page table
            ulong          page_size = 4 * 1024;
            PageRandomizer prand     = new PageRandomizer(page_size);

            Req.prand = prand;

            Console.Write("Initializing prand\n");

            //sequential page table
            PageSequencer pseq = new PageSequencer(page_size, cmax, rmax, ddr3.BANK_MAX);

            Req.pseq = pseq;

            if (Config.is_shared_cache)
            {
                Console.Write("Initializing shared cache\n");
                shared_cache = new Cache();
            }
            else
            {
                Console.Write("Initializing private cache\n");
                shared_cache = null;
            }

            procs = new Proc[Config.N];

            for (int p = 0; p < Config.N; p++)
            {
                if (shared_cache == null)
                {
                    procs[p] = new Proc(new Cache(), new L1Cache(), Config.traceFileNames[p]);
                }
                else
                {
                    Console.Write("Shared\n");
                    procs[p] = new Proc(shared_cache, new L1Cache(), Config.traceFileNames[p]);
                }
            }

            Console.Write(" periodic dump " + Config.periodic_dump + "\n");
            if (Config.periodic_dump)
            {
                rep_name_periodic_ipc = Config.periodic_name + "_ipc_periodic.txt";
                Console.Write("Creating IPC periodic file\n");
                periodic_writer_ipc = File.CreateText(rep_name_periodic_ipc);
            }


            //memory mapping
            MemMap.init(Config.mem.map_type, Config.mem.channel_max, Config.mem.rank_max, Config.mem.col_per_subrow, ddr3);

            //memory controllers
            mctrls = new MemCtrl[cmax];
            for (int i = 0; i < mctrls.Length; i++)
            {
                mctrls[i] = new MemCtrl(rmax, ddr3);
            }

            //memory schedulers and metamemory controllers
            if (!Config.sched.is_omniscient)
            {
                MemSched[] scheds = new MemSched[cmax];
                for (int i = 0; i < cmax; i++)
                {
                    scheds[i] = Activator.CreateInstance(Config.sched.typeof_sched_algo) as MemSched;
                }

                MemSched[] wbscheds = new MemSched[cmax];
                if (!Config.sched.same_sched_algo)
                {
                    for (int i = 0; i < cmax; i++)
                    {
                        wbscheds[i] = Activator.CreateInstance(Config.sched.typeof_wbsched_algo) as MemSched;
                    }
                }
                else
                {
                    for (int i = 0; i < cmax; i++)
                    {
                        wbscheds[i] = scheds[i];
                    }
                }

                MetaMemCtrl[] meta_mctrls = new MetaMemCtrl[cmax];
                for (int i = 0; i < cmax; i++)
                {
                    meta_mctrls[i]       = new MetaMemCtrl(mctrls[i], scheds[i], wbscheds[i]);
                    mctrls[i].meta_mctrl = meta_mctrls[i];
                    scheds[i].meta_mctrl = meta_mctrls[i];
                    scheds[i].initialize();
                    wbscheds[i].meta_mctrl = meta_mctrls[i];
                    wbscheds[i].initialize();
                }
            }
            else
            {
                MemSched sched = Activator.CreateInstance(Config.sched.typeof_sched_algo) as MemSched;
                MemSched wbsched;
                if (!Config.sched.same_sched_algo)
                {
                    wbsched = Activator.CreateInstance(Config.sched.typeof_wbsched_algo) as MemSched;
                }
                else
                {
                    wbsched = sched;
                }

                MetaMemCtrl meta_mctrl = new MetaMemCtrl(mctrls, sched, wbsched);
                for (int i = 0; i < cmax; i++)
                {
                    mctrls[i].meta_mctrl = meta_mctrl;
                }
                sched.meta_mctrl = meta_mctrl;
                sched.initialize();
                wbsched.meta_mctrl = meta_mctrl;
                wbsched.initialize();
            }

            //wbmode
            mwbmode = Activator.CreateInstance(Config.mctrl.typeof_wbmode_algo, new Object[] { mctrls }) as MemWBMode;
            for (int i = 0; i < cmax; i++)
            {
                mctrls[i].mwbmode = mwbmode;
            }

            //blp tracker
            blptracker = new BLPTracker(mctrls);
        }
Esempio n. 2
0
        static void initialize()
        {
            if (Config.task_based == true)
            {
                string task_fname = Config.traceFileNames[0];
                if (Config.sim_type == Config.SIM_TYPE.GROUPED)
                {
                    task_fname = Config.traceFileNames[Config.group_boundary];
                }
                foreach (string dir in Config.TraceDirs.Split(',', ' '))
                {
                    if (File.Exists(dir + "/" + task_fname))
                    {
                        task_fname = dir + "/" + task_fname;
                    }
                }
                Dbg.Assert(File.Exists(task_fname));
                StreamReader tasks = new StreamReader(File.OpenRead(task_fname));
                while (true)
                {
                    string line = tasks.ReadLine();
                    if (line == null)
                    {
                        break;
                    }
                    task_queue.Enqueue(line);
                }
                tasks.Close();
            }

            Dram_Utilization_size = 0;
            Dram_req_num          = 0;
            NVM_req_num           = 0;

            //randomized page table
            ulong          page_size = 4 * 1024;
            PageRandomizer prand     = new PageRandomizer(page_size);

            Req.prand = prand;

            //processors
            procs = new Proc[Config.N];
            for (int p = 0; p < Config.N; p++)
            {
                if ((Config.task_based == true && Config.sim_type != Config.SIM_TYPE.GROUPED) ||
                    (Config.task_based == true && Config.sim_type == Config.SIM_TYPE.GROUPED && p >= Config.group_boundary && p < Config.N))
                {
                    procs[p] = new Proc(task_queue.Dequeue());
                }
                else
                {
                    procs[p] = new Proc(Config.traceFileNames[p]);
                }
            }

            //crossbar
            xbar = new Xbar();

// warmup phase
            proc_warmup        = new bool[Config.N];
            proc_warmup_cycles = new ulong[Config.N];
            for (int p = 0; p < Config.N; p++)
            {
                proc_warmup[p]        = false;
                proc_warmup_cycles[p] = 0;
            }

// Power Measurement:
            processor_finished        = new bool[Config.N];
            DRAM_processor_read_hit   = new ulong[Config.N];
            DRAM_processor_read_miss  = new ulong[Config.N];
            DRAM_processor_write_hit  = new ulong[Config.N];
            DRAM_processor_write_miss = new ulong[Config.N];
            DRAM_migration_read_hit   = new ulong[Config.N];
            DRAM_migration_read_miss  = new ulong[Config.N];
            DRAM_migration_write_hit  = new ulong[Config.N];
            DRAM_migration_write_miss = new ulong[Config.N];
            NVM_processor_read_hit    = new ulong[Config.N];
            NVM_processor_read_miss   = new ulong[Config.N];
            NVM_processor_write_hit   = new ulong[Config.N];
            NVM_processor_write_miss  = new ulong[Config.N];
            NVM_migration_read_hit    = new ulong[Config.N];
            NVM_migration_read_miss   = new ulong[Config.N];
            NVM_migration_write_hit   = new ulong[Config.N];
            NVM_migration_write_miss  = new ulong[Config.N];
            processor_cycles          = new ulong[Config.N];

            for (int p = 0; p < Config.N; p++)
            {
                processor_finished[p]        = false;
                DRAM_processor_read_hit[p]   = 0;
                DRAM_processor_read_miss[p]  = 0;
                DRAM_processor_write_hit[p]  = 0;
                DRAM_processor_write_miss[p] = 0;
                DRAM_migration_read_hit[p]   = 0;
                DRAM_migration_read_miss[p]  = 0;
                DRAM_migration_write_hit[p]  = 0;
                DRAM_migration_write_miss[p] = 0;
                NVM_processor_read_hit[p]    = 0;
                NVM_processor_read_miss[p]   = 0;
                NVM_processor_write_hit[p]   = 0;
                NVM_processor_write_miss[p]  = 0;
                NVM_migration_read_hit[p]    = 0;
                NVM_migration_read_miss[p]   = 0;
                NVM_migration_write_hit[p]   = 0;
                NVM_migration_write_miss[p]  = 0;
                processor_cycles[p]          = 0;
            }
//

            //Jin: Row Migration Policies
            rmp   = new Row_Migration_Policies();
            mesur = new Measurement();

            //ddr3
            DDR3DRAM ddr3 = new DDR3DRAM(Config.mem.ddr3_type, Config.mem.clock_factor, Config.mem.tWR, Config.mem.tWTR);
            uint     cmax = (uint)Config.mem.channel_max;
            uint     rmax = (uint)Config.mem.rank_max;

            //sequential page table
            PageSequencer pseq = new PageSequencer(page_size, cmax, rmax, ddr3.BANK_MAX);

            Req.pseq = pseq;


            //memory mapping
            MemMap.init(Config.mem.map_type, Config.mem.channel_max, Config.mem.rank_max, Config.mem.col_per_subrow, ddr3);

            //memory controllers
            mctrls = new MemCtrl[Config.mem.mctrl_num][];
            for (int n = 0; n < Config.mem.mctrl_num; n++)
            {
                mctrls[n] = new MemCtrl[cmax];
                for (int i = 0; i < mctrls[n].Length; i++)
                {
                    mctrls[n][i] = new MemCtrl(rmax, ddr3);
                }
            }

            //memory schedulers and metamemory controllers
            if (!Config.sched.is_omniscient)
            {
                MemSched[][] scheds = new MemSched[Config.mem.mctrl_num][];
                for (int n = 0; n < Config.mem.mctrl_num; n++)
                {
                    scheds[n] = new MemSched[cmax];
                    for (int i = 0; i < cmax; i++)
                    {
                        scheds[n][i] = Activator.CreateInstance(Config.sched.typeof_sched_algo) as MemSched;
                    }
                }

                MemSched[][] wbscheds = new MemSched[Config.mem.mctrl_num][];
                for (int n = 0; n < Config.mem.mctrl_num; n++)
                {
                    wbscheds[n] = new MemSched[cmax];
                    if (!Config.sched.same_sched_algo)
                    {
                        for (int i = 0; i < cmax; i++)
                        {
                            wbscheds[n][i] = Activator.CreateInstance(Config.sched.typeof_wbsched_algo) as MemSched;
                        }
                    }
                    else
                    {
                        for (int i = 0; i < cmax; i++)
                        {
                            wbscheds[n][i] = scheds[n][i];
                        }
                    }
                }

                MetaMemCtrl[][] meta_mctrls = new MetaMemCtrl[Config.mem.mctrl_num][];
                for (int n = 0; n < Config.mem.mctrl_num; n++)
                {
                    meta_mctrls[n] = new MetaMemCtrl[cmax];
                    for (int i = 0; i < cmax; i++)
                    {
                        meta_mctrls[n][i]       = new MetaMemCtrl(mctrls[n][i], scheds[n][i], wbscheds[n][i]);
                        mctrls[n][i].meta_mctrl = meta_mctrls[n][i];
                        scheds[n][i].meta_mctrl = meta_mctrls[n][i];
                        scheds[n][i].initialize();
                        wbscheds[n][i].meta_mctrl = meta_mctrls[n][i];
                        wbscheds[n][i].initialize();
                    }
                }
            }
            else
            {
                MemSched[] sched   = new MemSched[Config.mem.mctrl_num];
                MemSched[] wbsched = new MemSched[Config.mem.mctrl_num];
                for (int n = 0; n < Config.mem.mctrl_num; n++)
                {
                    sched[n] = Activator.CreateInstance(Config.sched.typeof_sched_algo) as MemSched;
                    if (!Config.sched.same_sched_algo)
                    {
                        wbsched[n] = Activator.CreateInstance(Config.sched.typeof_wbsched_algo) as MemSched;
                    }
                    else
                    {
                        wbsched[n] = sched[n];
                    }
                }

                MetaMemCtrl[] meta_mctrl = new MetaMemCtrl[Config.mem.mctrl_num];
                for (int n = 0; n < Config.mem.mctrl_num; n++)
                {
                    meta_mctrl[n] = new MetaMemCtrl(mctrls[n], sched[n], wbsched[n]);
                    for (int i = 0; i < cmax; i++)
                    {
                        mctrls[n][i].meta_mctrl = meta_mctrl[n];
                    }
                    sched[n].meta_mctrl = meta_mctrl[n];
                    sched[n].initialize();
                    wbsched[n].meta_mctrl = meta_mctrl[n];
                    wbsched[n].initialize();
                }
            }

            //wbmode
            for (int n = 0; n < Config.mem.mctrl_num; n++)
            {
                mwbmode = Activator.CreateInstance(Config.mctrl.typeof_wbmode_algo, new Object[] { mctrls[n] }) as MemWBMode;
                for (int i = 0; i < cmax; i++)
                {
                    mctrls[n][i].mwbmode = mwbmode;
                }

                //blp tracker
                blptracker = new BLPTracker(mctrls[n]);
            }
        }
Esempio n. 3
0
        static void initialize()
        {
            //processors

            //crossbar
            xbar = new Xbar();

            //ddr3
            DDR3DRAM ddr3 = new DDR3DRAM(Config.mem.ddr3_type, Config.mem.clock_factor, Config.mem.tWR, Config.mem.tWTR);
            uint cmax = (uint)Config.mem.channel_max;
            uint rmax = (uint)Config.mem.rank_max;

            //randomized page table
            ulong page_size = 4 * 1024;
            PageRandomizer prand = new PageRandomizer(page_size);
            Req.prand = prand;

            Console.Write("Initializing prand\n");

            //sequential page table
            PageSequencer pseq = new PageSequencer(page_size, cmax, rmax, ddr3.BANK_MAX);
            Req.pseq = pseq;

            if (Config.is_shared_cache)
            {
                Console.Write("Initializing shared cache\n");
                shared_cache = new Cache();         
            }
            else
            {
                Console.Write("Initializing private cache\n");
                shared_cache = null;
            }
    
            procs = new Proc[Config.N];

            for (int p = 0; p < Config.N; p++) {
                if (shared_cache == null)              
                    procs[p] = new Proc(new Cache(), new L1Cache(), Config.traceFileNames[p]);
                else
                {
                    Console.Write("Shared\n");
                    procs[p] = new Proc(shared_cache, new L1Cache(), Config.traceFileNames[p]);
                }
            }

            Console.Write(" periodic dump " + Config.periodic_dump + "\n");
            if (Config.periodic_dump)
            {

               rep_name_periodic_ipc = Config.periodic_name + "_ipc_periodic.txt";
               Console.Write("Creating IPC periodic file\n");
               periodic_writer_ipc = File.CreateText(rep_name_periodic_ipc);

            }


            //memory mapping
            MemMap.init(Config.mem.map_type, Config.mem.channel_max, Config.mem.rank_max, Config.mem.col_per_subrow, ddr3);

            //memory controllers
            mctrls = new MemCtrl[cmax];
            for (int i = 0; i < mctrls.Length; i++) {
                mctrls[i] = new MemCtrl(rmax, ddr3);
            }

            //memory schedulers and metamemory controllers
            if (!Config.sched.is_omniscient) {
                MemSched[] scheds = new MemSched[cmax];
                for (int i = 0; i < cmax; i++) {
                    scheds[i] = Activator.CreateInstance(Config.sched.typeof_sched_algo) as MemSched;
                }

                MemSched[] wbscheds = new MemSched[cmax];
                if (!Config.sched.same_sched_algo) {
                    for (int i = 0; i < cmax; i++) {
                        wbscheds[i] = Activator.CreateInstance(Config.sched.typeof_wbsched_algo) as MemSched;
                    }
                }
                else {
                    for (int i = 0; i < cmax; i++) {
                        wbscheds[i] = scheds[i];
                    }
                }

                MetaMemCtrl[] meta_mctrls = new MetaMemCtrl[cmax];
                for (int i = 0; i < cmax; i++) {
                    meta_mctrls[i] = new MetaMemCtrl(mctrls[i], scheds[i], wbscheds[i]);
                    mctrls[i].meta_mctrl = meta_mctrls[i];
                    scheds[i].meta_mctrl = meta_mctrls[i];
                    scheds[i].initialize();
                    wbscheds[i].meta_mctrl = meta_mctrls[i];
                    wbscheds[i].initialize();
                }
            }
            else {
                MemSched sched = Activator.CreateInstance(Config.sched.typeof_sched_algo) as MemSched;
                MemSched wbsched;
                if (!Config.sched.same_sched_algo) {
                    wbsched = Activator.CreateInstance(Config.sched.typeof_wbsched_algo) as MemSched;
                }
                else {
                    wbsched = sched;
                }
                
                MetaMemCtrl meta_mctrl = new MetaMemCtrl(mctrls, sched, wbsched);
                for (int i = 0; i < cmax; i++) {
                    mctrls[i].meta_mctrl = meta_mctrl;
                }
                sched.meta_mctrl = meta_mctrl;
                sched.initialize();
                wbsched.meta_mctrl = meta_mctrl;
                wbsched.initialize();
            }

            //wbmode
            mwbmode = Activator.CreateInstance(Config.mctrl.typeof_wbmode_algo, new Object[] { mctrls }) as MemWBMode;
            for (int i = 0; i < cmax; i++) {
                mctrls[i].mwbmode = mwbmode;
            }

            //blp tracker
            blptracker = new BLPTracker(mctrls);

        }