Skip to content

[CUS-517] Rework of gated flop detection#52

Merged
akashlevy merged 5 commits intomainfrom
icg
May 5, 2026
Merged

[CUS-517] Rework of gated flop detection#52
akashlevy merged 5 commits intomainfrom
icg

Conversation

@stanminlee
Copy link
Copy Markdown

Changed implementation of determining gated flops

Algorithm:

  • Wait for all BFS to conclude across clock network
  • Then, take all clock vertex and order by level, ensuring that all pins at a certain level will be computed before the next layer. This primarily prevents output pins from being computed before all input pins have been computed.
  • Then, process each pin.
  • We establish that for a clock gate, there must be at least one valid clock timing arc for it to be considered gated.
  • For any other cell, all valid clock timing arcs must be gated for the cell itself to be considered gated

@linear
Copy link
Copy Markdown

linear Bot commented May 5, 2026

CUS-517

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 5, 2026

Greptile Summary

This PR reworks gated-flop detection to run after the full BFS clock-network traversal completes, replacing the old incremental per-vertex update during ArrivalVisitor::visit. The new computeClkGates gathers every clock-tagged vertex into level-ordered buckets so parents are always evaluated before children, and then applies differentiated gating semantics: clock-gate output pins are gated if at least one live clock arc exists, while all other cells require every live clock arc to be gated.

  • A new computeClkGates method is added that resets clk_gated_, sorts clock vertices by topological level, and calls updateClkGates level by level, ensuring predecessor state is always settled before a vertex is evaluated.
  • isClkGateInstance is renamed isClkGateVertex with simplified logic (checks isClockGateOut() on the port), and the enable-pin constant-propagation check is removed.
  • The updateClkGates loop now uses ClkTreeSearchPred::searchThru to skip dead timing arcs, tracking any_live and all_gated flags to determine the final gated verdict.

Confidence Score: 1/5

The PR cannot compile due to a stale call to the deleted isClkGateInstance function in updateClkGates.

The stale call to isClkGateInstance on line 996 of Search.cc references a function whose declaration was removed from the header and whose definition was renamed to isClkGateVertex in the same commit. The translation unit will not compile, making the change unreachable until that single line is corrected.

search/Search.cc — specifically the updateClkGates body where the renamed helper is still called by its old name.

Important Files Changed

Filename Overview
search/Search.cc Reworks clock-gate detection to run level-ordered BFS post-arrival via new computeClkGates(); contains a build-breaking stale call to the removed isClkGateInstance instead of the renamed isClkGateVertex on line 996.
include/sta/Search.hh Adds computeClkGates and isClkGateVertex declarations; removes the now-deleted isClkGateInstance declaration. Header changes are self-consistent with the new API.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[findArrivals1] --> B[findArrivalsSeed + visitParallel BFS]
    B --> C{arrival_count > 0?}
    C -- No --> Z[done]
    C -- Yes --> D[computeClkGates]
    D --> E[Reset clk_gated_ vector]
    E --> F[Iterate all vertices, collect clock-tagged\nvertices into by_level buckets]
    F --> G[For each level ascending,\ncall updateClkGates per vertex]
    G --> H{isClkGateVertex?}
    H -- Yes\nclock gate output pin --> I[any_live &&\none live arc sufficient]
    H -- No\nregular cell --> J[any_live &&\nall live arcs must be gated]
    I --> K[clk_gated_[id] = gated]
    J --> K
Loading

Reviews (1): Last reviewed commit: "organize" | Re-trigger Greptile

Comment thread search/Search.cc Outdated
Comment thread search/Search.cc Outdated
Comment thread search/Search.cc
@akashlevy akashlevy merged commit f8a293b into main May 5, 2026
6 checks passed
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.

2 participants