diff options
author | Ahmed Irfan <ahmedirfan1983@gmail.com> | 2014-01-17 10:07:05 -0800 |
---|---|---|
committer | Ahmed Irfan <ahmedirfan1983@gmail.com> | 2014-01-17 10:07:05 -0800 |
commit | f2ee57f79875e8c63d5da9aedd7c33fc847e6977 (patch) | |
tree | 7650d4822f935efd2b8b0a3f356b7f95760390ec /passes | |
parent | 2d7bcaf2f2ddfaa3b206421513a6fb44077f5824 (diff) | |
parent | 6170cfe9cddfd0040fa9f7b535d25dd2c99cdb91 (diff) | |
download | yosys-f2ee57f79875e8c63d5da9aedd7c33fc847e6977.tar.gz yosys-f2ee57f79875e8c63d5da9aedd7c33fc847e6977.tar.bz2 yosys-f2ee57f79875e8c63d5da9aedd7c33fc847e6977.zip |
Merge pull request #4 from cliffordwolf/master
verilog defaults
Diffstat (limited to 'passes')
-rw-r--r-- | passes/cmds/select.cc | 51 | ||||
-rw-r--r-- | passes/opt/opt_rmdff.cc | 6 |
2 files changed, 50 insertions, 7 deletions
diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc index ec560772e..550545384 100644 --- a/passes/cmds/select.cc +++ b/passes/cmds/select.cc @@ -656,6 +656,7 @@ struct SelectPass : public Pass { // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| log("\n"); log(" select [ -add | -del | -set <name> ] <selection>\n"); + log(" select [ -assert-none | -assert-any ] <selection>\n"); log(" select [ -list | -write <filename> | -count | -clear ]\n"); log(" select -module <modname>\n"); log("\n"); @@ -676,6 +677,14 @@ struct SelectPass : public Pass { log(" do not modify the current selection. instead save the new selection\n"); log(" under the given name (see @<name> below).\n"); log("\n"); + log(" -assert-none\n"); + log(" asserts that the given selection is empty. i.e. produce an error if\n"); + log(" any object matching the selection is found.\n"); + log("\n"); + log(" -assert-any\n"); + log(" asserts that the given selection is non-empty. i.e. produce an error\n"); + log(" if no object matching the selection is found.\n"); + log("\n"); log(" -list\n"); log(" list all objects in the current selection\n"); log("\n"); @@ -802,6 +811,8 @@ struct SelectPass : public Pass { bool list_mode = false; bool count_mode = false; bool got_module = false; + bool assert_none = false; + bool assert_any = false; std::string write_file; std::string set_name; @@ -819,6 +830,14 @@ struct SelectPass : public Pass { del_mode = true; continue; } + if (arg == "-assert-none") { + assert_none = true; + continue; + } + if (arg == "-assert-any") { + assert_any = true; + continue; + } if (arg == "-clear") { clear_mode = true; continue; @@ -853,16 +872,16 @@ struct SelectPass : public Pass { } if (clear_mode && args.size() != 2) - log_cmd_error("Option -clear can not be combined with other options.\n"); + log_cmd_error("Option -clear can not be combined with any other options.\n"); - if (add_mode && del_mode) - log_cmd_error("Options -add and -del can not be combined.\n"); + if (add_mode + del_mode + assert_none + assert_any > 1) + log_cmd_error("Options -add, -del, -assert-none or -assert-any can not be combined.\n"); - if ((list_mode || !write_file.empty() || count_mode) && (add_mode || del_mode)) - log_cmd_error("Options -list, -write and -count can not be combined with -add or -del.\n"); + if ((list_mode || !write_file.empty() || count_mode) && (add_mode || del_mode || assert_none || assert_any)) + log_cmd_error("Options -list, -write and -count can not be combined with -add, -del, -assert-none or -assert-any.\n"); - if (!set_name.empty() && (list_mode || !write_file.empty() || count_mode || add_mode || del_mode)) - log_cmd_error("Option -set can not be combined with -list, -write, -count, -add or -del.\n"); + if (!set_name.empty() && (list_mode || !write_file.empty() || count_mode || add_mode || del_mode || assert_none || assert_any)) + log_cmd_error("Option -set can not be combined with -list, -write, -count, -add, -del, -assert-none or -assert-any.\n"); if (work_stack.size() == 0 && got_module) { RTLIL::Selection sel; @@ -943,6 +962,24 @@ struct SelectPass : public Pass { return; } + if (assert_none) + { + if (work_stack.size() == 0) + log_cmd_error("No selection to check.\n"); + if (!work_stack.back().empty()) + log_error("Assertation failed: selection is not empty.\n"); + return; + } + + if (assert_any) + { + if (work_stack.size() == 0) + log_cmd_error("No selection to check.\n"); + if (work_stack.back().empty()) + log_error("Assertation failed: selection is empty.\n"); + return; + } + if (!set_name.empty()) { if (work_stack.size() == 0) diff --git a/passes/opt/opt_rmdff.cc b/passes/opt/opt_rmdff.cc index a84bf4376..9ce98004e 100644 --- a/passes/opt/opt_rmdff.cc +++ b/passes/opt/opt_rmdff.cc @@ -92,6 +92,12 @@ static bool handle_dff(RTLIL::Module *mod, RTLIL::Cell *dff) } } + if (sig_d.is_fully_undef() && sig_d.width == int(val_rv.bits.size())) { + RTLIL::SigSig conn(sig_q, val_rv); + mod->connections.push_back(conn); + goto delete_dff; + } + if (sig_d.is_fully_const() && sig_r.width == 0) { RTLIL::SigSig conn(sig_q, sig_d); mod->connections.push_back(conn); |