Skip to content

Add Xcelium script format and --incdir flag#219

Open
DanielKellerM wants to merge 2 commits intopulp-platform:masterfrom
DanielKellerM:feat/xcelium
Open

Add Xcelium script format and --incdir flag#219
DanielKellerM wants to merge 2 commits intopulp-platform:masterfrom
DanielKellerM:feat/xcelium

Conversation

@DanielKellerM
Copy link

@DanielKellerM DanielKellerM commented Aug 28, 2025

This PR adds support for the Cadence Xcelium simulator to Bender.

Changes

New command: bender script xcelium

  • Generates a flat .f file with per-group incdirs, defines, and source files
  • Consistent with how vsim and vcs templates work (no -makelib/-endlib library scoping)
  • Supports --relative-path for $ROOT-relative output
  • Includes source_annotations metadata comments (opt-out with --no-source-annotations)

New global flag: --incdir / -I

  • Injects user-provided include directories into both the global incdir list and each per-source-group's incdirs
  • Applies to all script formats

Struct changes

  • Added name: Option<String> to TplSrcStruct (populated from src.package)
  • Added root_package to template context

Testing

Verified end-to-end with a 5,107-module Snitch Cluster design:

  • Flat single-pass compile+elaborate: 14.7s wall, 1 xrun invocation
  • Both flat and library-scoped approaches produce identical elaboration results

@DanielKellerM DanielKellerM changed the title Feat/xcelium Add xcelium support Aug 28, 2025
@DanielKellerM DanielKellerM force-pushed the feat/xcelium branch 2 times, most recently from 97b4aa0 to 5d19a8a Compare October 6, 2025 14:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for the Xcelium simulator to the bende tool. The main purpose is to enable script generation for Xcelium by sanitizing library names to be compatible with xrun requirements.

  • Added Xcelium as a new format option for script generation
  • Implemented library name sanitization by replacing hyphens with underscores in makelib blocks
  • Added support for user-provided include directories via the --incdir command line argument

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/script_fmt/xcelium_f.tera New template file for generating Xcelium-compatible script files with sanitized library names
src/cmd/script.rs Added Xcelium format support, include directory argument handling, and per-library template context

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@DanielKellerM DanielKellerM marked this pull request as ready for review October 6, 2025 14:37
@yvantor
Copy link

yvantor commented Oct 6, 2025

@micprog I am jumping in just to mention that I worked as a beta tester for this and seems to be working pretty well. I am currently testing it also in Cheshire.

Copy link
Member

@micprog micprog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR seems to add multiple things:

  • New arg for custom global include directory
  • xcelium script format
  • new additional structure for passing grouped file information to template

Some things I am noticing:

  • The custom incdir is only applied to the all_incdir directive. For existing script formats, this means that it only applies when using a single compile context scripts, not when compiling individual groups. My expectation would be that an additional incdir is applied globally. Please add the custom incdir to the individual file groups for the existing format.
  • The new info you are adding to the template struct looks very repetitive to me, as it is almost the same as what is already available with the srcs key in the template. What looks to be missing is the name key. Is there other information I am missing that would prevent you from re-using this existing structure? I see that the code implementation could benefit from some clean-up, but is there a fundamental reason to use a different structure?
  • If I am not mistaken, the xcelium script format applies incdirs and defines multiple times, once applying all globally and then again individually for the libs. Is this intended?

@yvantor
Copy link

yvantor commented Nov 27, 2025

@DanielKellerM do you have bandwidth to look into this?

@DanielKellerM
Copy link
Author

@yvantor I already started fixing this locally, hopefully next week I update the PR

@DanielKellerM DanielKellerM force-pushed the feat/xcelium branch 2 times, most recently from ecfb205 to 5296e76 Compare February 14, 2026 20:33
@DanielKellerM DanielKellerM changed the title Add xcelium support Add Xcelium script format and --incdir flag Feb 14, 2026
@DanielKellerM
Copy link
Author

DanielKellerM commented Feb 14, 2026

Hi @micprog, I've addressed all your review comments:

  1. --incdir now applies globally — user-provided incdirs are added to both all_incdirs and each per-group TplSrcStruct.incdirs, so they apply regardless of compilation mode.
  2. Reused existing srcs structure — added a name: Option<String> field to TplSrcStruct (populated from src.package) instead of a separate struct.
  3. No duplicate incdirs/defines — the template uses only per-group incdirs/defines, no global block.

The branch has been rebased onto current Bender 0.30.0

Add `bender script xcelium` command that generates a flat .f file
for Cadence Xcelium/xrun. Per-group incdirs, defines, and source
files are emitted directly — consistent with the vsim and vcs
templates.

Also adds a global `--incdir` / `-I` flag to inject user-provided
include directories into both the global incdir list and each
per-source-group's incdirs.

Other changes:
- Add `name` field to TplSrcStruct (from src.package)
- Add `root_package` to template context
- Support `--relative-path` for $ROOT-relative output
- Sanitize library names (hyphens to underscores) in group names
Remove `root_package` and `name` fields from template context that
were not used by any .tera template but changed the template_json
output, causing cli_template_json regression test to fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants