public SimulationStat(int numCores, uint numThreadsPerCore) { ProcessorStat processor = new ProcessorStat (); for (int i = 0; i < numCores; i++) { CoreStat core = new CoreStat (); for (int j = 0; j < numThreadsPerCore; j++) { ContextStat context = new ContextStat (); processor.Contexts.Add (context); } processor.Cores.Add (core); } this.Processor = processor; this.L2Cache = new CacheStat (); this.MainMemory = new MainMemoryStat (); this.Reset (); }
public Thread(ICore core, ContextStat stat, uint num, Process process) { this.Core = core; this.Num = num; this.Process = process; this.Bpred = new CombinedBranchPredictor (); this.RenameTable = new RegisterRenameTable (this); this.ClearArchRegs (); this.MemoryMapId = MemoryManagementUnit.CurrentMemoryMapId++; this.Mem = new Memory (); this.Process.Load (this); this.Stat = stat; this.Itlb = new TranslationLookasideBuffer (this.Core, this.Core.Processor.Config.Tlb, this.Stat.Itlb); this.Dtlb = new TranslationLookasideBuffer (this.Core, this.Core.Processor.Config.Tlb, this.Stat.Dtlb); this.State = ThreadState.Active; for (uint i = 0; i < RegisterConstants.NUM_INT_REGS; i++) { PhysicalRegister physReg = this.Core.IntRegFile[this.Num * RegisterConstants.NUM_INT_REGS + i]; physReg.Commit (); this.RenameTable[RegisterDependency.Types.Integer, i] = physReg; } for (uint i = 0; i < RegisterConstants.NUM_FLOAT_REGS; i++) { PhysicalRegister physReg = this.Core.FpRegFile[this.Num * RegisterConstants.NUM_FLOAT_REGS + i]; physReg.Commit (); this.RenameTable[RegisterDependency.Types.Float, i] = physReg; } for (uint i = 0; i < RegisterConstants.NUM_MISC_REGS; i++) { PhysicalRegister physReg = this.Core.MiscRegFile[this.Num * RegisterConstants.NUM_MISC_REGS + i]; physReg.Commit (); this.RenameTable[RegisterDependency.Types.Misc, i] = physReg; } this.CommitWidth = core.Processor.Config.CommitWidth; this.DecodeBuffer = new List<DecodeBufferEntry> (); this.ReorderBuffer = new List<ReorderBufferEntry> (); this.LoadStoreQueue = new List<ReorderBufferEntry> (); this.FetchNpc = this.Regs.Npc; this.FetchNnpc = this.Regs.Nnpc; }