Repository navigation
feat(sv): support non-ANSI module port declarations - #1954
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Queued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 36 minutes 46 seconds in the queue, with no time running CI. ReasonThe pull request conflicts with the base branch The pull request was held in the queue, conflicting with at least one of 2 pull requests ahead of it. The conflict became a base branch one after #1893, #1952 merged. HintYou should update or rebase your pull request. If you want to requeue this pull request, you can post a Requeued — the merge queue status continues in this comment ↓. |
ffebc79 to
67833a3
Compare
A non-ANSI header lists port names, and port declarations in the body give their direction and type; a net or variable declaration of the same name may complete a port declaration without a type (IEEE 1800-2023 23.2.2.1). When every header port is a simple name, the parser now folds the body declarations into the header ports and gives the unit the ANSI form, so analysis sees one declaration per port. A vector net or variable declaration must repeat the port declaration's range; the port declaration's range and signing carry over to a scalar one. A net declaration assignment of a port stays a continuous assignment (10.3.1). A header port without a port declaration, a port declared twice, a port declaration that names no header port, differing ranges, a second declaration of a port whose port declaration has a net or variable type, and a variable initializer on a completed port are rejected by name. Headers with port expressions (selects, concatenations, named or empty ports) stay unsupported and are tracked in #1953. Closes #426 Change-Id: I548cd471cd50819374b833c057bc2bfa39355e6a
67833a3 to
abc4ac6
Compare
Merge Queue Status
This pull request spent 1 hour 41 minutes 34 seconds in the queue, including 46 minutes 38 seconds running CI. Required conditions to merge
|
Closes #426.
What
Non-ANSI module port declarations (IEEE 1800-2023 23.2.2.1). The header lists port names;
input/output/inoutdeclarations in the body give their direction and type; a net or variable declaration of the same name may complete a port declaration without a net or variable type:rtlmeter's C906 needs this: 277 of its 289 modules use this form, all with simple identifier headers.
Supported:
var, a data type, signing, packed and unpacked dimensions and several names (input a, b;);signedcarry over to a scalar one (input signed [3:0] a; wire a;);output [4:0] s; wire [4:0] s = a + b;), which stays the continuous assignment it is (10.3.1).Rejected by name:
Headers with port expressions (selects, concatenations,
.p(expr), empty ports) stay unsupported. They are split out as #1953, and the rejection now names them.How
celox-sv-syntax/src/parser/non_ansi.rsruns when a unit finishes parsing. If every header port is a simple name, it:input/outputitems;Analysis and lowering then see the same unit an ANSI header would produce. Units whose header is already ANSI, or that have no ports, return immediately.
Validation
hierarchy::non_ansi_ports_take_body_declarations: register-style ports, completingreg/wire signeddeclarations, a port net declaration assignment, and positional and named connections. It passes on every Celox backend,verify-sv-icarus1/1 andverify-sv-verilator1/1.rejects_malformed_non_ansi_port_declarationscovers each rejection. Parser testnon_ansi_port_declarations_fold_into_the_header. The existing rejection test now uses a port expression.cargo nextest run -p celox -p celox-sv-syntax -p celox-sv-analyzer -p celox-frontend-sv -p celox-test-suite --features celox/systemverilog: 15261 passed.retained_reportspasses. Clippy (workspace, all targets) and fmt are clean.assign/deassign).Performance
The fold runs only for units with a non-ANSI header and returns before any work otherwise, so ANSI designs (including
b2_vm_dispatch_bit.sv) take the same path as before.