// An instruction exits from a stage. private void ProcessInsnEndStage(string[] cols) { // 0 1 2 3 // field: E id stage segment ulong id = ParseUInt64(cols[1]); Insn insn = GetAliveInsn(id); if (insn == null) { m_errors.Add(string.Format("An unknown instruction ({0}) ends at line {1}.", id, m_currentLine)); return; } int segmentID = (int)ParseUInt64(cols[2]); string stageStr = cols[3]; Insn.Stage stage = GetStage(insn.Id, segmentID, stageStr); stage.EndRelCycle = (Int32)(m_currentCycle - insn.StartCycle); insn.AddStage(segmentID, stage); EndStage(insn.Id, segmentID, stageStr); if (stage == null) { m_errors.Add(string.Format("An unknown stage({0}) is finished at line {1}.", stageStr, m_currentLine)); } }
// Close all unclosed stages. private void CloseStages() { foreach (var segment in m_segments) { var stageMap = segment.stageMap; foreach (ulong id in stageMap.Keys) { Insn.Stage stage = stageMap[id]; if (stage != null) { Insn insn = GetAliveInsn(id); stage.EndRelCycle = (Int32)(m_currentCycle - insn.StartCycle); insn.AddStage(segment.SegmentID, stage); } } } foreach (var insn in m_insnMap.Values) { WriteInsnToDB(insn); } }