Repository navigation
synth: SYNTH_ABC_PARTITION, one abc call per register group #4731
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # Technology mapping with one abc call per register group | ||
| # (SYNTH_ABC_PARTITION). | ||
| # | ||
| # abc maps a netlist against a single delay target, the netlist's own | ||
| # critical path, and recovers area on every cone that is faster than that. | ||
| # It sees no SDC and no arrival times at cells mapped before it (extract_fa's | ||
| # adders), so that critical path can be a false path, or shorter than the | ||
| # real one; the real cones are then rebuilt smaller and slower. Mapping each | ||
| # register group separately gives every group its own critical path. | ||
| # | ||
| # Flops (liberty cells after dfflibmap) are grouped by name with bit indices | ||
| # and the "$_DFF..." suffix removed. A group's cone is the still-unmapped | ||
| # combinational fan-in of its flops' inputs. Groups are mapped largest cone | ||
| # first; logic shared by several groups goes to the first group that | ||
| # reaches it. Groups with fewer than min_cells unmapped cells, and anything | ||
| # left over, are mapped by one final abc call. | ||
| proc synth_abc_partition { abc_args min_cells } { | ||
| set top $::env(DESIGN_NAME) | ||
| set groups [dict create] | ||
| foreach cell [tee -q -s result.string select -list "$top/t:*" "$top/t:\$*" %d] { | ||
| set name [string range $cell [string length "$top/"] end] | ||
| regsub {\$_.*$} $name {} key | ||
| regsub -all {\[[0-9]+\]} $key {} key | ||
| if { $key ne "" } { | ||
| dict incr groups $key | ||
| } | ||
| } | ||
|
|
||
| # '?' stands for the '[' or '$' after the base name; groups whose name | ||
| # extends this one (acc vs. acc_next) are removed from the selection. | ||
| set keys [dict keys $groups] | ||
| set sized {} | ||
| foreach key $keys { | ||
| set sel [list "$top/$key?*"] | ||
| foreach other $keys { | ||
| if { $other ne $key && [string match "$key*" $other] } { | ||
| lappend sel "$top/$other?*" %d | ||
| } | ||
| } | ||
| select -set abc_partition_group {*}$sel | ||
| # select -count returns "<n> objects." | ||
| set n 0 | ||
| regexp {[0-9]+} [tee -q -s result.string select -count \ | ||
| @abc_partition_group %ci1 %cie* "$top/t:\$_*" %i] n | ||
|
Comment on lines
+43
to
+44
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| lappend sized [list $key $n $sel] | ||
| } | ||
|
|
||
| set i 0 | ||
| foreach group [lsort -integer -decreasing -index 1 $sized] { | ||
| lassign $group key n sel | ||
| if { $n < $min_cells } { | ||
| continue | ||
| } | ||
| select -set abc_partition_group {*}$sel | ||
| select -set abc_partition_cone \ | ||
| @abc_partition_group %ci1 %cie* "$top/t:\$_*" %i | ||
| set left 0 | ||
| regexp {[0-9]+} [tee -q -s result.string select -count @abc_partition_cone] left | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if { $left < $min_cells } { | ||
| continue | ||
| } | ||
| puts "abc partition [incr i]: $key, $left cells" | ||
| log_cmd abc {*}$abc_args @abc_partition_cone | ||
| } | ||
| puts "abc partition: remaining logic" | ||
| log_cmd abc {*}$abc_args "t:\$_*" | ||
| select -clear | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1070,6 +1070,21 @@ ABC_AREA: | |
| stages: | ||
| - synth | ||
| default: 0 | ||
| SYNTH_ABC_PARTITION: | ||
| description: | | ||
| Map the top module with one abc call per register group instead of one | ||
| for the whole module. abc maps each call against that call's own | ||
| critical path and sees neither the SDC (clocks, false paths) nor the | ||
| arrival times at cells mapped before it, such as extract_fa's adders. | ||
| When that critical path is the wrong one, the real cones are | ||
| area-recovered into slow structures; separate calls limit this to one | ||
| group. Flops are grouped by name; the value is the minimum cone size, | ||
| in cells, for a group to get its own call. 0 disables. Ignored when | ||
| SYNTH_WRAPPED_OPERATORS or SWAP_ARITH_OPERATORS is set. | ||
| type: int | ||
| stages: | ||
| - synth | ||
| default: 0 | ||
|
Comment on lines
+1085
to
+1087
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ABC_SCRIPT: | ||
| description: | | ||
| Replaces the ABC script synthesis runs, so that a design can vendor and | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normalizing
$topand$cellby stripping any leading backslash before computing the substring range makes the cell name extraction much more robust against different naming formats in Yosys/RTLIL.