Skip to content

Commit bb38c3d

Browse files
committed
address review comments of the RC data readers and rule:
1) Require a header on each input file, so that a file of another kind is not read against the header of the previous one, and name the file that is missing it. 2) Write both .csv files with a pattern rule, as the grouped target syntax requires GNU Make 4.3 while we support older releases. Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
1 parent b95b2b8 commit bb38c3d

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎flow/util/correlateRCHelper.py‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ def read_nets_rc(file_names):
9696

9797
for file_name in file_names:
9898
print(f"Reading {file_name}.")
99+
# Each file has to bring its own header, so that a file of another kind
100+
# is not read against the header of the previous one.
101+
file_header_line = None
102+
99103
with open(file_name) as file:
100104
for line in file:
101105
line = line.strip()
@@ -105,6 +109,7 @@ def read_nets_rc(file_names):
105109
print("Layer stack inconsistent.", file=stderr)
106110
exit(1)
107111
header_line = line
112+
file_header_line = line
108113
routing_layers = [
109114
layer.removesuffix("(routing)")
110115
for layer in line.removeprefix(NETS_HEADER).split()
@@ -115,8 +120,8 @@ def read_nets_rc(file_names):
115120
if not line or line.startswith("#"):
116121
continue
117122

118-
if header_line is None:
119-
print("No net RC header found in the data.", file=stderr)
123+
if file_header_line is None:
124+
print(f"No net RC header found in {file_name}.", file=stderr)
120125
exit(1)
121126

122127
tokens = line.split(",")
@@ -165,6 +170,10 @@ def read_segments_rc(file_names):
165170

166171
for file_name in file_names:
167172
print(f"Reading {file_name}.")
173+
# Each file has to bring its own header, so that a file of another kind
174+
# is not read against the header of the previous one.
175+
file_header_line = None
176+
168177
with open(file_name) as file:
169178
for line in file:
170179
line = line.strip()
@@ -174,14 +183,15 @@ def read_segments_rc(file_names):
174183
print("Layer stack inconsistent.", file=stderr)
175184
exit(1)
176185
header_line = line
186+
file_header_line = line
177187
routing_layers = line.removeprefix(SEGMENTS_HEADER).split()
178188
continue
179189

180190
if not line or line.startswith("#"):
181191
continue
182192

183-
if header_line is None:
184-
print("No segment RC header found in the data.", file=stderr)
193+
if file_header_line is None:
194+
print(f"No segment RC header found in {file_name}.", file=stderr)
185195
exit(1)
186196

187197
tokens = line.split(",")

‎flow/util/utils.mk‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ update_metadata_autotuner:
8787
.PHONY: write_rc
8888
write_rc: $(RESULTS_DIR)/6_nets_rc.csv $(RESULTS_DIR)/6_segments_rc.csv
8989

90-
$(RESULTS_DIR)/6_nets_rc.csv $(RESULTS_DIR)/6_segments_rc.csv &:
90+
# A pattern rule to write both files with a single run, as the grouped target
91+
# syntax requires GNU Make 4.3.
92+
%_nets_rc.csv %_segments_rc.csv:
9193
$(RUN_CMD) --log $(LOG_DIR)/6_write_rc.log --tee -- $(OPENROAD_CMD) $(UTILS_DIR)/write_rc.tcl
9294

9395
.PHONY: correlate_rc

0 commit comments

Comments
 (0)