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);
entry.wirebit = bit.offset;
}
+ if (!srcsfile.empty())
+ sources.insert(entry.src.begin(), entry.src.end());
+
entry.mode = "inv";
database_add(database, opts, entry);
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()) {
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");
{
mutate_opts_t opts;
string filename;
+ string srcsfile;
int N = -1;
log_header(design, "Executing MUTATE pass.\n");
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;
extra_args(args, argidx, design);
if (N >= 0) {
- mutate_list(design, opts, filename, N);
+ mutate_list(design, opts, filename, srcsfile, N);
return;
}