mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-07 19:51:23 +00:00
peepopt: limit padding from shiftadd
The input to a shift operation is padded. This reduced the final number of MUX cells but during techmap it can create huge temporary multiplexers in the log shifter. This significantly increases runtime and resources. A limit is added with a warning when it is used.
This commit is contained in:
parent
62bff3a204
commit
2f0f10cb87
2 changed files with 23 additions and 3 deletions
|
@ -25,6 +25,9 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
bool did_something;
|
||||
|
||||
// scratchpad configurations for pmgen
|
||||
int shiftadd_max_ratio;
|
||||
|
||||
#include "passes/pmgen/peepopt_pm.h"
|
||||
|
||||
struct PeepoptPass : public Pass {
|
||||
|
@ -50,6 +53,9 @@ struct PeepoptPass : public Pass {
|
|||
log("\n");
|
||||
log(" * shiftadd - Replace A>>(B+D) with (A'>>D)>>(B) where D is constant and\n");
|
||||
log(" A' is derived from A by padding or cutting inaccessible bits.\n");
|
||||
log(" Scratchpad: 'peepopt.shiftadd.max_data_multiple' (default: 2)\n");
|
||||
log(" limits the amount of padding to a multiple of the data, \n");
|
||||
log(" to avoid high resource usage from large temporary MUX trees.\n");
|
||||
log("\n");
|
||||
}
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) override
|
||||
|
@ -63,6 +69,11 @@ struct PeepoptPass : public Pass {
|
|||
}
|
||||
extra_args(args, argidx, design);
|
||||
|
||||
// limit the padding from shiftadd to a multiple of the input data
|
||||
// during techmap it creates (#data + #padding) * log(shift) $_MUX_ cells
|
||||
// 2x implies there is a constant shift larger than the input-data which should be extremely rare
|
||||
shiftadd_max_ratio = design->scratchpad_get_int("peepopt.shiftadd.max_data_multiple", 2);
|
||||
|
||||
for (auto module : design->selected_modules())
|
||||
{
|
||||
did_something = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue