diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-03-23 17:53:09 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2019-03-23 17:53:09 +0100 |
commit | 59c44bb61ab1a69a7ba4cd8d2b6d8d3e3408d9ca (patch) | |
tree | b8613e95627e7d8f64dc5cda17e5a96f1d1355b4 /passes | |
parent | 2cf71e2a7b053505ed80ad18c0e506c5f090b595 (diff) | |
download | yosys-59c44bb61ab1a69a7ba4cd8d2b6d8d3e3408d9ca.tar.gz yosys-59c44bb61ab1a69a7ba4cd8d2b6d8d3e3408d9ca.tar.bz2 yosys-59c44bb61ab1a69a7ba4cd8d2b6d8d3e3408d9ca.zip |
Add "mutate -s <filename>"
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'passes')
-rw-r--r-- | passes/sat/mutate.cc | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/passes/sat/mutate.cc b/passes/sat/mutate.cc index 9621d2855..7025a7aca 100644 --- a/passes/sat/mutate.cc +++ b/passes/sat/mutate.cc @@ -422,8 +422,9 @@ void database_reduce(std::vector<mutate_t> &database, const mutate_opts_t &opts, log("Covered %d/%d wire bits (%.2f%%).\n", covered_wirebit_cnt, GetSize(coverdb.wirebit_db), 100.0 * covered_wirebit_cnt / GetSize(coverdb.wirebit_db)); } -void mutate_list(Design *design, const mutate_opts_t &opts, const string &filename, int N) +void mutate_list(Design *design, const mutate_opts_t &opts, const string &filename, const string &srcsfile, int N) { + pool<string> sources; std::vector<mutate_t> database; xs128_t rng(opts.seed); @@ -497,6 +498,9 @@ void mutate_list(Design *design, const mutate_opts_t &opts, const string &filena entry.wirebit = bit.offset; } + if (!srcsfile.empty()) + sources.insert(entry.src.begin(), entry.src.end()); + entry.mode = "inv"; database_add(database, opts, entry); @@ -526,6 +530,16 @@ void mutate_list(Design *design, const mutate_opts_t &opts, const string &filena log("Reduced database size: %d\n", GetSize(database)); } + if (!srcsfile.empty()) { + std::ofstream sout; + sout.open(srcsfile, std::ios::out | std::ios::trunc); + if (!sout.is_open()) + log_error("Could not open file \"%s\" with write access.\n", srcsfile.c_str()); + sources.sort(); + for (auto &s : sources) + sout << s << std::endl; + } + std::ofstream fout; if (!filename.empty()) { @@ -710,6 +724,9 @@ struct MutatePass : public Pass { log(" -o filename\n"); log(" Write list to this file instead of console output\n"); log("\n"); + log(" -s filename\n"); + log(" Write a list of all src tags found in the design to the specified file\n"); + log("\n"); log(" -seed N\n"); log(" RNG seed for selecting mutations\n"); log("\n"); @@ -761,6 +778,7 @@ struct MutatePass : public Pass { { mutate_opts_t opts; string filename; + string srcsfile; int N = -1; log_header(design, "Executing MUTATE pass.\n"); @@ -776,6 +794,10 @@ struct MutatePass : public Pass { filename = args[++argidx]; continue; } + if (args[argidx] == "-s" && argidx+1 < args.size()) { + srcsfile = args[++argidx]; + continue; + } if (args[argidx] == "-seed" && argidx+1 < args.size()) { opts.seed = atoi(args[++argidx].c_str()); continue; @@ -879,7 +901,7 @@ struct MutatePass : public Pass { extra_args(args, argidx, design); if (N >= 0) { - mutate_list(design, opts, filename, N); + mutate_list(design, opts, filename, srcsfile, N); return; } |