From a406f125e03f0b5a3232e6aa6963208a6cc9f311 Mon Sep 17 00:00:00 2001
From: Sean Purser-haskell <seanhaskell@google.com>
Date: Fri, 29 Nov 2024 09:58:36 -0800
Subject: [PATCH] Add extra_tcl_command argument to synthesize_rtl rule.

---
 synthesis/build_defs.bzl | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/synthesis/build_defs.bzl b/synthesis/build_defs.bzl
index f20b427e..e19a5556 100644
--- a/synthesis/build_defs.bzl
+++ b/synthesis/build_defs.bzl
@@ -130,6 +130,8 @@ def _synthesize_design_impl(ctx):
     args.add("-Q")  # Don't print header
     args.add_all("-l", [log_file])  # put output in log file
     args.add_all("-c", [synth_tcl])  # run synthesis tcl script
+    if ctx.attr.extra_tcl_command:
+        args.add("-p", ctx.attr.extra_tcl_command)
 
     dont_use_args = ""
     or_config = ctx.attr.standard_cells[StandardCellInfo].open_road_configuration
@@ -347,6 +349,9 @@ synthesize_rtl = rule(
         "deps": attr.label_list(
             providers = [[VerilogInfo], [UhdmInfo]],
         ),
+        "extra_tcl_command": attr.string(
+            default = "",
+        ),
         "output_file_name": attr.string(
             doc = "The output file name.",
         ),