diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-04-20 11:04:46 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2019-04-20 11:04:46 +0200 |
commit | 5b915f01539c993466e83593ee8ae69b45360b81 (patch) | |
tree | 785221be69800c3afc5e1a76a80b29c289eccbcc /passes/cmds/setattr.cc | |
parent | 8f93999129bfcd957dbb312d804c01525af6d07e (diff) | |
download | yosys-5b915f01539c993466e83593ee8ae69b45360b81.tar.gz yosys-5b915f01539c993466e83593ee8ae69b45360b81.tar.bz2 yosys-5b915f01539c993466e83593ee8ae69b45360b81.zip |
Add "wbflip" command
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'passes/cmds/setattr.cc')
-rw-r--r-- | passes/cmds/setattr.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/passes/cmds/setattr.cc b/passes/cmds/setattr.cc index d38a6b3da..b9fcc3e7a 100644 --- a/passes/cmds/setattr.cc +++ b/passes/cmds/setattr.cc @@ -128,6 +128,45 @@ struct SetattrPass : public Pass { } } SetattrPass; +struct WbflipPass : public Pass { + WbflipPass() : Pass("wbflip", "flip the whitebox attribute") { } + void help() YS_OVERRIDE + { + // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| + log("\n"); + log(" wbflip [selection]\n"); + log("\n"); + log("Flip the whitebox attribute on selected cells. I.e. if it's set, unset it, and\n"); + log("vice-versa. Blackbox cells are not effected by this command.\n"); + log("\n"); + } + void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE + { + size_t argidx; + for (argidx = 1; argidx < args.size(); argidx++) + { + std::string arg = args[argidx]; + // if (arg == "-mod") { + // flag_mod = true; + // continue; + // } + break; + } + extra_args(args, argidx, design); + + for (Module *module : design->modules()) + { + if (!design->selected(module)) + continue; + + if (module->get_bool_attribute("\\blackbox")) + continue; + + module->set_bool_attribute("\\whitebox", !module->get_bool_attribute("\\whitebox")); + } + } +} WbflipPass; + struct SetparamPass : public Pass { SetparamPass() : Pass("setparam", "set/unset parameters on objects") { } void help() YS_OVERRIDE |