From f16ab132070ba4d33ace56bd5632510f9ac43431 Mon Sep 17 00:00:00 2001 From: Eugene Feinberg Date: Thu, 20 Mar 2025 10:56:46 -0700 Subject: [PATCH 1/3] Support for Cadence Xcelium simulator --- README.md | 2 ++ src/cmd/script.rs | 14 ++++++++++++-- src/script_fmt/xm_sh.tera | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 src/script_fmt/xm_sh.tera diff --git a/README.md b/README.md index 4464690d..c4efea06 100644 --- a/README.md +++ b/README.md @@ -290,6 +290,7 @@ Individual commands may also set tool-specific targets: - `vsim` - `vcs` +- `xm` - `verilator` - `synopsys` - `riviera` @@ -421,6 +422,7 @@ Supported formats: - `flist-plus`: A flat file list amenable to be directly inlined into the invocation command of a tool, e.g. `verilate $(bender script flist)`. - `vsim`: A Tcl compilation script for Mentor ModelSim/QuestaSim. - `vcs`: A Tcl compilation script for VCS. +- `xm`: A Tcl compilation script for Cadence Xcelium. - `verilator`: Command line arguments for Verilator. - `synopsys`: A Tcl compilation script for Synopsys DC and DE. - `formality`: A Tcl compilation script for Formality (as reference design). diff --git a/src/cmd/script.rs b/src/cmd/script.rs index 58cb8c17..5b066e97 100644 --- a/src/cmd/script.rs +++ b/src/cmd/script.rs @@ -48,6 +48,7 @@ pub fn new() -> Command { PossibleValue::new("flist-plus"), PossibleValue::new("vsim"), PossibleValue::new("vcs"), + PossibleValue::new("xm"), PossibleValue::new("verilator"), PossibleValue::new("synopsys"), PossibleValue::new("formality"), @@ -87,7 +88,7 @@ pub fn new() -> Command { .arg( Arg::new("vlog-arg") .long("vlog-arg") - .help("Pass an argument to vlog calls (vsim/vlogan/riviera only)") + .help("Pass an argument to vlog calls (vsim/xm/vlogan/riviera only)") .num_args(1..) .action(ArgAction::Append) .value_parser(value_parser!(String)), @@ -219,6 +220,7 @@ pub fn run(sess: &Session, matches: &ArgMatches) -> Result<()> { "flist-plus" => vec!["flist"], "vsim" => vec!["vsim", "simulation"], "vcs" => vec!["vcs", "simulation"], + "xm" => vec!["xm", "simulation"], "verilator" => vec!["verilator", "synthesis"], "synopsys" => vec!["synopsys", "synthesis"], "formality" => vec!["synopsys", "synthesis", "formality"], @@ -299,12 +301,13 @@ pub fn run(sess: &Session, matches: &ArgMatches) -> Result<()> { if (matches.contains_id("vcom-arg") || matches.contains_id("vlog-arg")) && format != "vsim" && format != "vcs" + && format != "xm" && format != "riviera" && format != "template" && format != "template_json" { return Err(Error::new( - "vsim/vcs-only options can only be used for 'vcs', 'vsim' or 'riviera' format!", + "vsim/vcs-only options can only be used for 'vcs', 'xm', 'vsim' or 'riviera' format!", )); } if (matches.get_flag("only-defines") @@ -350,6 +353,13 @@ pub fn run(sess: &Session, matches: &ArgMatches) -> Result<()> { targets, srcs, ), + "xm" => emit_template( + sess, + include_str!("../script_fmt/xm_sh.tera"), + matches, + targets, + srcs, + ), "verilator" => emit_template( sess, include_str!("../script_fmt/verilator_sh.tera"), diff --git a/src/script_fmt/xm_sh.tera b/src/script_fmt/xm_sh.tera new file mode 100644 index 00000000..76c606d6 --- /dev/null +++ b/src/script_fmt/xm_sh.tera @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# {{ HEADER_AUTOGEN }} +{% if abort_on_error %}# Set propagation of error to exit on first error +set -e +{% endif %} +ROOT="{{ root }}" +{% for group in srcs %} +{% if group.file_type == 'verilog' %}xmvlog -sv \ + {% for tmp_arg in vlog_args %}{{ tmp_arg }} \ + {% endfor %}{% for define in group.defines %}"+define+{{ define.0 | upper }}{% if define.1 %}={{ define.1 }}{% endif %}" \ + {% endfor %}{% for incdir in group.incdirs %}"+incdir+{{ incdir | replace(from=root, to='$ROOT') }}" \ + {% endfor %} \ + {% for file in group.files %}"{{ file | replace(from=root, to='$ROOT') }}" {% if not loop.last %}\ + {% endif %}{% endfor %} +{% endif %} +{% endfor %} From 575893bf51fb747d30ed5113f75e799443698dae Mon Sep 17 00:00:00 2001 From: Eugene Feinberg Date: Mon, 31 Mar 2025 10:14:31 -0700 Subject: [PATCH 2/3] Rename 'xm' to 'xcelium' --- src/cmd/script.rs | 12 ++++++------ src/script_fmt/{xm_sh.tera => xcelium_sh.tera} | 0 2 files changed, 6 insertions(+), 6 deletions(-) rename src/script_fmt/{xm_sh.tera => xcelium_sh.tera} (100%) diff --git a/src/cmd/script.rs b/src/cmd/script.rs index 5b066e97..058712ea 100644 --- a/src/cmd/script.rs +++ b/src/cmd/script.rs @@ -48,7 +48,7 @@ pub fn new() -> Command { PossibleValue::new("flist-plus"), PossibleValue::new("vsim"), PossibleValue::new("vcs"), - PossibleValue::new("xm"), + PossibleValue::new("xcelium"), PossibleValue::new("verilator"), PossibleValue::new("synopsys"), PossibleValue::new("formality"), @@ -220,7 +220,7 @@ pub fn run(sess: &Session, matches: &ArgMatches) -> Result<()> { "flist-plus" => vec!["flist"], "vsim" => vec!["vsim", "simulation"], "vcs" => vec!["vcs", "simulation"], - "xm" => vec!["xm", "simulation"], + "xcelium" => vec!["xcelium", "simulation"], "verilator" => vec!["verilator", "synthesis"], "synopsys" => vec!["synopsys", "synthesis"], "formality" => vec!["synopsys", "synthesis", "formality"], @@ -301,13 +301,13 @@ pub fn run(sess: &Session, matches: &ArgMatches) -> Result<()> { if (matches.contains_id("vcom-arg") || matches.contains_id("vlog-arg")) && format != "vsim" && format != "vcs" - && format != "xm" + && format != "xcelium" && format != "riviera" && format != "template" && format != "template_json" { return Err(Error::new( - "vsim/vcs-only options can only be used for 'vcs', 'xm', 'vsim' or 'riviera' format!", + "vsim/vcs-only options can only be used for 'vcs', 'xcelium', 'vsim' or 'riviera' format!", )); } if (matches.get_flag("only-defines") @@ -353,9 +353,9 @@ pub fn run(sess: &Session, matches: &ArgMatches) -> Result<()> { targets, srcs, ), - "xm" => emit_template( + "xcelium" => emit_template( sess, - include_str!("../script_fmt/xm_sh.tera"), + include_str!("../script_fmt/xcelium_sh.tera"), matches, targets, srcs, diff --git a/src/script_fmt/xm_sh.tera b/src/script_fmt/xcelium_sh.tera similarity index 100% rename from src/script_fmt/xm_sh.tera rename to src/script_fmt/xcelium_sh.tera From 6634659deadf2262119f768aa547ee8fa683b2c5 Mon Sep 17 00:00:00 2001 From: Eugene Feinberg Date: Mon, 31 Mar 2025 10:36:20 -0700 Subject: [PATCH 3/3] Fix another xm->xcelium --- src/cmd/script.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/script.rs b/src/cmd/script.rs index 058712ea..6e1fcc9a 100644 --- a/src/cmd/script.rs +++ b/src/cmd/script.rs @@ -88,7 +88,7 @@ pub fn new() -> Command { .arg( Arg::new("vlog-arg") .long("vlog-arg") - .help("Pass an argument to vlog calls (vsim/xm/vlogan/riviera only)") + .help("Pass an argument to vlog calls (vsim/xcelium/vlogan/riviera only)") .num_args(1..) .action(ArgAction::Append) .value_parser(value_parser!(String)),