From 4919213a0b07ae90570de93aae57b7a3e4c3715b Mon Sep 17 00:00:00 2001 From: Stephen Tridgell Date: Thu, 26 Jun 2025 12:40:25 +1000 Subject: [PATCH 1/3] Add debug probes --- vivado/defs.bzl | 13 +++++++++++++ vivado/synth_optimize.tcl.template | 3 +++ 2 files changed, 16 insertions(+) diff --git a/vivado/defs.bzl b/vivado/defs.bzl index c150d393..1143923b 100644 --- a/vivado/defs.bzl +++ b/vivado/defs.bzl @@ -322,6 +322,12 @@ def _vivado_synthesis_optimize_impl(ctx): timing_summary_report = ctx.actions.declare_file("{}_timing.rpt".format(ctx.label.name)) util_report = ctx.actions.declare_file("{}_util.rpt".format(ctx.label.name)) drc_report = ctx.actions.declare_file("{}_drc.rpt".format(ctx.label.name)) + if ctx.attr.with_probes: + probes_file = ctx.actions.declare_file("{}.ltx".format(ctx.label.name)) + probes_file_path = probes_file.path + else: + probes_file = Null + probes_file_path = "" checkpoint_in = ctx.attr.checkpoint[VivadoSynthCheckpointInfo].checkpoint @@ -329,6 +335,7 @@ def _vivado_synthesis_optimize_impl(ctx): "{{CHECKPOINT_IN}}": checkpoint_in.path, "{{CHECKPOINT_OUT}}": synth_checkpoint.path, "{{DRC_REPORT}}": drc_report.path, + "{{PROBES_FILE}}": probes_file_path, "{{OPT_DIRECTIVE}}": ctx.attr.opt_directive, "{{THREADS}}": "{}".format(ctx.attr.threads), "{{TIMING_REPORT}}": timing_summary_report.path, @@ -336,6 +343,8 @@ def _vivado_synthesis_optimize_impl(ctx): } outputs = [synth_checkpoint, timing_summary_report, util_report, drc_report] + if ctx.attr.with_probes: + outputs.append(probes_file) default_info = run_tcl_template( ctx, @@ -363,6 +372,10 @@ vivado_synthesis_optimize = rule( doc = "The optimization directive.", default = "Explore", ), + "with_probes": attr.bool( + doc = "Create debug probes.", + default = False, + ), "synthesis_optimize_template": attr.label( doc = "The synthesis optimzation tcl template", default = "//vivado:synth_optimize.tcl.template", diff --git a/vivado/synth_optimize.tcl.template b/vivado/synth_optimize.tcl.template index abe40201..8e034f7b 100644 --- a/vivado/synth_optimize.tcl.template +++ b/vivado/synth_optimize.tcl.template @@ -5,4 +5,7 @@ opt_design -directive {{OPT_DIRECTIVE}} report_timing_summary -file {{TIMING_REPORT}} report_utilization -file {{UTIL_REPORT}} report_drc -file {{DRC_REPORT}} +if {"{{PROBES_FILE}}" != ""} { + write_debug_probes {{PROBES_FILE}} +} write_checkpoint -force {{CHECKPOINT_OUT}} From 868ff3bb5e3aff69714f72e742355902d3271415 Mon Sep 17 00:00:00 2001 From: Stephen Tridgell Date: Wed, 2 Jul 2025 14:36:25 +1000 Subject: [PATCH 2/3] Fix bug. --- vivado/defs.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vivado/defs.bzl b/vivado/defs.bzl index 1143923b..a3b87db4 100644 --- a/vivado/defs.bzl +++ b/vivado/defs.bzl @@ -326,7 +326,7 @@ def _vivado_synthesis_optimize_impl(ctx): probes_file = ctx.actions.declare_file("{}.ltx".format(ctx.label.name)) probes_file_path = probes_file.path else: - probes_file = Null + probes_file = None probes_file_path = "" checkpoint_in = ctx.attr.checkpoint[VivadoSynthCheckpointInfo].checkpoint From 04a2fb8049d1adae4988b7ced94fdf34c7978016 Mon Sep 17 00:00:00 2001 From: Stephen Tridgell Date: Thu, 10 Jul 2025 13:31:39 +1000 Subject: [PATCH 3/3] Fix lint. --- vivado/defs.bzl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vivado/defs.bzl b/vivado/defs.bzl index a3b87db4..84b1ecdc 100644 --- a/vivado/defs.bzl +++ b/vivado/defs.bzl @@ -335,8 +335,8 @@ def _vivado_synthesis_optimize_impl(ctx): "{{CHECKPOINT_IN}}": checkpoint_in.path, "{{CHECKPOINT_OUT}}": synth_checkpoint.path, "{{DRC_REPORT}}": drc_report.path, - "{{PROBES_FILE}}": probes_file_path, "{{OPT_DIRECTIVE}}": ctx.attr.opt_directive, + "{{PROBES_FILE}}": probes_file_path, "{{THREADS}}": "{}".format(ctx.attr.threads), "{{TIMING_REPORT}}": timing_summary_report.path, "{{UTIL_REPORT}}": util_report.path, @@ -372,10 +372,6 @@ vivado_synthesis_optimize = rule( doc = "The optimization directive.", default = "Explore", ), - "with_probes": attr.bool( - doc = "Create debug probes.", - default = False, - ), "synthesis_optimize_template": attr.label( doc = "The synthesis optimzation tcl template", default = "//vivado:synth_optimize.tcl.template", @@ -385,6 +381,10 @@ vivado_synthesis_optimize = rule( doc = "Threads to pass to vivado which defines the amount of parallelism.", default = 8, ), + "with_probes": attr.bool( + doc = "Create debug probes.", + default = False, + ), "xilinx_env": attr.label( doc = "A shell script to source the vivado environment and " + "point to license server",