Beispiel #1
0
        public Proc(Cache cache, L1Cache l1_cache, string trace_fname)
        {
            pid = pmax;
            pmax++;

            //components
            inst_wnd = new InstWnd(Config.proc.inst_wnd_max);
            mshr = new List<ulong>(Config.proc.mshr_max);
            wb_q = new List<Req>(2 * Config.proc.wb_q_max);

            //other components
            Stat.procs[pid].trace_fname = trace_fname;
            trace = new Trace(pid, trace_fname);
            this.cache = cache;
            this.l1_cache = l1_cache;

            cache_hit_queue = new LinkedList<Req>();
            mem_queue = new LinkedList<Req>();
            criticality_table = new ulong[1024]; 
            criticality_running_table = new ulong[1024]; 

            //initialize
            curr_rd_req = get_req();
            total_read_latency = 0;            
        }
Beispiel #2
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);

        }