Repository navigation
Conversation
…inus its gated flops A flop clocked through an integrated clock gate cannot be compared: the gate's latch is opaque, so the write enable that moved onto the clock is invisible to the combinational check, and every gated flop differs. With --skip-gated-clock-flops (skip_gated_clock_flops in a config), the inputs of a sequential instance whose clock pin is driven by a cell output with no truth table but a combinational dependency (an ICG's GCLK as a liberty statetable gives it) are left out with the new reason GatedClock, decided per output before isos share a representative. A warning gives the count; --report-skipped-pos lists them in skipped_gated_clock_pos.txt. Everything else is compared. Experimental and off by default: a strong signal for automated loops, not a production clock-gating check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Experimental:
--skip-gated-clock-flops, so a clock-gated netlist can be checked, minus its gated flopsWhat this is for: a strong, cheap signal in automated loops (generate a netlist, LEC it, iterate). It is not a production clock-gating check. The option is off by default and logs a warning whenever it is used.
The problem
A flop clocked through an integrated clock gate cannot be compared today. Take a register file written through one clock gate per word:
D = wdataand a gated clock.D = we ? wdata : qand the free clock.kepler-formal makes the ICG's latch opaque, on purpose (
Asap7StateFunctionClockGateIsOpaque), so itsGCLKcannot be turned into an enable. The combinational check therefore reports a difference for every gated flop, and nothing else in the design gets a verdict.What the option does
With
--skip-gated-clock-flops(orskip_gated_clock_flops: truein a config file),BuildPrimaryOutputClausesleaves out the inputs of each sequential instance whose clock pin is driven by a cell output with:That is how an ICG's
GCLKcomes out of a libertystatetable. A buffer has a truth table, and a clock divider's flop output has no combinational inputs, so neither matches.The new skip reason is
GatedClock:--report-skipped-posthe list goes toskipped_gated_clock_pos.txt.Everything else is still compared, which for a register file means every read through every flop's output. The write enable that moved onto the clock is the one thing not proven; simulation or a real clock-gate model has to cover it.
Tested
MiterTests.SkipGatedClockFlopsLeavesOutOnlyFlopsClockedThroughAnIcg: an asap7-style ICG gating one DFF, a second DFF on the free clock. With the option, only the gated flop is skipped, with reasonGatedClock. Without it, nothing is skipped for that reason.Asap7StateFunctionClockGateIsOpaquestill passes, so the default modelling is unchanged.generate_regfileregister files are checked against yosys's synthesis of their RTL in both write styles: 21 cases, including 7-write-port, banked and interleaved files. A deliberately wrong read path in a clock-gated file is still caught.Not done
This does not model clock gates. A real fix would read
clock_gating_integrated_cellfrom the liberty and turnGCLK = CLK & (ENA | SE)into a flop enable, in both the combinational and sequential checks. That needs Naja to keep the attribute. This option is a stopgap until then.🤖 Generated with Claude Code