public DRAMTrueLRU() { this.sets = Config.proc.cache_sets; this.ways = Config.proc.cache_ways; this.latency = Config.proc.cache_latency; data = new TagEntry[sets][]; reqs = new Queue <Req>(); wbs = new Queue <Req>(); DDR3DRAM ddr3 = new DDR3DRAM(Config.mem2.ddr3_type, Config.mem2.clock_factor, Config.mem2.tWR, Config.mem2.tWTR); uint cmax = (uint)Config.mem2.channel_max; uint rmax = (uint)Config.mem2.rank_max; //memory controllers mctrls2 = new MemCtrl2[Config.mem2.mctrl_num][]; for (int n = 0; n < Config.mem2.mctrl_num; n++) { mctrls2[n] = new MemCtrl2[cmax]; for (int i = 0; i < mctrls2[n].Length; i++) { mctrls2[n][i] = new MemCtrl2(rmax, ddr3); } } //memory schedulers and metamemory controllers if (!Config.sched.is_omniscient) { MemSched2[][] scheds = new MemSched2[Config.mem2.mctrl_num][]; for (int n = 0; n < Config.mem2.mctrl_num; n++) { scheds[n] = new MemSched2[cmax]; for (int i = 0; i < cmax; i++) { scheds[n][i] = Activator.CreateInstance(Config.sched.typeof_sched_algo2) as MemSched2; } } MemSched2[][] wbscheds = new MemSched2[Config.mem2.mctrl_num][]; for (int n = 0; n < Config.mem2.mctrl_num; n++) { wbscheds[n] = new MemSched2[cmax]; if (!Config.sched.same_sched_algo) { for (int i = 0; i < cmax; i++) { wbscheds[n][i] = Activator.CreateInstance(Config.sched.typeof_wbsched_algo2) as MemSched2; } } else { for (int i = 0; i < cmax; i++) { wbscheds[n][i] = scheds[n][i]; } } } MetaMemCtrl2[][] meta_mctrls2 = new MetaMemCtrl2[Config.mem2.mctrl_num][]; for (int n = 0; n < Config.mem2.mctrl_num; n++) { meta_mctrls2[n] = new MetaMemCtrl2[cmax]; for (int i = 0; i < cmax; i++) { meta_mctrls2[n][i] = new MetaMemCtrl2(mctrls2[n][i], scheds[n][i], wbscheds[n][i]); mctrls2[n][i].meta_mctrl = meta_mctrls2[n][i]; scheds[n][i].meta_mctrl = meta_mctrls2[n][i]; scheds[n][i].initialize(); wbscheds[n][i].meta_mctrl = meta_mctrls2[n][i]; wbscheds[n][i].initialize(); } } } else { MemSched2[] sched = new MemSched2[Config.mem2.mctrl_num]; MemSched2[] wbsched = new MemSched2[Config.mem2.mctrl_num]; for (int n = 0; n < Config.mem2.mctrl_num; n++) { sched[n] = Activator.CreateInstance(Config.sched.typeof_sched_algo2) as MemSched2; if (!Config.sched.same_sched_algo) { wbsched[n] = Activator.CreateInstance(Config.sched.typeof_wbsched_algo2) as MemSched2; } else { wbsched[n] = sched[n]; } } MetaMemCtrl2[] meta_mctrl = new MetaMemCtrl2[Config.mem2.mctrl_num]; for (int n = 0; n < Config.mem2.mctrl_num; n++) { meta_mctrl[n] = new MetaMemCtrl2(mctrls2[n], sched[n], wbsched[n]); for (int i = 0; i < cmax; i++) { mctrls2[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.mem2.mctrl_num; n++) { Console.WriteLine(Config.mctrl.typeof_wbmode_algo); mwbmode = Activator.CreateInstance(Config.mctrl.typeof_wbmode_algo2, new Object[] { mctrls2[n] }) as MemWBMode2; for (int i = 0; i < cmax; i++) { mctrls2[n][i].mwbmode = mwbmode; } //blp tracker blptracker = new BLPTracker2(mctrls2[n]); } for (int set = 0; set < sets; set++) { data[set] = new TagEntry[ways]; for (int way = 0; way < ways; way++) { data[set][way] = new TagEntry(); data[set][way].valid = false; data[set][way].addr = 0x0; data[set][way].access = 0; // data[set][way].dirty = false; data[set][way].pid = -1; data[set][way].block_valid = new bool[Config.proc.page_block_diff]; data[set][way].block_dirty = new bool[Config.proc.page_block_diff]; for (int block_id = 0; block_id < Config.proc.page_block_diff; block_id++) { data[set][way].block_valid[block_id] = false; data[set][way].block_dirty[block_id] = false; } } } }