public Proc(Cache cache, AuxCache aux_cache, L1Cache l1_cache, string trace_fname) { pid = pmax; pmax++; //components inst_wnd = new InstWnd(Config.proc.inst_wnd_max); mshr = new List <Req>(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.aux_cache = aux_cache; this.l1_cache = l1_cache; cache_hit_queue = new LinkedList <Req>(); mem_queue = new LinkedList <Req>(); pollution_vector = new CachePollutionVector(); service_counter = new ServiceCounter(); t_excess_per_proc = new double[Config.N]; stride_prefetcher = new StridePrefetcher(); //initialize curr_rd_req = get_req(); total_read_latency = 0; high_priority_total_miss_latency = 0; high_priority_total_hit_latency = 0; high_priority_total_misses = 0; total_miss_latency = 0; total_hit_latency = 0; }
static void initialize() { //processors //crossbar xbar = new Xbar(); cache_controller = new CacheController(); stride_prefetcher = new StridePrefetcher(); //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; //sequential page table PageSequencer pseq = new PageSequencer(page_size, cmax, rmax, ddr3.BANK_MAX); Req.pseq = pseq; if (Config.is_shared_cache) { shared_cache = new Cache(); } else { shared_cache = null; } procs = new Proc[Config.N]; queuing_cycles = new int[Config.N]; if (Config.aux_cache) { for (int p = 0; p < Config.N; p++) if (shared_cache == null) procs[p] = new Proc(new Cache(), new AuxCache(), new L1Cache(), Config.traceFileNames[p]); else { procs[p] = new Proc(shared_cache, new AuxCache(), new L1Cache(), Config.traceFileNames[p]); } } else { 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]); } } if (Config.periodic_dump) { rep_name_periodic_service = Config.periodic_name + "_service_periodic.txt"; periodic_writer_service = File.CreateText(rep_name_periodic_service); rep_name_periodic_ipc = Config.periodic_name + "_ipc_periodic.txt"; 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); }
static void initialize() { //processors //crossbar xbar = new Xbar(); cache_controller = new CacheController(); stride_prefetcher = new StridePrefetcher(); //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; //sequential page table PageSequencer pseq = new PageSequencer(page_size, cmax, rmax, ddr3.BANK_MAX); Req.pseq = pseq; if (Config.is_shared_cache) { shared_cache = new Cache(); } else { shared_cache = null; } procs = new Proc[Config.N]; queuing_cycles = new int[Config.N]; if (Config.aux_cache) { for (int p = 0; p < Config.N; p++) { if (shared_cache == null) { procs[p] = new Proc(new Cache(), new AuxCache(), new L1Cache(), Config.traceFileNames[p]); } else { procs[p] = new Proc(shared_cache, new AuxCache(), new L1Cache(), Config.traceFileNames[p]); } } } else { 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]); } } } if (Config.periodic_dump) { rep_name_periodic_service = Config.periodic_name + "_service_periodic.txt"; periodic_writer_service = File.CreateText(rep_name_periodic_service); rep_name_periodic_ipc = Config.periodic_name + "_ipc_periodic.txt"; 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); }