mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-19 12:23:39 +00:00
Add -blast mode to splitcells
This commit is contained in:
parent
1eee11846e
commit
8751c7a028
1 changed files with 12 additions and 4 deletions
|
@ -66,7 +66,7 @@ struct SplitcellsWorker
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int split(Cell *cell, const std::string &format, int limit)
|
int split(Cell *cell, const std::string &format, int limit, bool blast = false)
|
||||||
{
|
{
|
||||||
if (cell->type.in("$and", "$mux", "$not", "$or", "$pmux", "$xnor", "$xor"))
|
if (cell->type.in("$and", "$mux", "$not", "$or", "$pmux", "$xnor", "$xor"))
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ struct SplitcellsWorker
|
||||||
for (int i = 1; i < width; i++) {
|
for (int i = 1; i < width; i++) {
|
||||||
auto &last_users = bit_users_db[outsig[slices.back()]];
|
auto &last_users = bit_users_db[outsig[slices.back()]];
|
||||||
auto &this_users = bit_users_db[outsig[i]];
|
auto &this_users = bit_users_db[outsig[i]];
|
||||||
if (last_users != this_users) slices.push_back(i);
|
if ((last_users != this_users) || blast) slices.push_back(i);
|
||||||
}
|
}
|
||||||
if (GetSize(slices) <= 1) return 0;
|
if (GetSize(slices) <= 1) return 0;
|
||||||
if (limit != -1 && GetSize(slices) > limit) { // skip if number of slices is above limit
|
if (limit != -1 && GetSize(slices) > limit) { // skip if number of slices is above limit
|
||||||
|
@ -154,7 +154,7 @@ struct SplitcellsWorker
|
||||||
for (int i = 1; i < width; i++) {
|
for (int i = 1; i < width; i++) {
|
||||||
auto &last_users = bit_users_db[outsig[slices.back()]];
|
auto &last_users = bit_users_db[outsig[slices.back()]];
|
||||||
auto &this_users = bit_users_db[outsig[i]];
|
auto &this_users = bit_users_db[outsig[i]];
|
||||||
if (last_users != this_users) slices.push_back(i);
|
if ((last_users != this_users) || blast) slices.push_back(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetSize(slices) <= 1) return 0;
|
if (GetSize(slices) <= 1) return 0;
|
||||||
|
@ -228,11 +228,15 @@ struct SplitcellsPass : public Pass {
|
||||||
log(" -limit n\n");
|
log(" -limit n\n");
|
||||||
log(" max number of slices to split.\n");
|
log(" max number of slices to split.\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" -blast\n");
|
||||||
|
log(" blast all bits (do not look at usage of the cell output bits).\n");
|
||||||
|
log("\n");
|
||||||
}
|
}
|
||||||
void execute(std::vector<std::string> args, RTLIL::Design *design) override
|
void execute(std::vector<std::string> args, RTLIL::Design *design) override
|
||||||
{
|
{
|
||||||
std::string format;
|
std::string format;
|
||||||
int limit = -1;
|
int limit = -1;
|
||||||
|
bool blast = false;
|
||||||
|
|
||||||
log_header(design, "Executing SPLITCELLS pass (splitting up multi-bit cells).\n");
|
log_header(design, "Executing SPLITCELLS pass (splitting up multi-bit cells).\n");
|
||||||
|
|
||||||
|
@ -247,6 +251,10 @@ struct SplitcellsPass : public Pass {
|
||||||
limit = std::stoi(args[++argidx]);
|
limit = std::stoi(args[++argidx]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (args[argidx] == "-blast" && argidx+1 < args.size()) {
|
||||||
|
blast = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
extra_args(args, argidx, design);
|
extra_args(args, argidx, design);
|
||||||
|
@ -264,7 +272,7 @@ struct SplitcellsPass : public Pass {
|
||||||
SplitcellsWorker worker(module);
|
SplitcellsWorker worker(module);
|
||||||
bool did_something = false;
|
bool did_something = false;
|
||||||
for (auto cell : module->selected_cells()) {
|
for (auto cell : module->selected_cells()) {
|
||||||
int n = worker.split(cell, format, limit);
|
int n = worker.split(cell, format, limit, blast);
|
||||||
did_something |= (n != 0);
|
did_something |= (n != 0);
|
||||||
count_split_pre += (n != 0);
|
count_split_pre += (n != 0);
|
||||||
count_split_post += n;
|
count_split_post += n;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue