3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-13 04:28:18 +00:00

Added "setparam -type"

This commit is contained in:
Clifford Wolf 2016-10-19 13:54:04 +02:00
parent 042b67f024
commit 3655d7fea7

View file

@ -134,15 +134,18 @@ struct SetparamPass : public Pass {
{ {
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
log("\n"); log("\n");
log(" setparam [ -set name value | -unset name ]... [selection]\n"); log(" setparam [ -type cell_type ] [ -set name value | -unset name ]... [selection]\n");
log("\n"); log("\n");
log("Set/unset the given parameters on the selected cells. String values must be\n"); log("Set/unset the given parameters on the selected cells. String values must be\n");
log("passed in double quotes (\").\n"); log("passed in double quotes (\").\n");
log("\n"); log("\n");
log("The -type option can be used to change the cell type of the selected cells.\n");
log("\n");
} }
virtual void execute(std::vector<std::string> args, RTLIL::Design *design) virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
{ {
std::vector<setunset_t> setunset_list; vector<setunset_t> setunset_list;
string new_cell_type;
size_t argidx; size_t argidx;
for (argidx = 1; argidx < args.size(); argidx++) for (argidx = 1; argidx < args.size(); argidx++)
@ -158,6 +161,10 @@ struct SetparamPass : public Pass {
setunset_list.push_back(setunset_t(args[++argidx])); setunset_list.push_back(setunset_t(args[++argidx]));
continue; continue;
} }
if (arg == "-type" && argidx+1 < args.size()) {
new_cell_type = RTLIL::escape_id(args[++argidx]);
continue;
}
break; break;
} }
extra_args(args, argidx, design); extra_args(args, argidx, design);
@ -170,8 +177,11 @@ struct SetparamPass : public Pass {
continue; continue;
for (auto &it : module->cells_) for (auto &it : module->cells_)
if (design->selected(module, it.second)) if (design->selected(module, it.second)) {
if (!new_cell_type.empty())
it.second->type = new_cell_type;
do_setunset(it.second->parameters, setunset_list); do_setunset(it.second->parameters, setunset_list);
}
} }
} }
} SetparamPass; } SetparamPass;