mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-07 19:51:23 +00:00
Merge remote-tracking branch 'origin/master' into feature/python_bindings
This commit is contained in:
commit
03d1606b42
428 changed files with 23388 additions and 2479 deletions
|
@ -29,4 +29,4 @@ OBJS += passes/cmds/chformal.o
|
|||
OBJS += passes/cmds/chtype.o
|
||||
OBJS += passes/cmds/blackbox.o
|
||||
OBJS += passes/cmds/ltp.o
|
||||
|
||||
OBJS += passes/cmds/bugpoint.o
|
||||
|
|
|
@ -83,7 +83,7 @@ static void add_wire(RTLIL::Design *design, RTLIL::Module *module, std::string n
|
|||
|
||||
struct AddPass : public Pass {
|
||||
AddPass() : Pass("add", "add objects to the design") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -106,7 +106,7 @@ struct AddPass : public Pass {
|
|||
log("selected modules.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
std::string command;
|
||||
std::string arg_name;
|
||||
|
|
|
@ -24,7 +24,7 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct BlackboxPass : public Pass {
|
||||
BlackboxPass() : Pass("blackbox", "change type of cells in the design") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -34,7 +34,7 @@ struct BlackboxPass : public Pass {
|
|||
log("module attribute).\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
size_t argidx;
|
||||
for (argidx = 1; argidx < args.size(); argidx++)
|
||||
|
|
369
passes/cmds/bugpoint.cc
Normal file
369
passes/cmds/bugpoint.cc
Normal file
|
@ -0,0 +1,369 @@
|
|||
/*
|
||||
* yosys -- Yosys Open SYnthesis Suite
|
||||
*
|
||||
* Copyright (C) 2018 whitequark <whitequark@whitequark.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "kernel/yosys.h"
|
||||
#include "backends/ilang/ilang_backend.h"
|
||||
|
||||
USING_YOSYS_NAMESPACE
|
||||
using namespace ILANG_BACKEND;
|
||||
PRIVATE_NAMESPACE_BEGIN
|
||||
|
||||
struct BugpointPass : public Pass {
|
||||
BugpointPass() : Pass("bugpoint", "minimize testcases") { }
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
log(" bugpoint [options]\n");
|
||||
log("\n");
|
||||
log("This command minimizes testcases that crash Yosys. It removes an arbitrary part\n");
|
||||
log("of the design and recursively invokes Yosys with a given script, repeating these\n");
|
||||
log("steps while it can find a smaller design that still causes a crash. Once this\n");
|
||||
log("command finishes, it replaces the current design with the smallest testcase it\n");
|
||||
log("was able to produce.\n");
|
||||
log("\n");
|
||||
log("It is possible to specify the kinds of design part that will be removed. If none\n");
|
||||
log("are specified, all parts of design will be removed.\n");
|
||||
log("\n");
|
||||
log(" -yosys <filename>\n");
|
||||
log(" use this Yosys binary. if not specified, `yosys` is used.\n");
|
||||
log("\n");
|
||||
log(" -script <filename>\n");
|
||||
log(" use this script to crash Yosys. required.\n");
|
||||
log("\n");
|
||||
log(" -grep <string>\n");
|
||||
log(" only consider crashes that place this string in the log file.\n");
|
||||
log("\n");
|
||||
log(" -fast\n");
|
||||
log(" run `clean -purge` after each minimization step. converges faster, but\n");
|
||||
log(" produces larger testcases, and may fail to produce any testcase at all if\n");
|
||||
log(" the crash is related to dangling wires.\n");
|
||||
log("\n");
|
||||
log(" -clean\n");
|
||||
log(" run `clean -purge` before checking testcase and after finishing. produces\n");
|
||||
log(" smaller and more useful testcases, but may fail to produce any testcase\n");
|
||||
log(" at all if the crash is related to dangling wires.\n");
|
||||
log("\n");
|
||||
log(" -modules\n");
|
||||
log(" try to remove modules.\n");
|
||||
log("\n");
|
||||
log(" -ports\n");
|
||||
log(" try to remove module ports.\n");
|
||||
log("\n");
|
||||
log(" -cells\n");
|
||||
log(" try to remove cells.\n");
|
||||
log("\n");
|
||||
log(" -connections\n");
|
||||
log(" try to reconnect ports to 'x.\n");
|
||||
log("\n");
|
||||
}
|
||||
|
||||
bool run_yosys(RTLIL::Design *design, string yosys_cmd, string script)
|
||||
{
|
||||
design->sort();
|
||||
|
||||
std::ofstream f("bugpoint-case.il");
|
||||
ILANG_BACKEND::dump_design(f, design, /*only_selected=*/false, /*flag_m=*/true, /*flag_n=*/false);
|
||||
f.close();
|
||||
|
||||
string yosys_cmdline = stringf("%s -qq -L bugpoint-case.log -s %s bugpoint-case.il", yosys_cmd.c_str(), script.c_str());
|
||||
return run_command(yosys_cmdline) == 0;
|
||||
}
|
||||
|
||||
bool check_logfile(string grep)
|
||||
{
|
||||
if (grep.empty())
|
||||
return true;
|
||||
|
||||
std::ifstream f("bugpoint-case.log");
|
||||
while (!f.eof())
|
||||
{
|
||||
string line;
|
||||
getline(f, line);
|
||||
if (line.find(grep) != std::string::npos)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
RTLIL::Design *clean_design(RTLIL::Design *design, bool do_clean = true, bool do_delete = false)
|
||||
{
|
||||
if (!do_clean)
|
||||
return design;
|
||||
|
||||
RTLIL::Design *design_copy = new RTLIL::Design;
|
||||
for (auto &it : design->modules_)
|
||||
design_copy->add(it.second->clone());
|
||||
Pass::call(design_copy, "clean -purge");
|
||||
|
||||
if (do_delete)
|
||||
delete design;
|
||||
return design_copy;
|
||||
}
|
||||
|
||||
RTLIL::Design *simplify_something(RTLIL::Design *design, int &seed, bool stage2, bool modules, bool ports, bool cells, bool connections)
|
||||
{
|
||||
RTLIL::Design *design_copy = new RTLIL::Design;
|
||||
for (auto &it : design->modules_)
|
||||
design_copy->add(it.second->clone());
|
||||
|
||||
int index = 0;
|
||||
if (modules)
|
||||
{
|
||||
for (auto &it : design_copy->modules_)
|
||||
{
|
||||
if (it.second->get_bool_attribute("\\blackbox"))
|
||||
continue;
|
||||
|
||||
if (index++ == seed)
|
||||
{
|
||||
log("Trying to remove module %s.\n", it.first.c_str());
|
||||
design_copy->remove(it.second);
|
||||
return design_copy;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ports)
|
||||
{
|
||||
for (auto mod : design_copy->modules())
|
||||
{
|
||||
if (mod->get_bool_attribute("\\blackbox"))
|
||||
continue;
|
||||
|
||||
for (auto wire : mod->wires())
|
||||
{
|
||||
if (!stage2 && wire->get_bool_attribute("$bugpoint"))
|
||||
continue;
|
||||
|
||||
if (wire->port_input || wire->port_output)
|
||||
{
|
||||
if (index++ == seed)
|
||||
{
|
||||
log("Trying to remove module port %s.\n", log_signal(wire));
|
||||
wire->port_input = wire->port_output = false;
|
||||
mod->fixup_ports();
|
||||
return design_copy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cells)
|
||||
{
|
||||
for (auto mod : design_copy->modules())
|
||||
{
|
||||
if (mod->get_bool_attribute("\\blackbox"))
|
||||
continue;
|
||||
|
||||
for (auto &it : mod->cells_)
|
||||
{
|
||||
if (index++ == seed)
|
||||
{
|
||||
log("Trying to remove cell %s.%s.\n", mod->name.c_str(), it.first.c_str());
|
||||
mod->remove(it.second);
|
||||
return design_copy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (connections)
|
||||
{
|
||||
for (auto mod : design_copy->modules())
|
||||
{
|
||||
if (mod->get_bool_attribute("\\blackbox"))
|
||||
continue;
|
||||
|
||||
for (auto cell : mod->cells())
|
||||
{
|
||||
for (auto it : cell->connections_)
|
||||
{
|
||||
RTLIL::SigSpec port = cell->getPort(it.first);
|
||||
bool is_undef = port.is_fully_undef();
|
||||
bool is_port = port.is_wire() && (port.as_wire()->port_input || port.as_wire()->port_output);
|
||||
|
||||
if(is_undef || (!stage2 && is_port))
|
||||
continue;
|
||||
|
||||
if (index++ == seed)
|
||||
{
|
||||
log("Trying to remove cell port %s.%s.%s.\n", mod->name.c_str(), cell->name.c_str(), it.first.c_str());
|
||||
RTLIL::SigSpec port_x(State::Sx, port.size());
|
||||
cell->unsetPort(it.first);
|
||||
cell->setPort(it.first, port_x);
|
||||
return design_copy;
|
||||
}
|
||||
|
||||
if (!stage2 && (cell->input(it.first) || cell->output(it.first)) && index++ == seed)
|
||||
{
|
||||
log("Trying to expose cell port %s.%s.%s as module port.\n", mod->name.c_str(), cell->name.c_str(), it.first.c_str());
|
||||
RTLIL::Wire *wire = mod->addWire(NEW_ID, port.size());
|
||||
wire->set_bool_attribute("$bugpoint");
|
||||
wire->port_input = cell->input(it.first);
|
||||
wire->port_output = cell->output(it.first);
|
||||
cell->unsetPort(it.first);
|
||||
cell->setPort(it.first, wire);
|
||||
mod->fixup_ports();
|
||||
return design_copy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
string yosys_cmd = "yosys", script, grep;
|
||||
bool fast = false, clean = false;
|
||||
bool modules = false, ports = false, cells = false, connections = false, has_part = false;
|
||||
|
||||
size_t argidx;
|
||||
for (argidx = 1; argidx < args.size(); argidx++)
|
||||
{
|
||||
if (args[argidx] == "-yosys" && argidx + 1 < args.size()) {
|
||||
yosys_cmd = args[++argidx];
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-script" && argidx + 1 < args.size()) {
|
||||
script = args[++argidx];
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-grep" && argidx + 1 < args.size()) {
|
||||
grep = args[++argidx];
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-fast") {
|
||||
fast = true;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-clean") {
|
||||
clean = true;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-modules") {
|
||||
modules = true;
|
||||
has_part = true;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-ports") {
|
||||
ports = true;
|
||||
has_part = true;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-cells") {
|
||||
cells = true;
|
||||
has_part = true;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-connections") {
|
||||
connections = true;
|
||||
has_part = true;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
extra_args(args, argidx, design);
|
||||
|
||||
if (!has_part)
|
||||
{
|
||||
modules = true;
|
||||
ports = true;
|
||||
cells = true;
|
||||
connections = true;
|
||||
}
|
||||
|
||||
if (!design->full_selection())
|
||||
log_cmd_error("This command only operates on fully selected designs!\n");
|
||||
|
||||
RTLIL::Design *crashing_design = clean_design(design, clean);
|
||||
if (run_yosys(crashing_design, yosys_cmd, script))
|
||||
log_cmd_error("The provided script file and Yosys binary do not crash on this design!\n");
|
||||
if (!check_logfile(grep))
|
||||
log_cmd_error("The provided grep string is not found in the log file!\n");
|
||||
|
||||
int seed = 0, crashing_seed = seed;
|
||||
bool found_something = false, stage2 = false;
|
||||
while (true)
|
||||
{
|
||||
if (RTLIL::Design *simplified = simplify_something(crashing_design, seed, stage2, modules, ports, cells, connections))
|
||||
{
|
||||
simplified = clean_design(simplified, fast, /*do_delete=*/true);
|
||||
|
||||
bool crashes;
|
||||
if (clean)
|
||||
{
|
||||
RTLIL::Design *testcase = clean_design(simplified);
|
||||
crashes = !run_yosys(testcase, yosys_cmd, script);
|
||||
delete testcase;
|
||||
}
|
||||
else
|
||||
{
|
||||
crashes = !run_yosys(simplified, yosys_cmd, script);
|
||||
}
|
||||
|
||||
if (crashes && check_logfile(grep))
|
||||
{
|
||||
log("Testcase crashes.\n");
|
||||
if (crashing_design != design)
|
||||
delete crashing_design;
|
||||
crashing_design = simplified;
|
||||
crashing_seed = seed;
|
||||
found_something = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
log("Testcase does not crash.\n");
|
||||
delete simplified;
|
||||
seed++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
seed = 0;
|
||||
if (found_something)
|
||||
found_something = false;
|
||||
else
|
||||
{
|
||||
if (!stage2)
|
||||
{
|
||||
log("Demoting introduced module ports.\n");
|
||||
stage2 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
log("Simplifications exhausted.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (crashing_design != design)
|
||||
{
|
||||
Pass::call(design, "design -reset");
|
||||
crashing_design = clean_design(crashing_design, clean, /*do_delete=*/true);
|
||||
for (auto &it : crashing_design->modules_)
|
||||
design->add(it.second->clone());
|
||||
delete crashing_design;
|
||||
}
|
||||
}
|
||||
} BugpointPass;
|
||||
|
||||
PRIVATE_NAMESPACE_END
|
|
@ -27,7 +27,7 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct CheckPass : public Pass {
|
||||
CheckPass() : Pass("check", "check for obvious problems in the design") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -51,7 +51,7 @@ struct CheckPass : public Pass {
|
|||
log("problems are found in the current design.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
int counter = 0;
|
||||
bool noinit = false;
|
||||
|
|
|
@ -25,14 +25,14 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct ChformalPass : public Pass {
|
||||
ChformalPass() : Pass("chformal", "change formal constraints of the design") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
log(" chformal [types] [mode] [options] [selection]\n");
|
||||
log("\n");
|
||||
log("Make changes to the formal constraints of the design. The [types] options\n");
|
||||
log("the type of constraint to operate on. If none of the folling options is given,\n");
|
||||
log("the type of constraint to operate on. If none of the following options are given,\n");
|
||||
log("the command will operate on all constraint types:\n");
|
||||
log("\n");
|
||||
log(" -assert $assert cells, representing assert(...) constraints\n");
|
||||
|
@ -59,10 +59,10 @@ struct ChformalPass : public Pass {
|
|||
log(" -assume2assert\n");
|
||||
log(" -live2fair\n");
|
||||
log(" -fair2live\n");
|
||||
log(" change the roles of cells as indicated. this options can be combined\n");
|
||||
log(" change the roles of cells as indicated. these options can be combined\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
bool assert2assume = false;
|
||||
bool assume2assert = false;
|
||||
|
|
|
@ -24,7 +24,7 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct ChtypePass : public Pass {
|
||||
ChtypePass() : Pass("chtype", "change type of cells in the design") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -40,7 +40,7 @@ struct ChtypePass : public Pass {
|
|||
log("\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
IdString set_type;
|
||||
dict<IdString, IdString> map_types;
|
||||
|
|
|
@ -43,7 +43,7 @@ static void unset_drivers(RTLIL::Design *design, RTLIL::Module *module, SigMap &
|
|||
|
||||
struct ConnectPass : public Pass {
|
||||
ConnectPass() : Pass("connect", "create or remove connections") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -75,7 +75,7 @@ struct ConnectPass : public Pass {
|
|||
log("This command does not operate on module with processes.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
RTLIL::Module *module = NULL;
|
||||
for (auto &it : design->modules_) {
|
||||
|
@ -137,7 +137,7 @@ struct ConnectPass : public Pass {
|
|||
if (!set_lhs.empty())
|
||||
{
|
||||
if (!unset_expr.empty() || !port_cell.empty())
|
||||
log_cmd_error("Cant use -set together with -unset and/or -port.\n");
|
||||
log_cmd_error("Can't use -set together with -unset and/or -port.\n");
|
||||
|
||||
RTLIL::SigSpec sig_lhs, sig_rhs;
|
||||
if (!RTLIL::SigSpec::parse_sel(sig_lhs, design, module, set_lhs))
|
||||
|
@ -157,7 +157,7 @@ struct ConnectPass : public Pass {
|
|||
if (!unset_expr.empty())
|
||||
{
|
||||
if (!port_cell.empty() || flag_nounset)
|
||||
log_cmd_error("Cant use -unset together with -port and/or -nounset.\n");
|
||||
log_cmd_error("Can't use -unset together with -port and/or -nounset.\n");
|
||||
|
||||
RTLIL::SigSpec sig;
|
||||
if (!RTLIL::SigSpec::parse_sel(sig, design, module, unset_expr))
|
||||
|
@ -170,7 +170,7 @@ struct ConnectPass : public Pass {
|
|||
if (!port_cell.empty())
|
||||
{
|
||||
if (flag_nounset)
|
||||
log_cmd_error("Cant use -port together with -nounset.\n");
|
||||
log_cmd_error("Can't use -port together with -nounset.\n");
|
||||
|
||||
if (module->cells_.count(RTLIL::escape_id(port_cell)) == 0)
|
||||
log_cmd_error("Can't find cell %s.\n", port_cell.c_str());
|
||||
|
|
|
@ -150,7 +150,7 @@ struct ConnwrappersWorker
|
|||
|
||||
struct ConnwrappersPass : public Pass {
|
||||
ConnwrappersPass() : Pass("connwrappers", "match width of input-output port pairs") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -172,7 +172,7 @@ struct ConnwrappersPass : public Pass {
|
|||
log("The options -signed, -unsigned, and -port can be specified multiple times.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
ConnwrappersWorker worker;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct CopyPass : public Pass {
|
||||
CopyPass() : Pass("copy", "copy modules in the design") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -36,7 +36,7 @@ struct CopyPass : public Pass {
|
|||
log("by this command.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
if (args.size() != 3)
|
||||
log_cmd_error("Invalid number of arguments!\n");
|
||||
|
|
|
@ -35,7 +35,7 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct CoverPass : public Pass {
|
||||
CoverPass() : Pass("cover", "print code coverage counters") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -83,7 +83,7 @@ struct CoverPass : public Pass {
|
|||
log("Coverage counters are only available in Yosys for Linux.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
std::vector<FILE*> out_files;
|
||||
std::vector<std::string> patterns;
|
||||
|
|
|
@ -24,7 +24,7 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct DeletePass : public Pass {
|
||||
DeletePass() : Pass("delete", "delete objects in the design") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -40,7 +40,7 @@ struct DeletePass : public Pass {
|
|||
log("selected wires, thus 'deleting' module ports.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
bool flag_input = false;
|
||||
bool flag_output = false;
|
||||
|
|
|
@ -27,7 +27,7 @@ std::vector<RTLIL::Design*> pushed_designs;
|
|||
|
||||
struct DesignPass : public Pass {
|
||||
DesignPass() : Pass("design", "save, restore and reset current design") { }
|
||||
virtual ~DesignPass() {
|
||||
~DesignPass() YS_OVERRIDE {
|
||||
for (auto &it : saved_designs)
|
||||
delete it.second;
|
||||
saved_designs.clear();
|
||||
|
@ -35,7 +35,7 @@ struct DesignPass : public Pass {
|
|||
delete it;
|
||||
pushed_designs.clear();
|
||||
}
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -94,7 +94,7 @@ struct DesignPass : public Pass {
|
|||
log("between calls to 'read_verilog'. This command resets this memory.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
bool got_mode = false;
|
||||
bool reset_mode = false;
|
||||
|
|
|
@ -25,7 +25,7 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct EdgetypePass : public Pass {
|
||||
EdgetypePass() : Pass("edgetypes", "list all types of edges in selection") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -35,7 +35,7 @@ struct EdgetypePass : public Pass {
|
|||
log("is a 4-tuple of source and sink cell type and port name.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
size_t argidx;
|
||||
for (argidx = 1; argidx < args.size(); argidx++) {
|
||||
|
|
|
@ -27,7 +27,7 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct LogPass : public Pass {
|
||||
LogPass() : Pass("log", "print text and log files") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -52,7 +52,7 @@ struct LogPass : public Pass {
|
|||
log(" do not append a newline\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design*)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design*) YS_OVERRIDE
|
||||
{
|
||||
size_t argidx;
|
||||
bool to_stdout = false;
|
||||
|
|
|
@ -141,7 +141,7 @@ struct LtpWorker
|
|||
|
||||
struct LtpPass : public Pass {
|
||||
LtpPass() : Pass("ltp", "print longest topological path") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -154,7 +154,7 @@ struct LtpPass : public Pass {
|
|||
log(" automatically exclude FF cell types\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
bool noff = false;
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ void load_plugin(std::string, std::vector<std::string>)
|
|||
|
||||
struct PluginPass : public Pass {
|
||||
PluginPass() : Pass("plugin", "load and list loaded plugins") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -118,7 +118,7 @@ struct PluginPass : public Pass {
|
|||
log(" List loaded plugins\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
std::string plugin_filename;
|
||||
std::vector<std::string> plugin_aliases;
|
||||
|
|
|
@ -778,7 +778,7 @@ struct QwpWorker
|
|||
|
||||
struct QwpPass : public Pass {
|
||||
QwpPass() : Pass("qwp", "quadratic wirelength placer") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -808,7 +808,7 @@ struct QwpPass : public Pass {
|
|||
log("dense matrix operations. It is only a toy-placer for small circuits.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
QwpConfig config;
|
||||
xorshift32_state = 123456789;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
USING_YOSYS_NAMESPACE
|
||||
PRIVATE_NAMESPACE_BEGIN
|
||||
|
||||
static void rename_in_module(RTLIL::Module *module, std::string from_name, std::string to_name)
|
||||
static void rename_in_module(RTLIL::Module *module, std::string from_name, std::string to_name, bool flag_output)
|
||||
{
|
||||
from_name = RTLIL::escape_id(from_name);
|
||||
to_name = RTLIL::escape_id(to_name);
|
||||
|
@ -37,13 +37,18 @@ static void rename_in_module(RTLIL::Module *module, std::string from_name, std::
|
|||
Wire *w = it.second;
|
||||
log("Renaming wire %s to %s in module %s.\n", log_id(w), log_id(to_name), log_id(module));
|
||||
module->rename(w, to_name);
|
||||
if (w->port_id)
|
||||
if (w->port_id || flag_output) {
|
||||
if (flag_output)
|
||||
w->port_output = true;
|
||||
module->fixup_ports();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto &it : module->cells_)
|
||||
if (it.first == from_name) {
|
||||
if (flag_output)
|
||||
log_cmd_error("Called with -output but the specified object is a cell.\n");
|
||||
log("Renaming cell %s to %s in module %s.\n", log_id(it.second), log_id(to_name), log_id(module));
|
||||
module->rename(it.second, to_name);
|
||||
return;
|
||||
|
@ -52,9 +57,54 @@ static void rename_in_module(RTLIL::Module *module, std::string from_name, std::
|
|||
log_cmd_error("Object `%s' not found!\n", from_name.c_str());
|
||||
}
|
||||
|
||||
static std::string derive_name_from_src(const std::string &src, int counter)
|
||||
{
|
||||
std::string src_base = src.substr(0, src.find('|'));
|
||||
if (src_base.empty())
|
||||
return stringf("$%d", counter);
|
||||
else
|
||||
return stringf("\\%s$%d", src_base.c_str(), counter);
|
||||
}
|
||||
|
||||
static IdString derive_name_from_wire(const RTLIL::Cell &cell)
|
||||
{
|
||||
// Find output
|
||||
const SigSpec *output = nullptr;
|
||||
int num_outputs = 0;
|
||||
for (auto &connection : cell.connections()) {
|
||||
if (cell.output(connection.first)) {
|
||||
output = &connection.second;
|
||||
num_outputs++;
|
||||
}
|
||||
}
|
||||
|
||||
if (num_outputs != 1) // Skip cells thad drive multiple outputs
|
||||
return cell.name;
|
||||
|
||||
std::string name = "";
|
||||
for (auto &chunk : output->chunks()) {
|
||||
// Skip cells that drive privately named wires
|
||||
if (!chunk.wire || chunk.wire->name.str()[0] == '$')
|
||||
return cell.name;
|
||||
|
||||
if (name != "")
|
||||
name += "$";
|
||||
|
||||
name += chunk.wire->name.str();
|
||||
if (chunk.wire->width != chunk.width) {
|
||||
name += "[";
|
||||
if (chunk.width != 1)
|
||||
name += std::to_string(chunk.offset + chunk.width) + ":";
|
||||
name += std::to_string(chunk.offset) + "]";
|
||||
}
|
||||
}
|
||||
|
||||
return name + cell.type.str();
|
||||
}
|
||||
|
||||
struct RenamePass : public Pass {
|
||||
RenamePass() : Pass("rename", "rename object in the design") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -64,6 +114,25 @@ struct RenamePass : public Pass {
|
|||
log("by this command.\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
log(" rename -output old_name new_name\n");
|
||||
log("\n");
|
||||
log("Like above, but also make the wire an output. This will fail if the object is\n");
|
||||
log("not a wire.\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
log(" rename -src [selection]\n");
|
||||
log("\n");
|
||||
log("Assign names auto-generated from the src attribute to all selected wires and\n");
|
||||
log("cells with private names.\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
log(" rename -wire [selection]\n");
|
||||
log("\n");
|
||||
log("Assign auto-generated names based on the wires they drive to all selected\n");
|
||||
log("cells with private names. Ignores cells driving privatly named wires.\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
log(" rename -enumerate [-pattern <pattern>] [selection]\n");
|
||||
log("\n");
|
||||
log("Assign short auto-generated names to all selected wires and cells with private\n");
|
||||
|
@ -71,28 +140,48 @@ struct RenamePass : public Pass {
|
|||
log("The character %% in the pattern is replaced with a integer number. The default\n");
|
||||
log("pattern is '_%%_'.\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
log(" rename -hide [selection]\n");
|
||||
log("\n");
|
||||
log("Assign private names (the ones with $-prefix) to all selected wires and cells\n");
|
||||
log("with public names. This ignores all selected ports.\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
log(" rename -top new_name\n");
|
||||
log("\n");
|
||||
log("Rename top module.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
std::string pattern_prefix = "_", pattern_suffix = "_";
|
||||
bool flag_src = false;
|
||||
bool flag_wire = false;
|
||||
bool flag_enumerate = false;
|
||||
bool flag_hide = false;
|
||||
bool flag_top = false;
|
||||
bool flag_output = false;
|
||||
bool got_mode = false;
|
||||
|
||||
size_t argidx;
|
||||
for (argidx = 1; argidx < args.size(); argidx++)
|
||||
{
|
||||
std::string arg = args[argidx];
|
||||
if (arg == "-src" && !got_mode) {
|
||||
flag_src = true;
|
||||
got_mode = true;
|
||||
continue;
|
||||
}
|
||||
if (arg == "-output" && !got_mode) {
|
||||
flag_output = true;
|
||||
got_mode = true;
|
||||
continue;
|
||||
}
|
||||
if (arg == "-wire" && !got_mode) {
|
||||
flag_wire = true;
|
||||
got_mode = true;
|
||||
continue;
|
||||
}
|
||||
if (arg == "-enumerate" && !got_mode) {
|
||||
flag_enumerate = true;
|
||||
got_mode = true;
|
||||
|
@ -117,6 +206,57 @@ struct RenamePass : public Pass {
|
|||
break;
|
||||
}
|
||||
|
||||
if (flag_src)
|
||||
{
|
||||
extra_args(args, argidx, design);
|
||||
|
||||
for (auto &mod : design->modules_)
|
||||
{
|
||||
int counter = 0;
|
||||
|
||||
RTLIL::Module *module = mod.second;
|
||||
if (!design->selected(module))
|
||||
continue;
|
||||
|
||||
dict<RTLIL::IdString, RTLIL::Wire*> new_wires;
|
||||
for (auto &it : module->wires_) {
|
||||
if (it.first[0] == '$' && design->selected(module, it.second))
|
||||
it.second->name = derive_name_from_src(it.second->get_src_attribute(), counter++);
|
||||
new_wires[it.second->name] = it.second;
|
||||
}
|
||||
module->wires_.swap(new_wires);
|
||||
module->fixup_ports();
|
||||
|
||||
dict<RTLIL::IdString, RTLIL::Cell*> new_cells;
|
||||
for (auto &it : module->cells_) {
|
||||
if (it.first[0] == '$' && design->selected(module, it.second))
|
||||
it.second->name = derive_name_from_src(it.second->get_src_attribute(), counter++);
|
||||
new_cells[it.second->name] = it.second;
|
||||
}
|
||||
module->cells_.swap(new_cells);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (flag_wire)
|
||||
{
|
||||
extra_args(args, argidx, design);
|
||||
|
||||
for (auto &mod : design->modules_)
|
||||
{
|
||||
RTLIL::Module *module = mod.second;
|
||||
if (!design->selected(module))
|
||||
continue;
|
||||
|
||||
dict<RTLIL::IdString, RTLIL::Cell*> new_cells;
|
||||
for (auto &it : module->cells_) {
|
||||
if (it.first[0] == '$' && design->selected(module, it.second))
|
||||
it.second->name = derive_name_from_wire(*it.second);
|
||||
new_cells[it.second->name] = it.second;
|
||||
}
|
||||
module->cells_.swap(new_cells);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (flag_enumerate)
|
||||
{
|
||||
extra_args(args, argidx, design);
|
||||
|
@ -206,10 +346,12 @@ struct RenamePass : public Pass {
|
|||
if (!design->selected_active_module.empty())
|
||||
{
|
||||
if (design->modules_.count(design->selected_active_module) > 0)
|
||||
rename_in_module(design->modules_.at(design->selected_active_module), from_name, to_name);
|
||||
rename_in_module(design->modules_.at(design->selected_active_module), from_name, to_name, flag_output);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (flag_output)
|
||||
log_cmd_error("Mode -output requires that there is an active module selected.\n");
|
||||
for (auto &mod : design->modules_) {
|
||||
if (mod.first == from_name || RTLIL::unescape_id(mod.first) == from_name) {
|
||||
to_name = RTLIL::escape_id(to_name);
|
||||
|
|
|
@ -27,7 +27,7 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct ScatterPass : public Pass {
|
||||
ScatterPass() : Pass("scatter", "add additional intermediate nets") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -41,7 +41,7 @@ struct ScatterPass : public Pass {
|
|||
log("Use the opt_clean command to get rid of the additional nets.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
CellTypes ct(design);
|
||||
extra_args(args, 1, design);
|
||||
|
|
|
@ -218,7 +218,7 @@ struct SccWorker
|
|||
|
||||
struct SccPass : public Pass {
|
||||
SccPass() : Pass("scc", "detect strongly connected components (logic loops)") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -255,7 +255,7 @@ struct SccPass : public Pass {
|
|||
log(" that are part of a found logic loop\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
std::map<std::string, std::string> setAttr;
|
||||
bool allCellTypes = false;
|
||||
|
|
|
@ -896,6 +896,29 @@ static void select_stmt(RTLIL::Design *design, std::string arg)
|
|||
select_filter_active_mod(design, work_stack.back());
|
||||
}
|
||||
|
||||
static std::string describe_selection_for_assert(RTLIL::Design *design, RTLIL::Selection *sel)
|
||||
{
|
||||
std::string desc = "Selection contains:\n";
|
||||
for (auto mod_it : design->modules_)
|
||||
{
|
||||
if (sel->selected_module(mod_it.first)) {
|
||||
for (auto &it : mod_it.second->wires_)
|
||||
if (sel->selected_member(mod_it.first, it.first))
|
||||
desc += stringf("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first));
|
||||
for (auto &it : mod_it.second->memories)
|
||||
if (sel->selected_member(mod_it.first, it.first))
|
||||
desc += stringf("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first));
|
||||
for (auto &it : mod_it.second->cells_)
|
||||
if (sel->selected_member(mod_it.first, it.first))
|
||||
desc += stringf("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first));
|
||||
for (auto &it : mod_it.second->processes)
|
||||
if (sel->selected_member(mod_it.first, it.first))
|
||||
desc += stringf("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first));
|
||||
}
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
PRIVATE_NAMESPACE_END
|
||||
YOSYS_NAMESPACE_BEGIN
|
||||
|
||||
|
@ -950,7 +973,7 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct SelectPass : public Pass {
|
||||
SelectPass() : Pass("select", "modify and view the list of selected objects") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -1167,7 +1190,7 @@ struct SelectPass : public Pass {
|
|||
log(" select */t:SWITCH %%x:+[GATE] */t:SWITCH %%d\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
bool add_mode = false;
|
||||
bool del_mode = false;
|
||||
|
@ -1394,7 +1417,12 @@ struct SelectPass : public Pass {
|
|||
log_cmd_error("No selection to check.\n");
|
||||
work_stack.back().optimize(design);
|
||||
if (!work_stack.back().empty())
|
||||
log_error("Assertion failed: selection is not empty:%s\n", sel_str.c_str());
|
||||
{
|
||||
RTLIL::Selection *sel = &work_stack.back();
|
||||
sel->optimize(design);
|
||||
std::string desc = describe_selection_for_assert(design, sel);
|
||||
log_error("Assertion failed: selection is not empty:%s\n%s", sel_str.c_str(), desc.c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1404,7 +1432,12 @@ struct SelectPass : public Pass {
|
|||
log_cmd_error("No selection to check.\n");
|
||||
work_stack.back().optimize(design);
|
||||
if (work_stack.back().empty())
|
||||
log_error("Assertion failed: selection is empty:%s\n", sel_str.c_str());
|
||||
{
|
||||
RTLIL::Selection *sel = &work_stack.back();
|
||||
sel->optimize(design);
|
||||
std::string desc = describe_selection_for_assert(design, sel);
|
||||
log_error("Assertion failed: selection is empty:%s\n%s", sel_str.c_str(), desc.c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1431,14 +1464,23 @@ struct SelectPass : public Pass {
|
|||
total_count++;
|
||||
}
|
||||
if (assert_count >= 0 && assert_count != total_count)
|
||||
log_error("Assertion failed: selection contains %d elements instead of the asserted %d:%s\n",
|
||||
total_count, assert_count, sel_str.c_str());
|
||||
{
|
||||
std::string desc = describe_selection_for_assert(design, sel);
|
||||
log_error("Assertion failed: selection contains %d elements instead of the asserted %d:%s\n%s",
|
||||
total_count, assert_count, sel_str.c_str(), desc.c_str());
|
||||
}
|
||||
if (assert_max >= 0 && assert_max < total_count)
|
||||
log_error("Assertion failed: selection contains %d elements, more than the maximum number %d:%s\n",
|
||||
total_count, assert_max, sel_str.c_str());
|
||||
{
|
||||
std::string desc = describe_selection_for_assert(design, sel);
|
||||
log_error("Assertion failed: selection contains %d elements, more than the maximum number %d:%s\n%s",
|
||||
total_count, assert_max, sel_str.c_str(), desc.c_str());
|
||||
}
|
||||
if (assert_min >= 0 && assert_min > total_count)
|
||||
log_error("Assertion failed: selection contains %d elements, less than the minimum number %d:%s\n",
|
||||
total_count, assert_min, sel_str.c_str());
|
||||
{
|
||||
std::string desc = describe_selection_for_assert(design, sel);
|
||||
log_error("Assertion failed: selection contains %d elements, less than the minimum number %d:%s\n%s",
|
||||
total_count, assert_min, sel_str.c_str(), desc.c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1470,7 +1512,7 @@ struct SelectPass : public Pass {
|
|||
|
||||
struct CdPass : public Pass {
|
||||
CdPass() : Pass("cd", "a shortcut for 'select -module <name>'") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -1496,7 +1538,7 @@ struct CdPass : public Pass {
|
|||
log("This is just a shortcut for 'select -clear'.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
if (args.size() != 1 && args.size() != 2)
|
||||
log_cmd_error("Invalid number of arguments.\n");
|
||||
|
@ -1578,7 +1620,7 @@ static void log_matches(const char *title, Module *module, T list)
|
|||
|
||||
struct LsPass : public Pass {
|
||||
LsPass() : Pass("ls", "list modules or objects in modules") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -1589,7 +1631,7 @@ struct LsPass : public Pass {
|
|||
log("When an active module is selected, this prints a list of objects in the module.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
size_t argidx = 1;
|
||||
extra_args(args, argidx, design);
|
||||
|
|
|
@ -56,7 +56,7 @@ static void do_setunset(dict<RTLIL::IdString, RTLIL::Const> &attrs, const std::v
|
|||
|
||||
struct SetattrPass : public Pass {
|
||||
SetattrPass() : Pass("setattr", "set/unset attributes on objects") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -69,7 +69,7 @@ struct SetattrPass : public Pass {
|
|||
log("instead of objects within modules.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
std::vector<setunset_t> setunset_list;
|
||||
bool flag_mod = false;
|
||||
|
@ -130,7 +130,7 @@ struct SetattrPass : public Pass {
|
|||
|
||||
struct SetparamPass : public Pass {
|
||||
SetparamPass() : Pass("setparam", "set/unset parameters on objects") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -142,7 +142,7 @@ struct SetparamPass : public Pass {
|
|||
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)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
vector<setunset_t> setunset_list;
|
||||
string new_cell_type;
|
||||
|
@ -188,7 +188,7 @@ struct SetparamPass : public Pass {
|
|||
|
||||
struct ChparamPass : public Pass {
|
||||
ChparamPass() : Pass("chparam", "re-evaluate modules with new parameters") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -203,7 +203,7 @@ struct ChparamPass : public Pass {
|
|||
log("List the available parameters of the selected modules.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
std::vector<setunset_t> setunset_list;
|
||||
dict<RTLIL::IdString, RTLIL::Const> new_parameters;
|
||||
|
|
|
@ -33,6 +33,34 @@
|
|||
USING_YOSYS_NAMESPACE
|
||||
PRIVATE_NAMESPACE_BEGIN
|
||||
|
||||
static RTLIL::Wire * add_wire(RTLIL::Module *module, std::string name, int width, bool flag_input, bool flag_output)
|
||||
{
|
||||
RTLIL::Wire *wire = NULL;
|
||||
name = RTLIL::escape_id(name);
|
||||
|
||||
if (module->count_id(name) != 0)
|
||||
{
|
||||
log("Module %s already has such an object %s.\n", module->name.c_str(), name.c_str());
|
||||
name += "$";
|
||||
return add_wire(module, name, width, flag_input, flag_output);
|
||||
}
|
||||
else
|
||||
{
|
||||
wire = module->addWire(name, width);
|
||||
wire->port_input = flag_input;
|
||||
wire->port_output = flag_output;
|
||||
|
||||
if (flag_input || flag_output) {
|
||||
wire->port_id = module->wires_.size();
|
||||
module->fixup_ports();
|
||||
}
|
||||
|
||||
log("Added wire %s to module %s.\n", name.c_str(), module->name.c_str());
|
||||
}
|
||||
|
||||
return wire;
|
||||
}
|
||||
|
||||
struct SetundefWorker
|
||||
{
|
||||
int next_bit_mode;
|
||||
|
@ -79,7 +107,7 @@ struct SetundefWorker
|
|||
|
||||
struct SetundefPass : public Pass {
|
||||
SetundefPass() : Pass("setundef", "replace undef values with defined constants") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -90,6 +118,9 @@ struct SetundefPass : public Pass {
|
|||
log(" -undriven\n");
|
||||
log(" also set undriven nets to constant values\n");
|
||||
log("\n");
|
||||
log(" -expose\n");
|
||||
log(" also expose undriven nets as inputs (use with -undriven)\n");
|
||||
log("\n");
|
||||
log(" -zero\n");
|
||||
log(" replace with bits cleared (0)\n");
|
||||
log("\n");
|
||||
|
@ -106,18 +137,23 @@ struct SetundefPass : public Pass {
|
|||
log(" replace with $anyconst drivers (for formal)\n");
|
||||
log("\n");
|
||||
log(" -random <seed>\n");
|
||||
log(" replace with random bits using the specified integer als seed\n");
|
||||
log(" replace with random bits using the specified integer as seed\n");
|
||||
log(" value for the random number generator.\n");
|
||||
log("\n");
|
||||
log(" -init\n");
|
||||
log(" also create/update init values for flip-flops\n");
|
||||
log("\n");
|
||||
log(" -params\n");
|
||||
log(" replace undef in cell parameters\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
bool got_value = false;
|
||||
bool undriven_mode = false;
|
||||
bool expose_mode = false;
|
||||
bool init_mode = false;
|
||||
bool params_mode = false;
|
||||
SetundefWorker worker;
|
||||
|
||||
log_header(design, "Executing SETUNDEF pass (replace undef values with defined constants).\n");
|
||||
|
@ -129,6 +165,10 @@ struct SetundefPass : public Pass {
|
|||
undriven_mode = true;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-expose") {
|
||||
expose_mode = true;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-zero") {
|
||||
got_value = true;
|
||||
worker.next_bit_mode = MODE_ZERO;
|
||||
|
@ -163,6 +203,10 @@ struct SetundefPass : public Pass {
|
|||
init_mode = true;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-params") {
|
||||
params_mode = true;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-random" && !got_value && argidx+1 < args.size()) {
|
||||
got_value = true;
|
||||
worker.next_bit_mode = MODE_RANDOM;
|
||||
|
@ -175,6 +219,15 @@ struct SetundefPass : public Pass {
|
|||
}
|
||||
extra_args(args, argidx, design);
|
||||
|
||||
if (!got_value && expose_mode) {
|
||||
log("Using default as -undef with -expose.\n");
|
||||
got_value = true;
|
||||
worker.next_bit_mode = MODE_UNDEF;
|
||||
worker.next_bit_state = 0;
|
||||
}
|
||||
|
||||
if (expose_mode && !undriven_mode)
|
||||
log_cmd_error("Option -expose must be used with option -undriven.\n");
|
||||
if (!got_value)
|
||||
log_cmd_error("One of the options -zero, -one, -anyseq, -anyconst, or -random <seed> must be specified.\n");
|
||||
|
||||
|
@ -183,38 +236,120 @@ struct SetundefPass : public Pass {
|
|||
|
||||
for (auto module : design->selected_modules())
|
||||
{
|
||||
if (params_mode)
|
||||
{
|
||||
for (auto *cell : module->selected_cells()) {
|
||||
for (auto ¶meter : cell->parameters) {
|
||||
for (auto &bit : parameter.second.bits) {
|
||||
if (bit > RTLIL::State::S1)
|
||||
bit = worker.next_bit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (undriven_mode)
|
||||
{
|
||||
if (!module->processes.empty())
|
||||
log_error("The 'setundef' command can't operate in -undriven mode on modules with processes. Run 'proc' first.\n");
|
||||
|
||||
SigMap sigmap(module);
|
||||
SigPool undriven_signals;
|
||||
if (expose_mode)
|
||||
{
|
||||
SigMap sigmap(module);
|
||||
dict<SigBit, bool> wire_drivers;
|
||||
pool<SigBit> used_wires;
|
||||
SigPool undriven_signals;
|
||||
|
||||
for (auto &it : module->wires_)
|
||||
undriven_signals.add(sigmap(it.second));
|
||||
for (auto cell : module->cells())
|
||||
for (auto &conn : cell->connections()) {
|
||||
SigSpec sig = sigmap(conn.second);
|
||||
if (cell->input(conn.first))
|
||||
for (auto bit : sig)
|
||||
if (bit.wire)
|
||||
used_wires.insert(bit);
|
||||
if (cell->output(conn.first))
|
||||
for (int i = 0; i < GetSize(sig); i++)
|
||||
if (sig[i].wire)
|
||||
wire_drivers[sig[i]] = true;
|
||||
}
|
||||
|
||||
for (auto &it : module->wires_)
|
||||
if (it.second->port_input)
|
||||
undriven_signals.del(sigmap(it.second));
|
||||
for (auto wire : module->wires()) {
|
||||
if (wire->port_input) {
|
||||
SigSpec sig = sigmap(wire);
|
||||
for (int i = 0; i < GetSize(sig); i++)
|
||||
wire_drivers[sig[i]] = true;
|
||||
}
|
||||
if (wire->port_output) {
|
||||
SigSpec sig = sigmap(wire);
|
||||
for (auto bit : sig)
|
||||
if (bit.wire)
|
||||
used_wires.insert(bit);
|
||||
}
|
||||
}
|
||||
|
||||
CellTypes ct(design);
|
||||
for (auto &it : module->cells_)
|
||||
for (auto &conn : it.second->connections())
|
||||
if (!ct.cell_known(it.second->type) || ct.cell_output(it.second->type, conn.first))
|
||||
undriven_signals.del(sigmap(conn.second));
|
||||
pool<RTLIL::Wire*> undriven_wires;
|
||||
for (auto bit : used_wires)
|
||||
if (!wire_drivers.count(bit))
|
||||
undriven_wires.insert(bit.wire);
|
||||
|
||||
RTLIL::SigSpec sig = undriven_signals.export_all();
|
||||
for (auto &c : sig.chunks()) {
|
||||
RTLIL::SigSpec bits;
|
||||
if (worker.next_bit_mode == MODE_ANYSEQ)
|
||||
bits = module->Anyseq(NEW_ID, c.width);
|
||||
else if (worker.next_bit_mode == MODE_ANYCONST)
|
||||
bits = module->Anyconst(NEW_ID, c.width);
|
||||
else
|
||||
for (int i = 0; i < c.width; i++)
|
||||
bits.append(worker.next_bit());
|
||||
module->connect(RTLIL::SigSig(c, bits));
|
||||
for (auto &it : undriven_wires)
|
||||
undriven_signals.add(sigmap(it));
|
||||
|
||||
for (auto &it : undriven_wires)
|
||||
if (it->port_input)
|
||||
undriven_signals.del(sigmap(it));
|
||||
|
||||
CellTypes ct(design);
|
||||
for (auto &it : module->cells_)
|
||||
for (auto &conn : it.second->connections())
|
||||
if (!ct.cell_known(it.second->type) || ct.cell_output(it.second->type, conn.first))
|
||||
undriven_signals.del(sigmap(conn.second));
|
||||
|
||||
RTLIL::SigSpec sig = undriven_signals.export_all();
|
||||
for (auto &c : sig.chunks()) {
|
||||
RTLIL::Wire * wire;
|
||||
if (c.wire->width == c.width) {
|
||||
wire = c.wire;
|
||||
wire->port_input = true;
|
||||
} else {
|
||||
string name = c.wire->name.str() + "$[" + std::to_string(c.width + c.offset) + ":" + std::to_string(c.offset) + "]";
|
||||
wire = add_wire(module, name, c.width, true, false);
|
||||
module->connect(RTLIL::SigSig(c, wire));
|
||||
}
|
||||
log("Exposing undriven wire %s as input.\n", wire->name.c_str());
|
||||
}
|
||||
module->fixup_ports();
|
||||
}
|
||||
else
|
||||
{
|
||||
SigMap sigmap(module);
|
||||
SigPool undriven_signals;
|
||||
|
||||
for (auto &it : module->wires_)
|
||||
undriven_signals.add(sigmap(it.second));
|
||||
|
||||
for (auto &it : module->wires_)
|
||||
if (it.second->port_input)
|
||||
undriven_signals.del(sigmap(it.second));
|
||||
|
||||
CellTypes ct(design);
|
||||
for (auto &it : module->cells_)
|
||||
for (auto &conn : it.second->connections())
|
||||
if (!ct.cell_known(it.second->type) || ct.cell_output(it.second->type, conn.first))
|
||||
undriven_signals.del(sigmap(conn.second));
|
||||
|
||||
RTLIL::SigSpec sig = undriven_signals.export_all();
|
||||
for (auto &c : sig.chunks()) {
|
||||
RTLIL::SigSpec bits;
|
||||
if (worker.next_bit_mode == MODE_ANYSEQ)
|
||||
bits = module->Anyseq(NEW_ID, c.width);
|
||||
else if (worker.next_bit_mode == MODE_ANYCONST)
|
||||
bits = module->Anyconst(NEW_ID, c.width);
|
||||
else
|
||||
for (int i = 0; i < c.width; i++)
|
||||
bits.append(worker.next_bit());
|
||||
module->connect(RTLIL::SigSig(c, bits));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -573,7 +573,7 @@ struct ShowWorker
|
|||
|
||||
struct ShowPass : public Pass {
|
||||
ShowPass() : Pass("show", "generate schematics using graphviz") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -584,6 +584,7 @@ struct ShowPass : public Pass {
|
|||
log("\n");
|
||||
log(" -viewer <viewer>\n");
|
||||
log(" Run the specified command with the graphics file as parameter.\n");
|
||||
log(" On Windows, this pauses yosys until the viewer exits.\n");
|
||||
log("\n");
|
||||
log(" -format <format>\n");
|
||||
log(" Generate a graphics file in the specified format. Use 'dot' to just\n");
|
||||
|
@ -622,7 +623,7 @@ struct ShowPass : public Pass {
|
|||
log(" assigned to each unique value of this attribute.\n");
|
||||
log("\n");
|
||||
log(" -width\n");
|
||||
log(" annotate busses with a label indicating the width of the bus.\n");
|
||||
log(" annotate buses with a label indicating the width of the bus.\n");
|
||||
log("\n");
|
||||
log(" -signed\n");
|
||||
log(" mark ports (A, B) that are declared as signed (using the [AB]_SIGNED\n");
|
||||
|
@ -645,7 +646,7 @@ struct ShowPass : public Pass {
|
|||
log(" do not add the module name as graph title to the dot file\n");
|
||||
log("\n");
|
||||
log("When no <format> is specified, 'dot' is used. When no <format> and <viewer> is\n");
|
||||
log("specified, 'xdot' is used to display the schematic.\n");
|
||||
log("specified, 'xdot' is used to display the schematic (POSIX systems only).\n");
|
||||
log("\n");
|
||||
log("The generated output files are '~/.yosys_show.dot' and '~/.yosys_show.<format>',\n");
|
||||
log("unless another prefix is specified using -prefix <prefix>.\n");
|
||||
|
@ -655,7 +656,7 @@ struct ShowPass : public Pass {
|
|||
log("the 'show' command is executed.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
log_header(design, "Generating Graphviz representation of design.\n");
|
||||
log_push();
|
||||
|
@ -817,14 +818,30 @@ struct ShowPass : public Pass {
|
|||
log_cmd_error("Nothing there to show.\n");
|
||||
|
||||
if (format != "dot" && !format.empty()) {
|
||||
std::string cmd = stringf("dot -T%s '%s' > '%s.new' && mv '%s.new' '%s'", format.c_str(), dot_file.c_str(), out_file.c_str(), out_file.c_str(), out_file.c_str());
|
||||
#ifdef _WIN32
|
||||
// system()/cmd.exe does not understand single quotes on Windows.
|
||||
#define DOT_CMD "dot -T%s \"%s\" > \"%s.new\" && move \"%s.new\" \"%s\""
|
||||
#else
|
||||
#define DOT_CMD "dot -T%s '%s' > '%s.new' && mv '%s.new' '%s'"
|
||||
#endif
|
||||
std::string cmd = stringf(DOT_CMD, format.c_str(), dot_file.c_str(), out_file.c_str(), out_file.c_str(), out_file.c_str());
|
||||
#undef DOT_CMD
|
||||
log("Exec: %s\n", cmd.c_str());
|
||||
if (run_command(cmd) != 0)
|
||||
log_cmd_error("Shell command failed!\n");
|
||||
}
|
||||
|
||||
if (!viewer_exe.empty()) {
|
||||
std::string cmd = stringf("%s '%s' &", viewer_exe.c_str(), out_file.c_str());
|
||||
#ifdef _WIN32
|
||||
// system()/cmd.exe does not understand single quotes nor
|
||||
// background tasks on Windows. So we have to pause yosys
|
||||
// until the viewer exits.
|
||||
#define VIEW_CMD "%s \"%s\""
|
||||
#else
|
||||
#define VIEW_CMD "%s '%s' &"
|
||||
#endif
|
||||
std::string cmd = stringf(VIEW_CMD, viewer_exe.c_str(), out_file.c_str());
|
||||
#undef VIEW_CMD
|
||||
log("Exec: %s\n", cmd.c_str());
|
||||
if (run_command(cmd) != 0)
|
||||
log_cmd_error("Shell command failed!\n");
|
||||
|
|
|
@ -247,7 +247,7 @@ struct SpliceWorker
|
|||
|
||||
struct SplicePass : public Pass {
|
||||
SplicePass() : Pass("splice", "create explicit splicing cells") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -288,7 +288,7 @@ struct SplicePass : public Pass {
|
|||
log("by selected wires are rewired.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
bool sel_by_cell = false;
|
||||
bool sel_by_wire = false;
|
||||
|
|
|
@ -87,7 +87,7 @@ struct SplitnetsWorker
|
|||
|
||||
struct SplitnetsPass : public Pass {
|
||||
SplitnetsPass() : Pass("splitnets", "split up multi-bit nets") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -109,7 +109,7 @@ struct SplitnetsPass : public Pass {
|
|||
log(" and split nets so that no driver drives only part of a net.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
bool flag_ports = false;
|
||||
bool flag_driver = false;
|
||||
|
|
|
@ -209,7 +209,7 @@ void read_liberty_cellarea(dict<IdString, double> &cell_area, string liberty_fil
|
|||
|
||||
struct StatPass : public Pass {
|
||||
StatPass() : Pass("stat", "print some statistics") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -231,7 +231,7 @@ struct StatPass : public Pass {
|
|||
log(" e.g. $add_8 for an 8 bit wide $add cell.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
log_header(design, "Printing statistics.\n");
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct TeePass : public Pass {
|
||||
TeePass() : Pass("tee", "redirect command output to file") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -37,7 +37,7 @@ struct TeePass : public Pass {
|
|||
log("specified logfile(s).\n");
|
||||
log("\n");
|
||||
log(" -q\n");
|
||||
log(" Do not print output to the normal destination (console and/or log file)\n");
|
||||
log(" Do not print output to the normal destination (console and/or log file).\n");
|
||||
log("\n");
|
||||
log(" -o logfile\n");
|
||||
log(" Write output to this file, truncate if exists.\n");
|
||||
|
@ -46,10 +46,10 @@ struct TeePass : public Pass {
|
|||
log(" Write output to this file, append if exists.\n");
|
||||
log("\n");
|
||||
log(" +INT, -INT\n");
|
||||
log(" Add/subract INT from the -v setting for this command.\n");
|
||||
log(" Add/subtract INT from the -v setting for this command.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
std::vector<FILE*> backup_log_files, files_to_close;
|
||||
int backup_log_verbose_level = log_verbose_level;
|
||||
|
|
|
@ -27,7 +27,7 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct TorderPass : public Pass {
|
||||
TorderPass() : Pass("torder", "print cells in topological order") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -43,7 +43,7 @@ struct TorderPass : public Pass {
|
|||
log(" are not used in topological sorting. this option deactivates that.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
bool noautostop = false;
|
||||
dict<IdString, pool<IdString>> stop_db;
|
||||
|
|
|
@ -25,34 +25,34 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct TraceMonitor : public RTLIL::Monitor
|
||||
{
|
||||
virtual void notify_module_add(RTLIL::Module *module) YS_OVERRIDE
|
||||
void notify_module_add(RTLIL::Module *module) YS_OVERRIDE
|
||||
{
|
||||
log("#TRACE# Module add: %s\n", log_id(module));
|
||||
}
|
||||
|
||||
virtual void notify_module_del(RTLIL::Module *module) YS_OVERRIDE
|
||||
void notify_module_del(RTLIL::Module *module) YS_OVERRIDE
|
||||
{
|
||||
log("#TRACE# Module delete: %s\n", log_id(module));
|
||||
}
|
||||
|
||||
virtual void notify_connect(RTLIL::Cell *cell, const RTLIL::IdString &port, const RTLIL::SigSpec &old_sig, RTLIL::SigSpec &sig) YS_OVERRIDE
|
||||
void notify_connect(RTLIL::Cell *cell, const RTLIL::IdString &port, const RTLIL::SigSpec &old_sig, RTLIL::SigSpec &sig) YS_OVERRIDE
|
||||
{
|
||||
log("#TRACE# Cell connect: %s.%s.%s = %s (was: %s)\n", log_id(cell->module), log_id(cell), log_id(port), log_signal(sig), log_signal(old_sig));
|
||||
}
|
||||
|
||||
virtual void notify_connect(RTLIL::Module *module, const RTLIL::SigSig &sigsig) YS_OVERRIDE
|
||||
void notify_connect(RTLIL::Module *module, const RTLIL::SigSig &sigsig) YS_OVERRIDE
|
||||
{
|
||||
log("#TRACE# Connection in module %s: %s = %s\n", log_id(module), log_signal(sigsig.first), log_signal(sigsig.second));
|
||||
}
|
||||
|
||||
virtual void notify_connect(RTLIL::Module *module, const std::vector<RTLIL::SigSig> &sigsig_vec) YS_OVERRIDE
|
||||
void notify_connect(RTLIL::Module *module, const std::vector<RTLIL::SigSig> &sigsig_vec) YS_OVERRIDE
|
||||
{
|
||||
log("#TRACE# New connections in module %s:\n", log_id(module));
|
||||
for (auto &sigsig : sigsig_vec)
|
||||
log("## %s = %s\n", log_signal(sigsig.first), log_signal(sigsig.second));
|
||||
}
|
||||
|
||||
virtual void notify_blackout(RTLIL::Module *module) YS_OVERRIDE
|
||||
void notify_blackout(RTLIL::Module *module) YS_OVERRIDE
|
||||
{
|
||||
log("#TRACE# Blackout in module %s:\n", log_id(module));
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ struct TraceMonitor : public RTLIL::Monitor
|
|||
|
||||
struct TracePass : public Pass {
|
||||
TracePass() : Pass("trace", "redirect command output to file") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -70,7 +70,7 @@ struct TracePass : public Pass {
|
|||
log("the design in real time.\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||
{
|
||||
size_t argidx;
|
||||
for (argidx = 1; argidx < args.size(); argidx++)
|
||||
|
@ -95,4 +95,3 @@ struct TracePass : public Pass {
|
|||
} TracePass;
|
||||
|
||||
PRIVATE_NAMESPACE_END
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
struct WriteFileFrontend : public Frontend {
|
||||
WriteFileFrontend() : Frontend("=write_file", "write a text to a file") { }
|
||||
virtual void help()
|
||||
void help() YS_OVERRIDE
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
|
@ -44,7 +44,7 @@ struct WriteFileFrontend : public Frontend {
|
|||
log(" EOT\n");
|
||||
log("\n");
|
||||
}
|
||||
virtual void execute(std::istream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design*)
|
||||
void execute(std::istream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design*) YS_OVERRIDE
|
||||
{
|
||||
bool append_mode = false;
|
||||
std::string output_filename;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue