diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-04-20 20:51:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-20 20:51:54 +0200 |
commit | f84a84e3f1a27b361c21fcd30fcf50c1a6586629 (patch) | |
tree | 2d6b8acf72eead2e314295326d567e17e0c66871 /passes/cmds/setattr.cc | |
parent | e3687f6f4e10789223213949b8490bd83ec285f2 (diff) | |
parent | f3ad8d680a3195ab9525b0a8b3f8dbff9d5e6e24 (diff) | |
download | yosys-f84a84e3f1a27b361c21fcd30fcf50c1a6586629.tar.gz yosys-f84a84e3f1a27b361c21fcd30fcf50c1a6586629.tar.bz2 yosys-f84a84e3f1a27b361c21fcd30fcf50c1a6586629.zip |
Merge pull request #943 from YosysHQ/clifford/whitebox
[WIP] Add "whitebox" attribute, add "read_verilog -wb"
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 |