|
| 1 | +set deferred_cells { |
| 2 | + { |
| 3 | + \$alu |
| 4 | + ALU_{A_WIDTH}_{A_SIGNED}_{B_WIDTH}_{B_SIGNED}_{Y_WIDTH}{%unused} |
| 5 | + {HAN_CARLSON -map +/choices/han-carlson.v} |
| 6 | + {KOGGE_STONE -map +/choices/kogge-stone.v} |
| 7 | + {SKLANSKY -map +/choices/sklansky.v} |
| 8 | + {BRENT_KUNG} |
| 9 | + } |
| 10 | + { |
| 11 | + \$macc |
| 12 | + MACC_{CONFIG}_{Y_WIDTH}{%unused} |
| 13 | + {BASE -map +/choices/han-carlson.v} |
| 14 | + {BOOTH -max_iter 1 -map ../flow/scripts/synth_wrap_operators-booth.v} |
| 15 | + } |
| 16 | +} |
| 17 | + |
| 18 | +techmap {*}[join [lmap cell $deferred_cells {string cat "-dont_map [lindex $cell 0]"}] " "] |
| 19 | + |
| 20 | +foreach info $deferred_cells { |
| 21 | + set type [lindex $info 0] |
| 22 | + set naming_template [lindex $info 1] |
| 23 | + # default architecture and its suffix |
| 24 | + set default [lindex $info 2] |
| 25 | + set default_suffix [lindex $default 0] |
| 26 | + |
| 27 | + log -header "Generating architectural options for $type" |
| 28 | + log -push |
| 29 | + |
| 30 | + wrapcell \ |
| 31 | + -setattr arithmetic_operator \ |
| 32 | + -setattr copy_pending \ |
| 33 | + -formatattr implements_operator $naming_template \ |
| 34 | + -formatattr architecture $default_suffix \ |
| 35 | + -formatattr source_cell $type \ |
| 36 | + -name ${naming_template}_${default_suffix} \ |
| 37 | + t:$type r:A_WIDTH>=10 r:Y_WIDTH>=14 %i %i |
| 38 | + |
| 39 | + # make per-architecture copies of the unmapped module |
| 40 | + foreach modname [tee -q -s result.string select -list-mod A:arithmetic_operator A:copy_pending %i] { |
| 41 | + setattr -mod -unset copy_pending $modname |
| 42 | + |
| 43 | + # iterate over non-default architectures |
| 44 | + foreach arch [lrange $info 3 end] { |
| 45 | + set suffix [lindex $arch 0] |
| 46 | + set base [rtlil::get_attr -string -mod $modname implements_operator] |
| 47 | + set newname ${base}_${suffix} |
| 48 | + yosys copy $modname $newname |
| 49 | + yosys setattr -mod -set architecture \"$suffix\" $newname |
| 50 | + } |
| 51 | + } |
| 52 | + |
| 53 | + # iterate over all architectures, both the default and non-default |
| 54 | + foreach arch [lrange $info 2 end] { |
| 55 | + set suffix [lindex $arch 0] |
| 56 | + set extra_map_args [lrange $arch 1 end] |
| 57 | + |
| 58 | + # map all operator copies which were selected to have this architecture |
| 59 | + techmap -map +/techmap.v {*}$extra_map_args A:source_cell=$type A:architecture=$suffix %i |
| 60 | + |
| 61 | + # booth isn't able to map all $macc configurations: catch if this is one |
| 62 | + # of those and delete the option |
| 63 | + delete A:source_cell=$type A:architecture=$suffix %i t:\$macc %m %i |
| 64 | + } |
| 65 | + |
| 66 | + log -pop |
| 67 | +} |
| 68 | + |
| 69 | +opt -fast -full |
| 70 | +memory_map |
| 71 | +opt -full |
| 72 | +# Get rid of indigestibles |
| 73 | +chformal -remove |
| 74 | +setattr -mod -set abc9_script {"+&dch;&nf -R 5;"} A:arithmetic_operator |
| 75 | +setattr -mod -set abc9_box 1 A:arithmetic_operator |
| 76 | +techmap -map +/techmap.v -map +/choices/han-carlson.v |
0 commit comments