Repository navigation
feat(sv): support inout ports with a single tristate driver - #1951
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 ↓. |
f8728d0 to
6353879
Compare
Merge Queue Status
This pull request spent 1 hour 41 minutes 10 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 3 pull requests ahead of it. The conflict became a base branch one after #1954 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 ↓. |
Both sides of an inout port connection form one net (IEEE 1800-2023 23.3.3), whose value its drivers determine and which is z without one (6.6). An inout port below the top module whose net has one continuous driver, such as `assign io = oe ? d : 'z;`, now lowers to a one-way connection carrying the value away from the side that drives it, so reads on either side see the driven value or z (0 in two-state mode). The ports whose net is driven in their module or below it are resolved over the specialized hierarchy before the driver checks. A net driven on both sides of an inout connection, or by several children, is still rejected as having multiple net drivers, and a variable or expression connected to an inout port is rejected (23.3.3.2). Inout ports of the top module and of foreign modules remain unsupported. Closes #1948 Change-Id: I76a456ac73b4a8d6e314baf63d75a9cc35a790dc
6353879 to
5efe018
Compare
Merge Queue Status
This pull request spent 40 minutes 32 seconds in the queue, including 39 minutes 9 seconds running CI. Required conditions to merge
|
What
SV
inoutports below the top module are accepted when their net has exactly one continuous driver anywhere in the hierarchy. A conditional driver likeoe ? dr : 'zcounts as one, including the per-bit form that drives rtlmeter C906's GPIO padb_pad_gpio_porta. Closes #1948.Why / semantics
z.How
resolve_inout_driversruns over the specialized module graph before the driver checks. It records, per specialization, the inout ports whose net is driven in that module or below it, through a local driver, a child output, or a child inout that is itself driven inside. The fixpoint terminates because recursive instantiation is already rejected.z). Reads on both sides see the driven value orz, and 0 in two-state mode.child_output_driver_rangescounts an inout connection as a driver only when its child side drives the net. As a result, a net driven on both sides of an inout connection, by two children, or by a child output plus a child inout is rejected withmultiple net drivers for .... Resolving several drivers (6.6.1,wand/wor, strengths) is the follow-up in feat(sv): support inout ports with a single tristate driver #1948.The handling is per port connection. Designs without inout ports go through unchanged paths:
child_port_directionreturns the port's own kind, and the resolver finds no inout ports.Validation
cargo nextest run -p celox -p celox-frontend-sv -p celox-test-suite --features celox/systemverilog -E 'binary(systemverilog) | package(celox-frontend-sv) | binary(retained_reports)': 4739 passed, 0 failed.hierarchy.vtest, run on all backends (native, cranelift, wasm, plus the parallel variants):inout_tristate_driver_in_child_reaches_parent: a per-bit tristate in a grandchild, read back inside the driving block and through the port on the parent side. Covers all bits driven, half driven (upper nibblez), and oe=0 (allz,=== 1'bz).inout_tristate_driver_in_parent_reaches_child: the driver is in the parent; direct, pass-through and unconnected readers; azread while en=0.inout_tristate_nets_read_zero_in_two_state: both directions in two-state mode, withzreading as 0.inout_tristate_drivers_reach_implicit_nets: inout connections through implicit nets.verify-sv-icarus,verify-sv-verilator,--filter hierarchy::inout):review_regressions::rejects_inout_nets_with_several_driverscovers two children, a parent plus a child through a pass-through, a child output plus a child inout, and a local driver plus a child inside the inout's own module.rejects_variables_and_expressions_on_inout_portscovers the 23.3.3.2 check.cargo clippy -p celox-frontend-sv -p celox --features celox/systemverilog --tests -D warningsandcargo fmt --checkare clean.inout, so its verdicts andexpected.tsvare unaffected.Performance (designs without inout)
callgrind on the xezim synthetic
b2_vm_dispatch_bit.sv(--two-state --unlimited,--toggle-collect='*SimulationState*step_until*',heliodor-dev,taskset -c 8-11), origin/master vs. this PR:Both runs produce checksum 136.
C906
End to end, C906 still stops before this code path. It needs non-ANSI port declarations (#426) and a hierarchical struct-member reference from
tb. The new cases reproduce the GPIO structure: a per-bitoe ? dr : 1'bzwith a read-back, passed through intermediate inout ports to a parent that only connects and reads the net.