def get_pnr_groups(): groups = [] qor_file = "./rpts/icc2_placeopt/icc2_placeopt.report_qor.rpt.gz" if os.path.isfile(qor_file): f_readlines = opf.readlines_file(qor_file) groupFlag = "" for line in f_readlines: dataTemp = line.split(":") matchTimingGpLine = re.search("Timing Path Group", line) if matchTimingGpLine: headTemp = line.split("'") if len(headTemp) == 1: groupFlag = "no_clock" else: groupFlag = headTemp[1].strip() if "in2" not in groupFlag and "2out" not in groupFlag and "default" not in groupFlag and "input" not in groupFlag and "output" not in groupFlag and "tocto" not in groupFlag and "CLK" not in groupFlag: groups.append(groupFlag) return groups
def parse_pnr_qor_rpt(rpt_file): f_readlines = opf.readlines_file(rpt_file) Dict = {} scenarioFlag = "" groupFlag = "" for line in f_readlines: line = line.strip() dataTemp = line.split(":") matchScenarioLine = re.search("Scenario", line) matchTimingGpLine = re.search("Timing Path Group", line) matchWNSLine = re.search("Critical Path Slack", line) matchTNSLine = re.search("Total Negative Slack", line) matchNoVLine = re.search("No. of Violating Paths", line) matchHWNSLine = re.search("Worst Hold Violation", line) matchHTNSLine = re.search("Total Hold Violation", line) matchHNoVLine = re.search("No. of Hold Violations", line) if matchScenarioLine: headTemp = line.split("'") scenarioFlag = headTemp[1].strip() if scenarioFlag not in Dict: Dict[scenarioFlag] = {} elif matchTimingGpLine: headTemp = line.split("'") if len(headTemp) == 1: groupFlag = "no_clock" else: groupFlag = headTemp[1].strip() if groupFlag not in Dict[scenarioFlag]: Dict[scenarioFlag][groupFlag] = {} elif matchWNSLine: Dict[scenarioFlag][groupFlag]["WNS"] = dataTemp[1].strip() elif matchTNSLine: Dict[scenarioFlag][groupFlag]["TNS"] = dataTemp[1].strip() elif matchNoVLine: Dict[scenarioFlag][groupFlag]["#Vio"] = dataTemp[1].strip() elif matchHWNSLine: Dict[scenarioFlag][groupFlag]["Hold WNS"] = dataTemp[1].strip() elif matchHTNSLine: Dict[scenarioFlag][groupFlag]["Hold TNS"] = dataTemp[1].strip() elif matchHNoVLine: Dict[scenarioFlag][groupFlag]["Hold #Vio"] = dataTemp[1].strip() return Dict
def parse_pt_qor_rpt(rpt_file): f_readlines = opf.readlines_file(rpt_file) Dict = {} for line in f_readlines: line = line.strip() dataTemp = line.split(":") matchTimingGpLine = re.search("Timing Path Group", line) matchWNSLine = re.search("Critical Path Slack", line) matchTNSLine = re.search("Total Negative Slack", line) matchNoVLine = re.search("No. of Violating Paths", line) if matchTimingGpLine: headTemp = line.split("'") groupFlag = headTemp[1].strip() if groupFlag not in Dict: Dict[groupFlag] = {} elif matchWNSLine: Dict[groupFlag]["WNS"] = dataTemp[1].strip() elif matchTNSLine: Dict[groupFlag]["TNS"] = dataTemp[1].strip() elif matchNoVLine: Dict[groupFlag]["#Vio"] = dataTemp[1].strip() return Dict
def get_clock_info(): clock_dict = {} clk_rpt = "./rpts/icc2_cts/icc2_cts.report_clock_qor.all.rpt" if os.path.isfile(clk_rpt): fo_readlines = opf.readlines_file(clk_rpt) for line in fo_readlines: line = line.strip() flag1 = re.compile(".*Summary Reporting for Corner\s*(\S+)\s*.*") flag2 = re.compile( "(\S+)\s+M,D\s+(\S+)\s+(\S+)\s+(\S+)\s+\S+\s+\S+\s+(\S+)\s+(\S+)\s+\S+\s+\S+" ) f1 = flag1.match(line) if f1: corner = f1.group(1) if corner not in clock_dict: clock_dict[corner] = {} f2 = flag2.match(line) if f2: clock = f2.group(1) sinks = f2.group(2) level = f2.group(3) repeater = f2.group(4) latency = f2.group(5) skew = f2.group(6) if clock not in clock_dict[corner]: clock_dict[corner][clock] = {} clock_dict[corner][clock]["clock_name"] = clock clock_dict[corner][clock]["sinks"] = sinks clock_dict[corner][clock]["level"] = level clock_dict[corner][clock]["repeater"] = repeater clock_dict[corner][clock]["latency"] = latency clock_dict[corner][clock]["skew"] = skew else: clock_dict = {} print("Info: Can't find ", clk_rpt) return clock_dict
def sum_timing(rpt): is_timing_report = 0 short_flag = 1 no_derate_flag = 1 si_flag = 0 nonsi_flag = 0 start_flag = 0 level_flag = 0 end_flag = 0 latch_flag = 0 end_clock_flag = 0 startpoint_cell = "" endpoint_cell = "" startpoint_clock = "" endpoint_clock = "" startpoint_latency = "" endpoint_latency = "" skew = 0 level = 0 buf_num = 0 clock_period = 0 f_readlines = opf.readlines_file(rpt) Dict = {} slack_list = [] for line in f_readlines: line = line.strip() if "_nonsi" in line: nonsi_flag = 1 if "-groups reg2cgate" in line: latch_flag = 1 mHead = re.match("^Report\s+:\s+[tT]iming",line) mStart = re.match("Startpoint:\s(\S+)\s\S+\s\S+\s\S+\s\S+\s\S+\s(\S+)\)",line) if latch_flag == 1: mEnd = re.match("Endpoint:\s(\S+)\s\S+\s\S+\s\S+\s\S+\s\S+\s\S+\s+(\S+)\)",line) if latch_flag == 0: mEnd = re.match("Endpoint:\s(\S+)\s\S+\s\S+\s\S+\s\S+\s\S+\s(\S+)\)",line) mSlack = re.match("slack\s+\S+\s+(\S+)",line) if mHead: is_timing_report = 1 if is_timing_report and "-path_type full_clock" in line: short_flag = 0 if is_timing_report and "-derate" in line: no_derate_flag = 0 if is_timing_report and "Delay Calculation" in line: if nonsi_flag == 0: si_flag = 1 if mStart: startpoint_cell = mStart.group(1) startpoint_clock = mStart.group(2) start_flag = 1 buf_num = 0 level = 0 if mEnd: endpoint_cell = mEnd.group(1) endpoint_clock = mEnd.group(2) end_flag = 1 if start_flag and startpoint_cell in line and "clocked by" not in line: if "CK" in line or "CLK" in line: level_flag = 1 if short_flag and no_derate_flag: reStart = re.match("(\S+)\s+\S+\s+\S+\s+\S+\s+(\S+)",line) else: reStart = re.match("(\S+)\s+\S+\s+\S+\s+\S+\s+\S+\s+(\S+)",line) startpoint_pin = reStart.group(1) startpoint_latency = round(float(reStart.group(2)),1) if startpoint_pin not in Dict: Dict[startpoint_pin] = {} if level_flag and "(net)" in line: level = level + 1 if level_flag and "/X" in line: if "_INV_" in line or "_BUF_" in line: buf_num = buf_num + 1 if end_flag and endpoint_cell in line and "clocked by" not in line: if "/CK" not in line and "/CLK" not in line and "/Q" not in line: level_flag = 0 end_clock_flag = 1 endpoint_pin = re.match("(\S+)\s+\(",line).group(1) if endpoint_pin not in Dict[startpoint_pin]: Dict[startpoint_pin][endpoint_pin] = {} if end_clock_flag: if endpoint_clock in line: reClock = re.match("clock\s+\S+\s+\S+\s+\S+\s+(\S+)",line) clock_period = round(float(reClock.group(1)),1) if endpoint_cell in line: if "CK" in line or "CLK" in line: if short_flag and no_derate_flag: reEnd = re.match("\S+\s+\S+\s+\S+\s+\S+\s+(\S+)",line) elif si_flag: reEnd = re.match("\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(\S+)",line) else: reEnd = re.match("\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(\S+)",line) endpoint_time = round(float(reEnd.group(1)),1) endpoint_latency = round(endpoint_time - clock_period,1) skew = round(startpoint_latency - endpoint_latency,1) if mSlack: slack = float(mSlack.group(1)) #print(startpoint_pin,endpoint_pin,slack) slack_list.append(slack) Dict[startpoint_pin][endpoint_pin]["slack"] = slack Dict[startpoint_pin][endpoint_pin]["level"] = level Dict[startpoint_pin][endpoint_pin]["buf_num"] = buf_num Dict[startpoint_pin][endpoint_pin]["logic_num"] = level - buf_num Dict[startpoint_pin][endpoint_pin]["skew"] = skew Dict[startpoint_pin][endpoint_pin]["startpoint_clock"] = startpoint_clock Dict[startpoint_pin][endpoint_pin]["endpoint_clock"] = endpoint_clock Dict[startpoint_pin][endpoint_pin]["startpoint_latency"] = startpoint_latency Dict[startpoint_pin][endpoint_pin]["endpoint_latency"] = endpoint_latency start_flag = 0 end_flag = 0 end_clock_flag = 0 return Dict,slack_list