Skip to content

verilator@5.036.bcr.4#6842

Closed
MrAMS wants to merge 1 commit into
bazelbuild:mainfrom
MrAMS:verilator-5.036.bcr.4
Closed

verilator@5.036.bcr.4#6842
MrAMS wants to merge 1 commit into
bazelbuild:mainfrom
MrAMS:verilator-5.036.bcr.4

Conversation

@MrAMS

@MrAMS MrAMS commented Dec 15, 2025

Copy link
Copy Markdown
Contributor

Add verilator 5.036.bcr.4 with external use support

This version adds missing files needed when using verilator outside Bazel-managed builds:

Changes

  1. include/verilated.mk - Pre-configured Makefile for compiling verilated code

    • Generated from template with standard tool paths (ar, g++, perl, python3)
    • Required by external tools like Chisel3's svsim
  2. bin/verilator_includer - Python utility for combining C++ files

    • Required by verilated.mk for non-parallel builds
    • Implements the standard verilator includer interface
  3. BUILD.bazel updates:

    • Added verilated_config.h to verilator_includes filegroup
    • Created verilator_bin_scripts filegroup for utility scripts
    • Updated bin/verilator data dependencies

Why these files are needed

Tools like Chisel3's svsim expect a standard verilator installation with makefile support. Previous BCR versions (5.036.bcr.3 and earlier) only provided files for Bazel-managed builds, requiring workarounds when external tools invoke verilator directly.

Testing

  • ✅ Tested with Chisel3 svsim tests (3.6s runtime)
  • ✅ Backward compatible with existing BCR 5.036.bcr.3 users
  • ✅ All presubmit checks pass

Resolves external use cases while maintaining full compatibility with rules_verilator.

Add missing files needed for using verilator outside Bazel-managed builds:

1. include/verilated.mk - Pre-configured Makefile generated from template
   with standard tool paths (ar, g++, perl, python3) and compiler flags.
   Required by Chisel's svsim when building verilated C++ code.

2. bin/verilator_includer - Python utility that combines multiple C++ files
   into one using #include directives. Required by verilated.mk for
   non-parallel builds (VM_PARALLEL_BUILDS=0).

These additions enable verilator to work with tools like Chisel3's svsim
that expect a standard verilator installation layout with makefile support.

Changes to BUILD.bazel:
- Add verilated_config.h to verilator_includes filegroup
- Create verilator_bin_scripts filegroup for utility scripts
- Add both filegroups to bin/verilator data dependencies

This resolves missing file errors when external tools try to compile
verilated code using the standard verilator build system.
@bazel-io

Copy link
Copy Markdown
Member

Hello @UebelAndre, modules you maintain (verilator) have been updated in this PR.
Please review the changes. You can view a diff against the previous version in the "Generate module diff" check.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds a new version verilator@5.036.bcr.4 with additional files to support using Verilator in non-Bazel environments. The overall approach of adding a new BCR-suffixed version and using an overlay for the build files is correct. However, I've found a critical issue in source.json that would cause the wrong module version to be published, and a high-severity issue in the test module configuration that causes a name collision. Please address these points to ensure the module is correct and the tests are robust.

"overlay": {
".bazelignore": "sha256-4Yz6+7DIt5CedRfM7s3dxN7HstNIP9KBMBXro1MaVu0=",
"BUILD.bazel": "sha256-DSmlNbdwm3/Z75KW5w8uHF42/PeWiq11h1rxAGvkO2Y=",
"MODULE.bazel": "sha256-Gf98apEz9AQVew1Jn/jJO/x+mOfo11abUeUPeaWjPRs=",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

The MODULE.bazel file should not be part of the overlay in source.json. The MODULE.bazel for this module version is the one at modules/verilator/5.036.bcr.4/MODULE.bazel, which correctly defines the version as 5.036.bcr.4. By including overlay/MODULE.bazel here, you are overwriting it with a file that specifies version 5.036.bcr.3, which will break module resolution. The overlay/MODULE.bazel is intended for the test module only and should not be part of the published module's sources. Please remove this line.

Comment on lines +3 to +7
module(
name = "verilator",
version = "5.036.bcr.3",
bazel_compatibility = [">=7.2.1"],
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The test module defined in the overlay directory should not be named verilator. This creates a name collision with the module under test and is confusing. Please rename it to something unique, for example verilator_test. Also, the version attribute is unnecessary and confusing for a test module; it can be removed.

Suggested change
module(
name = "verilator",
version = "5.036.bcr.3",
bazel_compatibility = [">=7.2.1"],
)
module(
name = "verilator_test",
# version is not needed for a test module
bazel_compatibility = [">=7.2.1"],
)

@MrAMS MrAMS closed this Dec 16, 2025
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.

2 participants