Skip to content

Commit

Permalink
orfs_run: make run can now be pressed to use opensta in a pinch
Browse files Browse the repository at this point in the history
Signed-off-by: Øyvind Harboe <[email protected]>
  • Loading branch information
oharboe committed Dec 18, 2024
1 parent b725a18 commit 919e535
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
8 changes: 7 additions & 1 deletion .github/scripts/smoketests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ bazel query //:* | grep -q -v lb_32x128_3_place
echo This target should exist
bazel query //:* | grep -q -v lb_32x128_4_synth

bazel build check_mock_area cell_count lb_32x128_shared_synth_floorplan lb_32x128_wns_report //sram:sdq_17x64_mock-naja_floorplan_deps //sram:mock-naja
bazel build \
check_mock_area \
cell_count lb_32x128_shared_synth_floorplan \
lb_32x128_wns_report \
//sram:sdq_17x64_mock-naja_floorplan_deps \
//sram:mock-naja \
sta
grep naja bazel-bin/sram/mock-naja.v
grep -q naja bazel-bin/sram/results/asap7/sdq_17x64/mock-naja/1_synth.v && false || true
(bazel build //sram:sdq_17x64_naja-error_floorplan 2>&1 || true) | grep "syntax error"
Expand Down
13 changes: 13 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -336,3 +336,16 @@ exports_files(
"wns_report.py",
],
)

orfs_run(
name = "sta",
src = ":lb_32x128_floorplan",
outs = [
"units.txt",
],
arguments = {
"OPENROAD_EXE": "$$OPENSTA_EXE",
"OUTPUT": "$(location units.txt)",
},
script = ":units.tcl",
)
1 change: 1 addition & 0 deletions make.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if [ -z "$FLOW_HOME" ]; then
export MAKE_PATH="${MAKE_PATH}"
export YOSYS_EXE="${YOSYS_PATH}"
export OPENROAD_EXE="${OPENROAD_PATH}"
export OPENSTA_EXE="${OPENSTA_PATH}"
export KLAYOUT_CMD="${KLAYOUT_PATH}"
export STDBUF_CMD="${STDBUF_PATH}"
export FLOW_HOME="${FLOW_HOME}"
Expand Down
16 changes: 14 additions & 2 deletions openroad.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def flow_environment(ctx):
"FLOW_HOME": ctx.file._makefile.dirname,
"KLAYOUT_CMD": ctx.executable._klayout.path,
"OPENROAD_EXE": ctx.executable._openroad.path,
"OPENSTA_EXE": ctx.executable._opensta.path,
"QT_PLUGIN_PATH": commonpath(ctx.files._qt_plugins),
"QT_QPA_PLATFORM_PLUGIN_PATH": commonpath(ctx.files._qt_plugins),
"RUBYLIB": ":".join([commonpath(ctx.files._ruby), commonpath(ctx.files._ruby_dynamic)]),
Expand All @@ -170,6 +171,7 @@ def flow_inputs(ctx):
ctx.executable._klayout,
ctx.executable._make,
ctx.executable._openroad,
ctx.executable._opensta,
ctx.file._makefile,
] +
ctx.files._ruby +
Expand All @@ -181,6 +183,8 @@ def flow_inputs(ctx):
transitive = [
ctx.attr._openroad[DefaultInfo].default_runfiles.files,
ctx.attr._openroad[DefaultInfo].default_runfiles.symlinks,
ctx.attr._opensta[DefaultInfo].default_runfiles.files,
ctx.attr._opensta[DefaultInfo].default_runfiles.symlinks,
ctx.attr._klayout[DefaultInfo].default_runfiles.files,
ctx.attr._klayout[DefaultInfo].default_runfiles.symlinks,
ctx.attr._makefile[DefaultInfo].default_runfiles.files,
Expand Down Expand Up @@ -291,6 +295,7 @@ def flow_substitutions(ctx):
"${MAKEFILE_PATH}": ctx.file._makefile.path,
"${MAKE_PATH}": ctx.executable._make.path,
"${OPENROAD_PATH}": ctx.executable._openroad.path,
"${OPENSTA_PATH}": ctx.executable._opensta.path,
"${QT_PLUGIN_PATH}": commonpath(ctx.files._qt_plugins),
"${RUBY_PATH}": commonpath(ctx.files._ruby),
"${STDBUF_PATH}": "",
Expand Down Expand Up @@ -385,6 +390,13 @@ def flow_attrs():
cfg = "exec",
default = Label("@docker_orfs//:openroad"),
),
"_opensta": attr.label(
doc = "OpenSTA binary.",
executable = True,
allow_files = True,
cfg = "exec",
default = Label("@docker_orfs//:sta"),
),
"_klayout": attr.label(
doc = "Klayout binary.",
executable = True,
Expand Down Expand Up @@ -608,10 +620,10 @@ def _run_impl(ctx):
"$@",
ctx.expand_location(ctx.attr.extra_args, ctx.attr.data),
]),
env = _data_arguments(ctx) |
odb_environment(ctx) |
env = odb_environment(ctx) |
flow_environment(ctx) |
config_environment(config) |
_data_arguments(ctx) |
{"RUN_SCRIPT": ctx.file.script.path},
inputs = depset(
[config, ctx.file.script],
Expand Down
9 changes: 9 additions & 0 deletions units.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
puts "Executable path: [info nameofexecutable]"
report_units
puts "OUTPUT=$::env(OUTPUT)"
puts "OPENROAD_EXE=$::env(OPENROAD_EXE)"
puts "OPENSTA_EXE=$::env(OPENSTA_EXE)"
set f [open $::env(OUTPUT) w]
puts $f "units"
close $f

0 comments on commit 919e535

Please sign in to comment.