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..6e1fcc9a 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("xcelium"), 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/xcelium/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"], + "xcelium" => vec!["xcelium", "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 != "xcelium" && 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', 'xcelium', 'vsim' or 'riviera' format!", )); } if (matches.get_flag("only-defines") @@ -350,6 +353,13 @@ pub fn run(sess: &Session, matches: &ArgMatches) -> Result<()> { targets, srcs, ), + "xcelium" => emit_template( + sess, + include_str!("../script_fmt/xcelium_sh.tera"), + matches, + targets, + srcs, + ), "verilator" => emit_template( sess, include_str!("../script_fmt/verilator_sh.tera"), diff --git a/src/script_fmt/xcelium_sh.tera b/src/script_fmt/xcelium_sh.tera new file mode 100644 index 00000000..76c606d6 --- /dev/null +++ b/src/script_fmt/xcelium_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 %}