Skip to content

[codegen] reject zero-bit literals, they are invalid in verilog#4050

Draft
cdleary wants to merge 3 commits intogoogle:mainfrom
xlsynth:cdleary/2026-04-05-zero-bit-literal
Draft

[codegen] reject zero-bit literals, they are invalid in verilog#4050
cdleary wants to merge 3 commits intogoogle:mainfrom
xlsynth:cdleary/2026-04-05-zero-bit-literal

Conversation

@cdleary
Copy link
Copy Markdown
Collaborator

@cdleary cdleary commented Apr 6, 2026

  • Reject zero-width VAST literals instead of emitting illegal sized Verilog like 0'h0
  • Split literal construction into a checked Literal(...) API and a LiteralOrDie(...) convenience wrapper, then propagate status through the relevant codegen and C API paths
  • Add focused tests for VAST literal rejection and node-to-VAST lowering, while preserving existing zero-width elision behavior where zero-width values should disappear instead of being materialized

Just a context note, this is observable if you fiddle with the passes via the new pass flag facilities, you just get errors in downstream tools like yosys since SV doesn't support this construct, erroring up front in the XLS tooling that we can't codegen verilog directly from the IR is more sound.

@cdleary cdleary force-pushed the cdleary/2026-04-05-zero-bit-literal branch from 425bd80 to f9d0856 Compare April 6, 2026 17:10
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.

1 participant