mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
Add "mutate -none -mode", "mutate -mode none"
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
59c44bb61a
commit
ccfa2fe01c
|
@ -46,6 +46,8 @@ struct mutate_opts_t {
|
||||||
IdString ctrl_name;
|
IdString ctrl_name;
|
||||||
int ctrl_width = -1, ctrl_value = -1;
|
int ctrl_width = -1, ctrl_value = -1;
|
||||||
|
|
||||||
|
bool none = false;
|
||||||
|
|
||||||
int pick_cover_prcnt = 80;
|
int pick_cover_prcnt = 80;
|
||||||
|
|
||||||
int weight_cover = 500;
|
int weight_cover = 500;
|
||||||
|
@ -526,7 +528,7 @@ void mutate_list(Design *design, const mutate_opts_t &opts, const string &filena
|
||||||
|
|
||||||
log("Raw database size: %d\n", GetSize(database));
|
log("Raw database size: %d\n", GetSize(database));
|
||||||
if (N != 0) {
|
if (N != 0) {
|
||||||
database_reduce(database, opts, N, rng);
|
database_reduce(database, opts, opts.none ? N-1 : N, rng);
|
||||||
log("Reduced database size: %d\n", GetSize(database));
|
log("Reduced database size: %d\n", GetSize(database));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,6 +552,17 @@ void mutate_list(Design *design, const mutate_opts_t &opts, const string &filena
|
||||||
|
|
||||||
int ctrl_value = opts.ctrl_value;
|
int ctrl_value = opts.ctrl_value;
|
||||||
|
|
||||||
|
if (opts.none) {
|
||||||
|
string str = "mutate";
|
||||||
|
if (!opts.ctrl_name.empty())
|
||||||
|
str += stringf(" -ctrl %s %d %d", log_id(opts.ctrl_name), opts.ctrl_width, ctrl_value++);
|
||||||
|
str += " -mode none";
|
||||||
|
if (filename.empty())
|
||||||
|
log("%s\n", str.c_str());
|
||||||
|
else
|
||||||
|
fout << str << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto &entry : database) {
|
for (auto &entry : database) {
|
||||||
string str = "mutate";
|
string str = "mutate";
|
||||||
if (!opts.ctrl_name.empty())
|
if (!opts.ctrl_name.empty())
|
||||||
|
@ -730,6 +743,9 @@ struct MutatePass : public Pass {
|
||||||
log(" -seed N\n");
|
log(" -seed N\n");
|
||||||
log(" RNG seed for selecting mutations\n");
|
log(" RNG seed for selecting mutations\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" -none\n");
|
||||||
|
log(" Include a \"none\" mutation in the output\n");
|
||||||
|
log("\n");
|
||||||
log(" -ctrl name width value\n");
|
log(" -ctrl name width value\n");
|
||||||
log(" Add -ctrl options to the output. Use 'value' for first mutation, then\n");
|
log(" Add -ctrl options to the output. Use 'value' for first mutation, then\n");
|
||||||
log(" simply count up from there.\n");
|
log(" simply count up from there.\n");
|
||||||
|
@ -802,6 +818,10 @@ struct MutatePass : public Pass {
|
||||||
opts.seed = atoi(args[++argidx].c_str());
|
opts.seed = atoi(args[++argidx].c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (args[argidx] == "-none") {
|
||||||
|
opts.none = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (args[argidx] == "-mode" && argidx+1 < args.size()) {
|
if (args[argidx] == "-mode" && argidx+1 < args.size()) {
|
||||||
opts.mode = args[++argidx];
|
opts.mode = args[++argidx];
|
||||||
continue;
|
continue;
|
||||||
|
@ -905,6 +925,15 @@ struct MutatePass : public Pass {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opts.mode == "none") {
|
||||||
|
if (!opts.ctrl_name.empty()) {
|
||||||
|
Module *topmod = opts.module.empty() ? design->top_module() : design->module(opts.module);
|
||||||
|
if (topmod)
|
||||||
|
mutate_ctrl_sig(topmod, opts.ctrl_name, opts.ctrl_width);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (opts.mode == "inv") {
|
if (opts.mode == "inv") {
|
||||||
mutate_inv(design, opts);
|
mutate_inv(design, opts);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue