Skip to content

Conversation

@widlarizer
Copy link
Collaborator

@widlarizer widlarizer commented Apr 7, 2025

extract_fa is used in ASIC flows to find full and half adder cells by extracting any matching logic. It has been suggested that a better approach is to use full/half adders only when emitted from actual arithmetic. In most synthesis flows, cells that use an adder-like structure (addition, subtraction, comparison) get converted to $alu. For ASIC flows, they are then techmapped to a multi-bit $lcu in techlibs/common/techmap.v. $lcu cells need propagate (P) and generate (G) inputs which have to be generated by half adders.

Prior to this PR, techmap.v was generating these with explicit logic and relying on extract_fa to discover that it's half adders. As of this PR, half adders are instantiated directly as $fa cells with C inputs at constant 0. This is how extract_fa implements half adders already, and for example ORFS uses this constant C=0 to map directly to half adders in the PDK.

This PR is best evaluated in the context of an ASIC flow as-is or with extract_fa removed

  • add an equivalence test

@widlarizer widlarizer force-pushed the emil/techmap-alu-half-adder branch from 7d56069 to d30f784 Compare September 23, 2025 15:06
@widlarizer
Copy link
Collaborator Author

I originally wanted an equivalence test but in reality techmap.v is covered by a lot of equiv_opt tests

@widlarizer widlarizer merged commit a316b8f into main Sep 23, 2025
30 checks passed
@mmicko mmicko deleted the emil/techmap-alu-half-adder branch September 30, 2025 07:10
widlarizer added a commit to widlarizer/yosys that referenced this pull request Oct 6, 2025
…-half-adder"

This reverts commit a316b8f, reversing
changes made to d4071b6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants