mirror of https://github.com/YosysHQ/yosys.git
Added "test_cell -nosat"
This commit is contained in:
parent
9329a76818
commit
15b3c54fea
|
@ -53,7 +53,7 @@ static void create_gold_module(RTLIL::Design *design, RTLIL::IdString cell_type,
|
||||||
for (int i = 0; i < depth; i++)
|
for (int i = 0; i < depth; i++)
|
||||||
{
|
{
|
||||||
int size_a = xorshift32(width) + 1;
|
int size_a = xorshift32(width) + 1;
|
||||||
int size_b = xorshift32(width) + 1;
|
int size_b = depth > 4 ? 0 : xorshift32(width) + 1;
|
||||||
|
|
||||||
if (mulbits_a + size_a*size_b <= 96 && mulbits_b + size_a + size_b <= 16 && xorshift32(2) == 1) {
|
if (mulbits_a + size_a*size_b <= 96 && mulbits_b + size_a + size_b <= 16 && xorshift32(2) == 1) {
|
||||||
mulbits_a += size_a * size_b;
|
mulbits_a += size_a * size_b;
|
||||||
|
@ -75,7 +75,7 @@ static void create_gold_module(RTLIL::Design *design, RTLIL::IdString cell_type,
|
||||||
}
|
}
|
||||||
|
|
||||||
wire = module->addWire("\\B");
|
wire = module->addWire("\\B");
|
||||||
wire->width = xorshift32(xorshift32(16)+1);
|
wire->width = xorshift32(mulbits_a ? xorshift32(4)+1 : xorshift32(16)+1);
|
||||||
wire->port_input = true;
|
wire->port_input = true;
|
||||||
macc.bit_ports = wire;
|
macc.bit_ports = wire;
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ static void create_gold_module(RTLIL::Design *design, RTLIL::IdString cell_type,
|
||||||
cell->check();
|
cell->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void run_eval_test(RTLIL::Design *design, bool verbose, std::string uut_name, std::ofstream &vlog_file)
|
static void run_eval_test(RTLIL::Design *design, bool verbose, bool nosat, std::string uut_name, std::ofstream &vlog_file)
|
||||||
{
|
{
|
||||||
log("Eval testing:%c", verbose ? '\n' : ' ');
|
log("Eval testing:%c", verbose ? '\n' : ' ');
|
||||||
|
|
||||||
|
@ -185,6 +185,7 @@ static void run_eval_test(RTLIL::Design *design, bool verbose, std::string uut_n
|
||||||
SatGen satgen2(&ez2, &sigmap);
|
SatGen satgen2(&ez2, &sigmap);
|
||||||
satgen2.model_undef = true;
|
satgen2.model_undef = true;
|
||||||
|
|
||||||
|
if (!nosat)
|
||||||
for (auto cell : gold_mod->cells()) {
|
for (auto cell : gold_mod->cells()) {
|
||||||
satgen1.importCell(cell);
|
satgen1.importCell(cell);
|
||||||
satgen2.importCell(cell);
|
satgen2.importCell(cell);
|
||||||
|
@ -325,6 +326,8 @@ static void run_eval_test(RTLIL::Design *design, bool verbose, std::string uut_n
|
||||||
if (verbose)
|
if (verbose)
|
||||||
log("EVAL: %s\n", out_val.as_string().c_str());
|
log("EVAL: %s\n", out_val.as_string().c_str());
|
||||||
|
|
||||||
|
if (!nosat)
|
||||||
|
{
|
||||||
std::vector<int> sat1_in_sig = satgen1.importSigSpec(in_sig);
|
std::vector<int> sat1_in_sig = satgen1.importSigSpec(in_sig);
|
||||||
std::vector<int> sat1_in_val = satgen1.importSigSpec(in_val);
|
std::vector<int> sat1_in_val = satgen1.importSigSpec(in_val);
|
||||||
|
|
||||||
|
@ -389,6 +392,7 @@ static void run_eval_test(RTLIL::Design *design, bool verbose, std::string uut_n
|
||||||
log_error("Mismatch in sat model 2 (undef modeling) output!\n");
|
log_error("Mismatch in sat model 2 (undef modeling) output!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (vlog_file.is_open()) {
|
if (vlog_file.is_open()) {
|
||||||
vlog_file << stringf(" end\n");
|
vlog_file << stringf(" end\n");
|
||||||
|
@ -432,6 +436,9 @@ struct TestCellPass : public Pass {
|
||||||
log(" -script {script_file}\n");
|
log(" -script {script_file}\n");
|
||||||
log(" instead of calling \"techmap\", call \"script {script_file}\".\n");
|
log(" instead of calling \"techmap\", call \"script {script_file}\".\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" -nosat\n");
|
||||||
|
log(" do not check SAT model or run SAT equivalence checking\n");
|
||||||
|
log("\n");
|
||||||
log(" -v\n");
|
log(" -v\n");
|
||||||
log(" print additional debug information to the console\n");
|
log(" print additional debug information to the console\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
@ -447,6 +454,7 @@ struct TestCellPass : public Pass {
|
||||||
xorshift32_state = 0;
|
xorshift32_state = 0;
|
||||||
std::ofstream vlog_file;
|
std::ofstream vlog_file;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
|
bool nosat = false;
|
||||||
|
|
||||||
int argidx;
|
int argidx;
|
||||||
for (argidx = 1; argidx < SIZE(args); argidx++)
|
for (argidx = 1; argidx < SIZE(args); argidx++)
|
||||||
|
@ -476,6 +484,10 @@ struct TestCellPass : public Pass {
|
||||||
techmap_cmd = "techmap -map +/simlib.v -max_iter 2 -autoproc";
|
techmap_cmd = "techmap -map +/simlib.v -max_iter 2 -autoproc";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (args[argidx] == "-nosat") {
|
||||||
|
nosat = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (args[argidx] == "-v") {
|
if (args[argidx] == "-v") {
|
||||||
verbose = true;
|
verbose = true;
|
||||||
continue;
|
continue;
|
||||||
|
@ -600,10 +612,12 @@ struct TestCellPass : public Pass {
|
||||||
else
|
else
|
||||||
create_gold_module(design, cell_type, cell_types.at(cell_type));
|
create_gold_module(design, cell_type, cell_types.at(cell_type));
|
||||||
Pass::call(design, stringf("copy gold gate; cd gate; %s; cd ..; opt -fast gate", techmap_cmd.c_str()));
|
Pass::call(design, stringf("copy gold gate; cd gate; %s; cd ..; opt -fast gate", techmap_cmd.c_str()));
|
||||||
|
if (!nosat)
|
||||||
Pass::call(design, "miter -equiv -flatten -make_outputs -ignore_gold_x gold gate miter");
|
Pass::call(design, "miter -equiv -flatten -make_outputs -ignore_gold_x gold gate miter");
|
||||||
if (verbose)
|
if (verbose)
|
||||||
Pass::call(design, "dump gate");
|
Pass::call(design, "dump gate");
|
||||||
Pass::call(design, "dump gold");
|
Pass::call(design, "dump gold");
|
||||||
|
if (!nosat)
|
||||||
Pass::call(design, "sat -verify -enable_undef -prove trigger 0 -show-inputs -show-outputs miter");
|
Pass::call(design, "sat -verify -enable_undef -prove trigger 0 -show-inputs -show-outputs miter");
|
||||||
std::string uut_name = stringf("uut_%s_%d", cell_type.substr(1).c_str(), i);
|
std::string uut_name = stringf("uut_%s_%d", cell_type.substr(1).c_str(), i);
|
||||||
if (vlog_file.is_open()) {
|
if (vlog_file.is_open()) {
|
||||||
|
@ -613,7 +627,7 @@ struct TestCellPass : public Pass {
|
||||||
Backend::backend_call(design, &vlog_file, "<test_cell -vlog>", "verilog -selected -noexpr");
|
Backend::backend_call(design, &vlog_file, "<test_cell -vlog>", "verilog -selected -noexpr");
|
||||||
uut_names.push_back(uut_name);
|
uut_names.push_back(uut_name);
|
||||||
}
|
}
|
||||||
run_eval_test(design, verbose, uut_name, vlog_file);
|
run_eval_test(design, verbose, nosat, uut_name, vlog_file);
|
||||||
delete design;
|
delete design;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue