Skip to content

Commit c9bbe29

Browse files
committed
Merge branch 'master' into secure-fix_missing_para_dbmodnet
2 parents ba99381 + b23706a commit c9bbe29

6 files changed

Lines changed: 44 additions & 60 deletions

File tree

‎flow/BUILD‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ exports_files(
1818
visibility = ["//visibility:public"],
1919
)
2020

21+
# Expose synth.tcl as an addressable source label so bazel-orfs can
22+
# point its `_synth_tcl` attr default at `@orfs//flow:scripts/synth.tcl`
23+
# instead of vendoring its own (drifting) copy at the bazel-orfs repo
24+
# root. See bazel-orfs `private/rules.bzl`.
25+
exports_files(
26+
["scripts/synth.tcl"],
27+
visibility = ["//visibility:public"],
28+
)
29+
2130
# files shared between scripts/synth.sh and scripts/flow.sh steps
2231
MAKEFILE_SHARED = [
2332
"scripts/variables.json",

‎flow/Makefile‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ do-klayout:
200200
--template $(KLAYOUT_TECH_FILE) \
201201
--output $(OBJECTS_DIR)/klayout.lyt \
202202
--lef-files $(OBJECTS_DIR)/klayout_tech.lef $(SC_LEF) $(ADDITIONAL_LEFS) \
203-
--reference-dir $(RESULTS_DIR) \
204203
--map-files $(wildcard $(FLOW_HOME)/platforms/$(PLATFORM)/*map)
205204

206205
$(OBJECTS_DIR)/klayout_wrap.lyt: $(KLAYOUT_TECH_FILE) $(OBJECTS_DIR)/klayout_tech.lef
@@ -212,8 +211,7 @@ do-klayout_wrap:
212211
$(PYTHON_EXE) $(UTILS_DIR)/generate_klayout_tech.py \
213212
--template $(KLAYOUT_TECH_FILE) \
214213
--output $(OBJECTS_DIR)/klayout_wrap.lyt \
215-
--lef-files $(OBJECTS_DIR)/klayout_tech.lef $(WRAP_LEFS) \
216-
--reference-dir $(OBJECTS_DIR)/def
214+
--lef-files $(OBJECTS_DIR)/klayout_tech.lef $(WRAP_LEFS)
217215

218216
$(WRAPPED_LEFS):
219217
mkdir -p $(OBJECTS_DIR)/lef $(OBJECTS_DIR)/def

‎flow/platforms/ihp-sg13g2/setRC.tcl‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# correlation result (aes, gcd, ibex, riscv32i, spi)
2-
# Metal1 capacitance fixed up from -1.1e-05 to 1e-10 as a minuscule positive value
31
set_layer_rc -layer Metal1 -resistance 8.54576E-03 -capacitance 1e-10
4-
set_layer_rc -layer Metal2 -resistance 2.53519E-03 -capacitance 1.69121E-04
5-
set_layer_rc -layer Metal3 -resistance 1.54329E-03 -capacitance 1.82832E-04
6-
set_layer_rc -layer Metal4 -resistance 6.31424E-04 -capacitance 1.66454E-04
7-
set_layer_rc -layer Metal5 -resistance 6.84051E-04 -capacitance 8.57431E-05
2+
set_layer_rc -layer Metal2 -resistance 4.40000E-04 -capacitance 1.69121E-04
3+
set_layer_rc -layer Metal3 -resistance 4.40000E-04 -capacitance 1.82832E-04
4+
set_layer_rc -layer Metal4 -resistance 4.39998E-04 -capacitance 1.66454E-04
5+
set_layer_rc -layer Metal5 -resistance 4.40004E-04 -capacitance 8.57431E-05
6+
87
set_wire_rc -signal -resistance 2.07259E-03 -capacitance 1.73072E-04
98
set_wire_rc -clock -resistance 2.48603E-03 -capacitance 1.44812E-04
109

‎flow/platforms/sky130hs/setRC.tcl‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
# correlateRC.py gcd,ibex,aes,jpeg,chameleon,riscv32i,chameleon_hier
2-
# cap units pf/um
3-
set_layer_rc -layer li1 -capacitance 1.499e-04 -resistance 7.176e-02
4-
set_layer_rc -layer met1 -capacitance 1.72375E-04 -resistance 8.929e-04
5-
set_layer_rc -layer met2 -capacitance 1.36233E-04 -resistance 8.929e-04
6-
set_layer_rc -layer met3 -capacitance 2.14962E-04 -resistance 1.567e-04
7-
set_layer_rc -layer met4 -capacitance 1.48128E-04 -resistance 1.567e-04
8-
set_layer_rc -layer met5 -capacitance 1.54087E-04 -resistance 1.781e-05
9-
# end correlate
1+
set_layer_rc -layer li1 -capacitance 1.499e-04 -resistance 6.81778E-02
2+
set_layer_rc -layer met1 -capacitance 1.72375E-04 -resistance 1.20566E-03
3+
set_layer_rc -layer met2 -capacitance 1.36233E-04 -resistance 1.22133E-03
4+
set_layer_rc -layer met3 -capacitance 2.14962E-04 -resistance 1.66286E-04
5+
set_layer_rc -layer met4 -capacitance 1.48128E-04 -resistance 1.68095E-04
6+
set_layer_rc -layer met5 -capacitance 1.54087E-04 -resistance 1.83574E-05
107

118
set_layer_rc -via mcon -resistance 9.249146E-3
129
set_layer_rc -via via -resistance 4.5E-3

‎flow/test/test_generate_klayout_tech.py‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,22 +120,21 @@ def test_basic_generation(self):
120120
template_lyt=self.template,
121121
output_lyt=self.output,
122122
lef_files=[lef_path],
123-
reference_dir=self.results_dir,
124123
map_files=[],
125-
use_relative_paths=True,
126124
)
127125

128126
with open(self.output) as f:
129127
content = f.read()
130128

131129
self.assertIn("<lef-files>", content)
132130
self.assertNotIn("original.lef", content)
133-
# Path should be relative to results_dir
134-
expected_rel = os.path.relpath(
135-
os.path.realpath(lef_path),
136-
os.path.realpath(self.results_dir),
137-
)
138-
self.assertIn(expected_rel, content)
131+
# LEF paths are written as plain abspath (not relpath, not realpath):
132+
# klayout's Layout.read resolves relative <lef-files> entries
133+
# against the realpath of the DEF being merged, which under a
134+
# Bazel sandbox is the bare execroot -- the in-flight sibling
135+
# files only exist in the per-action sandbox. Absolute paths
136+
# bypass the relative-resolution dance.
137+
self.assertIn(os.path.abspath(lef_path), content)
139138

140139
def test_with_map_files(self):
141140
with open(self.template, "w") as f:
@@ -151,15 +150,16 @@ def test_with_map_files(self):
151150
template_lyt=self.template,
152151
output_lyt=self.output,
153152
lef_files=[lef_path],
154-
reference_dir=self.results_dir,
155153
map_files=[map_path],
156-
use_relative_paths=False,
157154
)
158155

159156
with open(self.output) as f:
160157
content = f.read()
161158

162-
self.assertIn(os.path.realpath(map_path), content)
159+
# Same abspath semantics as LEFs: map files are also written as
160+
# plain absolute paths so klayout doesn't resolve them relative
161+
# to the bare-execroot realpath of the input DEF.
162+
self.assertIn(os.path.abspath(map_path), content)
163163
self.assertNotIn("original.map", content)
164164

165165
def test_multiple_lef_files(self):
@@ -177,9 +177,7 @@ def test_multiple_lef_files(self):
177177
template_lyt=self.template,
178178
output_lyt=self.output,
179179
lef_files=lef_files,
180-
reference_dir=self.results_dir,
181180
map_files=[],
182-
use_relative_paths=True,
183181
)
184182

185183
with open(self.output) as f:

‎flow/util/generate_klayout_tech.py‎

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,37 +30,32 @@ def replace_map_files(content, map_files):
3030
return content
3131

3232

33-
def generate_klayout_tech(
34-
template_lyt,
35-
output_lyt,
36-
lef_files,
37-
reference_dir,
38-
map_files,
39-
use_relative_paths,
40-
):
33+
def generate_klayout_tech(template_lyt, output_lyt, lef_files, map_files=None):
4134
"""Generate a klayout .lyt file from a platform template.
4235
4336
Args:
4437
template_lyt: Path to the platform .lyt template file.
4538
output_lyt: Path to write the generated .lyt file.
4639
lef_files: List of LEF file paths to include.
47-
reference_dir: Directory to compute relative paths from.
4840
map_files: List of map file paths.
49-
use_relative_paths: If True, compute paths relative to reference_dir.
5041
"""
5142
with open(template_lyt, "r") as f:
5243
content = f.read()
5344

54-
# Both modes use relative paths from reference_dir, matching the
55-
# original sed-based behavior which always uses realpath --relative-to.
56-
resolved_lefs = [
57-
os.path.relpath(os.path.realpath(f), os.path.realpath(reference_dir))
58-
for f in lef_files
59-
]
45+
# Write absolute (not relative, not realpath'd) LEF paths into the LYT.
46+
# Klayout's Layout.read(def, layout_options) follows the symlinked input
47+
# DEF to its realpath at the bare execroot and resolves relative
48+
# <lef-files> entries from there. Sibling intermediates like
49+
# objects/klayout_tech.lef don't exist at the bare execroot during
50+
# action execution -- they're only at the per-action sandbox -- so
51+
# resolution fails with errno=2. Plain abspath (NOT realpath, which
52+
# would chase Bazel input-file symlinks back out to the bare execroot)
53+
# keeps klayout pointed at the in-sandbox file.
54+
resolved_lefs = [os.path.abspath(f) for f in lef_files]
6055

6156
content = replace_lef_files(content, resolved_lefs)
6257

63-
resolved_maps = [os.path.realpath(f) for f in map_files]
58+
resolved_maps = [os.path.abspath(f) for f in (map_files or [])]
6459
content = replace_map_files(content, resolved_maps)
6560

6661
with open(output_lyt, "w") as f:
@@ -78,28 +73,16 @@ def main():
7873
parser.add_argument(
7974
"--lef-files", nargs="*", default=[], help="LEF files to include"
8075
)
81-
parser.add_argument(
82-
"--reference-dir",
83-
required=True,
84-
help="Directory for computing relative paths",
85-
)
8676
parser.add_argument(
8777
"--map-files", nargs="*", default=[], help="Map files to include"
8878
)
89-
parser.add_argument(
90-
"--use-relative-paths",
91-
action="store_true",
92-
help="Use paths relative to reference-dir",
93-
)
9479
args = parser.parse_args()
9580

9681
generate_klayout_tech(
9782
template_lyt=args.template,
9883
output_lyt=args.output,
9984
lef_files=args.lef_files,
100-
reference_dir=args.reference_dir,
10185
map_files=args.map_files,
102-
use_relative_paths=args.use_relative_paths,
10386
)
10487

10588

0 commit comments

Comments
 (0)