MCPcopy Create free account
hub / github.com/circuitnet/CircuitNet / read_twf

Method read_twf

feature_extraction/src/read.py:983–1021  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

981 """
982
983 def read_twf(self):
984 with open(self.twf_path, 'r') as read_file:
985 for line in read_file:
986 if "WAVEFORM" in line:
987 clk_data = line.split()
988 clk = int(float(clk_data[2]))
989 time_windows = np.linspace(-1, clk, self.n_time_window + 1)
990 time_windows = np.delete(time_windows, 0)
991 elif "NET" in line:
992 if "CONSTANT" in line:
993 data = line.split()
994 name = data[2].replace('\\', '').replace('"', '')
995 pin_list = self.route_net_dict[name]
996 for cell_name in pin_list:
997 if cell_name not in self.tw_dict:
998 self.tw_dict[cell_name] = []
999 self.tw_dict[cell_name].append(0)
1000 else:
1001 data = line.split()
1002
1003 if data[2] == '*' or data[6] == '*':
1004 name = data[1].replace('\\', '').replace('"', '')
1005 pin_list = self.route_net_dict[name]
1006 for cell_name in pin_list:
1007 if cell_name not in self.tw_dict:
1008 self.tw_dict[cell_name] = []
1009 self.tw_dict[cell_name].append(0)
1010 else:
1011 name = data[1].replace('\\', '').replace('"', '')
1012 pin_list = self.route_net_dict[name]
1013 time_arrive = data[2].split(':')
1014 time_arrive.extend(data[6].split(':'))
1015 time_arrive = [float(i) for i in time_arrive]
1016 time_arrive_window = [min(time_arrive), max(time_arrive)]
1017 tw_result = [bisect.bisect_left(time_windows, time_arrive_window[0]), bisect.bisect_left(time_windows, time_arrive_window[1])]
1018 for cell_name in pin_list:
1019 if cell_name not in self.tw_dict:
1020 self.tw_dict[cell_name] = []
1021 self.tw_dict[cell_name].append(tw_result)
1022
1023 """
1024 Function used by get_IR_features. Read instance power report.

Callers 1

get_IR_featuresMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected