From 8b65a95b21e7482d451d49f6397255d86877551a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Thu, 17 Oct 2024 23:28:42 +0200 Subject: [PATCH] orfs_flow: fix rename inputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- openroad.bzl | 17 ++++++++++------- sram/BUILD | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/openroad.bzl b/openroad.bzl index b3ab910..beba586 100644 --- a/openroad.bzl +++ b/openroad.bzl @@ -407,8 +407,9 @@ def yosys_only_attrs(): def renamed_inputs_attrs(outputs): return { - "renamed_inputs": attr.string_dict( - default = {out: out for out in outputs}, + "renamed_inputs": attr.string_keyed_label_dict( + default = {out.basename: out for out in outputs}, + allow_files = True, ), } @@ -497,6 +498,8 @@ def _generation_commands(optional_files): def _input_commands(ctx, inputs): """Move inputs to the expected input locations""" reverse = {v: k for k, v in ctx.attr.renamed_inputs.items() if k != v} + print(reverse) + print(inputs) categories = ["results", "reports"] output_folders = ["/".join([ _work_home(ctx), @@ -512,15 +515,15 @@ def _input_commands(ctx, inputs): return (["mkdir -p {}".format(folder) for folder in output_folders] + ["mv {} {}".format( input.path, - "/".join(_pick_output_folder(input), reverse[input.basename]), - ) for input in inputs if input.basename in reverse] + + "/".join([_pick_output_folder(input), reverse[input]]), + ) for input in inputs if input in reverse] + [ "mv {} {}".format( input.path, "/".join([_pick_output_folder(input), input.basename]), ) for input in inputs - if input.basename not in reverse and _pick_output_folder(input) != input.dirname + if input not in reverse and _pick_output_folder(input) != input.dirname ]) def _work_home(ctx): @@ -814,6 +817,7 @@ def _make_impl(ctx, stage, steps, forwarded_names = [], result_names = [], objec info[file.extension] = file commands = _input_commands(ctx, ctx.files.src) + [ctx.executable._make.path + " $@"] + _generation_commands(reports + logs) + print(commands) ctx.actions.run_shell( arguments = ["--file", ctx.file._makefile.path] + steps, @@ -1030,8 +1034,7 @@ orfs_route = rule( "5_route.sdc", ], ), - attrs = openroad_attrs() | renamed_inputs_attrs([ - ]), + attrs = openroad_attrs() | renamed_inputs_attrs([]), provides = flow_provides(), executable = True, ) diff --git a/sram/BUILD b/sram/BUILD index acabc81..ac5fb50 100644 --- a/sram/BUILD +++ b/sram/BUILD @@ -25,7 +25,7 @@ FAST_SETTINGS = { }, mock_area = 0.95, renamed_inputs = { - "floorplan": {"1_synth.v": "naja.v"}, + "floorplan": {"1_synth.v": ":naja.v"}, } if variant == "naja" else {}, stage_sources = { "synth": [":fakeram/constraints-sram.sdc"],