Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clockgate: add -liberty #4744

Merged
merged 8 commits into from
Nov 20, 2024
Merged

clockgate: add -liberty #4744

merged 8 commits into from
Nov 20, 2024

Conversation

widlarizer
Copy link
Collaborator

@widlarizer widlarizer commented Nov 14, 2024

Integrated clock gating cells (ICGs) are ASIC cells designed as part of PDKs and they are described in Liberty files. To avoid requiring per-PDK hacks to PDK-agnostic scripts, instead of requiring in the invocation a specification of a concrete ICG cell name and its interface, this PR allows the user to use -liberty <filename> argument for the clockgate command and automatically selects the most suitable ICGs described in <filename>. A suitable cell is one with matching clock polarity, a reasonable interface based on the Liberty Reference Manual (refer to pin attributes clock_gate_... and cell attribute clock_gating_integrated_cell). Most suitable cells are those with the fewest scan/test inputs to tie low and smallest area. Using existing current libparse, I use logic similar to that in dfflibmap.cc to find these cells and interfaces.

This PR also assumes all test inputs are to be tied low and all enables are active high. I've tested it manually with asap7 and sky130hd to behave as expected

  • test
  • help string

passes/techmap/clockgate.cc Outdated Show resolved Hide resolved
passes/techmap/clockgate.cc Outdated Show resolved Hide resolved
passes/techmap/clockgate.cc Outdated Show resolved Hide resolved
passes/techmap/clockgate.cc Outdated Show resolved Hide resolved
passes/techmap/clockgate.cc Outdated Show resolved Hide resolved
passes/techmap/clockgate.cc Outdated Show resolved Hide resolved
Copy link
Member

@povik povik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to convert all cases in which we are confident the ICG attributes are malformed into warnings, and in all other cases ignore the cell and possibly explain with a print. Oftentimes people can't share the Liberty file with us easily, so we should relax what's acceptable.

Other than that I leave some suggestions on simplifying the code.

@widlarizer
Copy link
Collaborator Author

I think what we need is errors that are suppressable as a new category of logging event, in addition to the non-suppressable errors that we have now. I want to terminate and tell the user to fix their Liberty file, and still give them the power to just cope with it otherwise

@widlarizer widlarizer merged commit 5b6baa3 into main Nov 20, 2024
44 checks passed
@KrystalDelusion
Copy link
Member

Is there a reason this uses lines like if (auto clk = pin->find("clock_gate_clock_pin")) { and then not using the assigned variable for anything else? Because doing so is giving compiler warnings

@mmicko mmicko deleted the emil/clockgate-liberty branch February 10, 2025 14:25
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.

3 participants