Skip to content

bender script emits .svh header files as compile sources (regression in 0.32.0) #312

@fischeti

Description

@fischeti

Summary

Since v0.32.0, bender script emits SystemVerilog header files (.svh) that are listed in a package's files: as standalone compile sources. Previously (v0.31.0), such files were recognized as headers of unknown compile type (W28), kept out of the emitted source list, and reachable only via +incdir+.

This is a breaking change for the common convention of listing .svh headers in files: (so bender tracks them) while including them via include_dirs. Compiling a header standalone and via `include causes duplicate definitions — e.g. VCS reports class redefinition and fails elaboration.

Minimal reproduction

Bender.yml:

package:
  name: repro
  authors: ["repro"]

sources:
  - include_dirs:
      - inc
    files:
      - src/tracer.sv       # compiles; `include "trace_item.svh"
      - inc/trace_item.svh  # header: listed in files: for tracking, also on +incdir+inc

src/tracer.sv:

`include "trace_item.svh"
module tracer; endmodule

inc/trace_item.svh:

class trace_item; endclass

Run bender script vcs with each version:

0.31.0 — header excluded from sources, warned as unknown type:

    "+incdir+$ROOT/inc" \
    "$ROOT/src/tracer.sv"
warning[W28]: File with unknown type:
  - /tmp/bender-svh-repro/inc/trace_item.svh

0.32.0 — header now emitted as a compile source:

    "+incdir+$ROOT/inc" \
    "$ROOT/src/tracer.sv" \
    "$ROOT/inc/trace_item.svh"

Diff of the emitted source list (0.31.0 -> 0.32.0):

     "$ROOT/src/tracer.sv"
+    "$ROOT/inc/trace_item.svh"

Real-world impact

cva6 lists its tracer headers in files: (under target: not(synthesis)), alongside the .sv that includes them:

- include_dirs: [core/include, common/local/util]
  files:
    - common/local/util/instr_tracer.sv
    - common/local/util/instr_trace_item.svh
    - common/local/util/ex_trace_item.svh

With 0.32.0, ex_trace_item.svh is both `included (via +incdir+common/local/util) and compiled standalone, so VCS errors:

Error-[CRE] Class redefinition encountered
  The class 'ex_trace_item' is defined more than once.
Error-[SVBENM] End name does not match the begin name
  endclass name is 'ex_trace_item', while the class name is 'ex_trace_item_0'.

-> no top module found -> elaboration fails. (Questa/vsim tolerates the duplicate via separate compilation units, so this surfaces specifically with VCS.)

Environment

  • Regression introduced in v0.32.0 (works in v0.31.0)
  • bender script vcs (also affects vsim/other script targets)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions