mirror of
https://github.com/YosysHQ/yosys
synced 2025-11-13 17:41:17 +00:00
Merge 2cee76bfd5 into 4011d72656
This commit is contained in:
commit
8b5dc7d68e
65 changed files with 409 additions and 152 deletions
|
|
@ -151,9 +151,6 @@ struct BugpointPass : public Pass {
|
|||
if (grep.empty())
|
||||
return true;
|
||||
|
||||
if (grep.size() > 2 && grep.front() == '"' && grep.back() == '"')
|
||||
grep = grep.substr(1, grep.size() - 2);
|
||||
|
||||
string bugpoint_file = "bugpoint-case";
|
||||
if (suffix.size())
|
||||
bugpoint_file += stringf(".%.8s", suffix);
|
||||
|
|
@ -473,13 +470,13 @@ struct BugpointPass : public Pass {
|
|||
if (args[argidx] == "-script" && argidx + 1 < args.size()) {
|
||||
if (!yosys_arg.empty())
|
||||
log_cmd_error("A -script or -command option can be only provided once!\n");
|
||||
yosys_arg = stringf("-s %s", args[++argidx]);
|
||||
yosys_arg = stringf("-s %s", quote(args[++argidx]));
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-command" && argidx + 1 < args.size()) {
|
||||
if (!yosys_arg.empty())
|
||||
log_cmd_error("A -script or -command option can be only provided once!\n");
|
||||
yosys_arg = stringf("-p %s", args[++argidx]);
|
||||
yosys_arg = stringf("-p %s", quote(args[++argidx]));
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-grep" && argidx + 1 < args.size()) {
|
||||
|
|
@ -552,18 +549,10 @@ struct BugpointPass : public Pass {
|
|||
}
|
||||
if (args[argidx] == "-runner" && argidx + 1 < args.size()) {
|
||||
runner = args[++argidx];
|
||||
if (runner.size() && runner.at(0) == '"') {
|
||||
log_assert(runner.back() == '"');
|
||||
runner = runner.substr(1, runner.size() - 2);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-suffix" && argidx + 1 < args.size()) {
|
||||
suffix = args[++argidx];
|
||||
if (suffix.size() && suffix.at(0) == '"') {
|
||||
log_assert(suffix.back() == '"');
|
||||
suffix = suffix.substr(1, suffix.size() - 2);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ struct LoggerPass : public Pass {
|
|||
}
|
||||
if (args[argidx] == "-warn" && argidx+1 < args.size()) {
|
||||
std::string pattern = args[++argidx];
|
||||
if (pattern.front() == '\"' && pattern.back() == '\"') pattern = pattern.substr(1, pattern.size() - 2);
|
||||
try {
|
||||
log("Added regex '%s' for warnings to warn list.\n", pattern);
|
||||
log_warn_regexes.push_back(YS_REGEX_COMPILE(pattern));
|
||||
|
|
@ -118,7 +117,6 @@ struct LoggerPass : public Pass {
|
|||
}
|
||||
if (args[argidx] == "-nowarn" && argidx+1 < args.size()) {
|
||||
std::string pattern = args[++argidx];
|
||||
if (pattern.front() == '\"' && pattern.back() == '\"') pattern = pattern.substr(1, pattern.size() - 2);
|
||||
try {
|
||||
log("Added regex '%s' for warnings to nowarn list.\n", pattern);
|
||||
log_nowarn_regexes.push_back(YS_REGEX_COMPILE(pattern));
|
||||
|
|
@ -130,7 +128,6 @@ struct LoggerPass : public Pass {
|
|||
}
|
||||
if (args[argidx] == "-werror" && argidx+1 < args.size()) {
|
||||
std::string pattern = args[++argidx];
|
||||
if (pattern.front() == '\"' && pattern.back() == '\"') pattern = pattern.substr(1, pattern.size() - 2);
|
||||
try {
|
||||
log("Added regex '%s' for warnings to werror list.\n", pattern);
|
||||
log_werror_regexes.push_back(YS_REGEX_COMPILE(pattern));
|
||||
|
|
@ -164,7 +161,6 @@ struct LoggerPass : public Pass {
|
|||
if ((type=="error" || type=="prefix-error") && log_expect_error.size()>0)
|
||||
log_cmd_error("Only single error message can be expected !\n");
|
||||
std::string pattern = args[++argidx];
|
||||
if (pattern.front() == '\"' && pattern.back() == '\"') pattern = pattern.substr(1, pattern.size() - 2);
|
||||
int count = atoi(args[++argidx].c_str());
|
||||
if (count<=0)
|
||||
log_cmd_error("Number of expected messages must be higher then 0 !\n");
|
||||
|
|
|
|||
|
|
@ -89,7 +89,6 @@ struct ScratchpadPass : public Pass {
|
|||
if (RTLIL::constpad.count(identifier))
|
||||
log_error("scratchpad entry \"%s\" is a global constant\n", identifier);
|
||||
string value = args[++argidx];
|
||||
if (value.front() == '\"' && value.back() == '\"') value = value.substr(1, value.size() - 2);
|
||||
design->scratchpad_set_string(identifier, value);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -116,7 +115,6 @@ struct ScratchpadPass : public Pass {
|
|||
if (args[argidx] == "-assert" && argidx+2 < args.size()) {
|
||||
string identifier = args[++argidx];
|
||||
string expected = args[++argidx];
|
||||
if (expected.front() == '\"' && expected.back() == '\"') expected = expected.substr(1, expected.size() - 2);
|
||||
if (design->scratchpad.count(identifier) == 0)
|
||||
log_error("scratchpad entry '%s' is not defined\n", identifier);
|
||||
string value = design->scratchpad_get_string(identifier);
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ struct setunset_t
|
|||
|
||||
setunset_t(std::string unset_name) : name(RTLIL::escape_id(unset_name)), value(), unset(true) { }
|
||||
|
||||
setunset_t(std::string set_name, std::string set_value) : name(RTLIL::escape_id(set_name)), value(), unset(false)
|
||||
setunset_t(std::string set_name, std::string set_value, bool is_str) : name(RTLIL::escape_id(set_name)), value(), unset(false)
|
||||
{
|
||||
if (set_value.compare(0, 1, "\"") == 0 && set_value.compare(GetSize(set_value)-1, std::string::npos, "\"") == 0) {
|
||||
value = RTLIL::Const(set_value.substr(1, GetSize(set_value)-2));
|
||||
if (is_str) {
|
||||
value = RTLIL::Const(set_value);
|
||||
} else {
|
||||
RTLIL::SigSpec sig_value;
|
||||
if (!RTLIL::SigSpec::parse(sig_value, nullptr, set_value))
|
||||
|
|
@ -60,13 +60,22 @@ struct SetattrPass : public Pass {
|
|||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
log(" setattr [ -mod ] [ -set name value | -unset name ]... [selection]\n");
|
||||
log(" setattr [options] [selection]\n");
|
||||
log("\n");
|
||||
log("Set/unset the given attributes on the selected objects. String values must be\n");
|
||||
log("passed in double quotes (\").\n");
|
||||
log("Set/unset attributes on the selected objects.\n");
|
||||
log("\n");
|
||||
log("When called with -mod, this command will set and unset attributes on modules\n");
|
||||
log("instead of objects within modules.\n");
|
||||
log(" -mod\n");
|
||||
log(" apply changes to modules instead of objects within modules\n");
|
||||
log("\n");
|
||||
log(" -set <name> <value>\n");
|
||||
log(" -setstr <name> <strvalue>\n");
|
||||
log(" set the named attribute to the given value, string values must use\n");
|
||||
log(" the -setstr option\n");
|
||||
log("\n");
|
||||
log(" -unset <name>\n");
|
||||
log(" unset the named attribute\n");
|
||||
log("\n");
|
||||
log("The options -setstr, -set, and -unset can be specified multiple times.\n");
|
||||
log("\n");
|
||||
}
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) override
|
||||
|
|
@ -78,10 +87,10 @@ struct SetattrPass : public Pass {
|
|||
for (argidx = 1; argidx < args.size(); argidx++)
|
||||
{
|
||||
std::string arg = args[argidx];
|
||||
if (arg == "-set" && argidx+2 < args.size()) {
|
||||
if ((arg == "-set" || arg == "-setstr") && argidx+2 < args.size()) {
|
||||
string set_key = args[++argidx];
|
||||
string set_val = args[++argidx];
|
||||
setunset_list.push_back(setunset_t(set_key, set_val));
|
||||
setunset_list.push_back(setunset_t(set_key, set_val, arg == "-setstr"));
|
||||
continue;
|
||||
}
|
||||
if (arg == "-unset" && argidx+1 < args.size()) {
|
||||
|
|
@ -147,12 +156,22 @@ struct SetparamPass : public Pass {
|
|||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
log(" setparam [ -type cell_type ] [ -set name value | -unset name ]... [selection]\n");
|
||||
log(" setparam [options] [selection]\n");
|
||||
log("\n");
|
||||
log("Set/unset the given parameters on the selected cells. String values must be\n");
|
||||
log("passed in double quotes (\").\n");
|
||||
log("Set/unset parameters on the selected cells.\n");
|
||||
log("\n");
|
||||
log("The -type option can be used to change the cell type of the selected cells.\n");
|
||||
log(" -type\n");
|
||||
log(" change the cell type of the selected cells\n");
|
||||
log("\n");
|
||||
log(" -set <name> <value>\n");
|
||||
log(" -setstr <name> <strvalue>\n");
|
||||
log(" set the named parameter to the given value, string values must use\n");
|
||||
log(" the -setstr option\n");
|
||||
log("\n");
|
||||
log(" -unset <name>\n");
|
||||
log(" unset the named parameter\n");
|
||||
log("\n");
|
||||
log("The options -setstr, -set, and -unset can be specified multiple times.\n");
|
||||
log("\n");
|
||||
}
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) override
|
||||
|
|
@ -164,10 +183,10 @@ struct SetparamPass : public Pass {
|
|||
for (argidx = 1; argidx < args.size(); argidx++)
|
||||
{
|
||||
std::string arg = args[argidx];
|
||||
if (arg == "-set" && argidx+2 < args.size()) {
|
||||
if ((arg == "-set" || arg == "-setstr") && argidx+2 < args.size()) {
|
||||
string set_key = args[++argidx];
|
||||
string set_val = args[++argidx];
|
||||
setunset_list.push_back(setunset_t(set_key, set_val));
|
||||
setunset_list.push_back(setunset_t(set_key, set_val, arg == "-setstr"));
|
||||
continue;
|
||||
}
|
||||
if (arg == "-unset" && argidx+1 < args.size()) {
|
||||
|
|
@ -199,10 +218,10 @@ struct ChparamPass : public Pass {
|
|||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
log(" chparam [ -set name value ]... [selection]\n");
|
||||
log(" chparam [ -set[str] name value ]... [selection]\n");
|
||||
log("\n");
|
||||
log("Re-evaluate the selected modules with new parameters. String values must be\n");
|
||||
log("passed in double quotes (\").\n");
|
||||
log("Re-evaluate the selected modules with new parameters. String values must use\n");
|
||||
log("the -setstr option.\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
log(" chparam -list [selection]\n");
|
||||
|
|
@ -220,10 +239,10 @@ struct ChparamPass : public Pass {
|
|||
for (argidx = 1; argidx < args.size(); argidx++)
|
||||
{
|
||||
std::string arg = args[argidx];
|
||||
if (arg == "-set" && argidx+2 < args.size()) {
|
||||
if ((arg == "-set" || arg == "-setstr") && argidx+2 < args.size()) {
|
||||
string set_key = args[++argidx];
|
||||
string set_val = args[++argidx];
|
||||
setunset_list.push_back(setunset_t(set_key, set_val));
|
||||
setunset_list.push_back(setunset_t(set_key, set_val, arg == "-setstr"));
|
||||
continue;
|
||||
}
|
||||
if (arg == "-list") {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ struct SetenvPass : public Pass {
|
|||
|
||||
std::string name = args[1];
|
||||
std::string value = args[2];
|
||||
if (value.front() == '\"' && value.back() == '\"') value = value.substr(1, value.size() - 2);
|
||||
|
||||
#if defined(_WIN32)
|
||||
_putenv_s(name.c_str(), value.c_str());
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ struct Abc9Pass : public ScriptPass
|
|||
// then select all its fanins
|
||||
// then select all fanouts of all that
|
||||
// lastly remove $_DFF_[NP]_ cells
|
||||
run("setattr -set submod \"$abc9_flop\" t:$_DFF_?_ %ci* %co* t:$_DFF_?_ %d", " (only if -dff)");
|
||||
run("setattr -setstr submod \"$abc9_flop\" t:$_DFF_?_ %ci* %co* t:$_DFF_?_ %d", " (only if -dff)");
|
||||
run("submod", " (only if -dff)");
|
||||
run("setattr -mod -set whitebox 1 -set abc9_flop 1 -set abc9_box 1 *_$abc9_flop", "(only if -dff)");
|
||||
if (help_mode) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue