Added "sat -tempinduct-baseonly -tempinduct-inductonly"

This commit is contained in:
Clifford Wolf 2015-02-21 17:53:22 +01:00
parent dcbd00c101
commit 1688b9b464
1 changed files with 94 additions and 68 deletions

View File

@ -984,6 +984,12 @@ struct SatPass : public Pass {
log(" Perform a temporal induction proof. Assume an initial state with all\n"); log(" Perform a temporal induction proof. Assume an initial state with all\n");
log(" registers set to defined values for the induction step.\n"); log(" registers set to defined values for the induction step.\n");
log("\n"); log("\n");
log(" -tempinduct-baseonly\n");
log(" Run only the basecase half of temporal induction (requires -maxsteps)\n");
log("\n");
log(" -tempinduct-inductonly\n");
log(" Run only the induction half of temporal induction\n");
log("\n");
log(" -prove <signal> <value>\n"); log(" -prove <signal> <value>\n");
log(" Attempt to proof that <signal> is always <value>.\n"); log(" Attempt to proof that <signal> is always <value>.\n");
log("\n"); log("\n");
@ -1030,6 +1036,7 @@ struct SatPass : public Pass {
bool ignore_div_by_zero = false, set_init_undef = false, set_init_zero = false, max_undef = false; bool ignore_div_by_zero = false, set_init_undef = false, set_init_zero = false, max_undef = false;
bool tempinduct = false, prove_asserts = false, show_inputs = false, show_outputs = false; bool tempinduct = false, prove_asserts = false, show_inputs = false, show_outputs = false;
bool ignore_unknown_cells = false, falsify = false, tempinduct_def = false, set_init_def = false; bool ignore_unknown_cells = false, falsify = false, tempinduct_def = false, set_init_def = false;
bool tempinduct_baseonly = false, tempinduct_inductonly = false;
std::string vcd_file_name, json_file_name, cnf_file_name; std::string vcd_file_name, json_file_name, cnf_file_name;
log_header("Executing SAT pass (solving SAT problems in the circuit).\n"); log_header("Executing SAT pass (solving SAT problems in the circuit).\n");
@ -1122,6 +1129,16 @@ struct SatPass : public Pass {
tempinduct_def = true; tempinduct_def = true;
continue; continue;
} }
if (args[argidx] == "-tempinduct-baseonly") {
tempinduct = true;
tempinduct_baseonly = true;
continue;
}
if (args[argidx] == "-tempinduct-inductonly") {
tempinduct = true;
tempinduct_inductonly = true;
continue;
}
if (args[argidx] == "-prove" && argidx+2 < args.size()) { if (args[argidx] == "-prove" && argidx+2 < args.size()) {
std::string lhs = args[++argidx]; std::string lhs = args[++argidx];
std::string rhs = args[++argidx]; std::string rhs = args[++argidx];
@ -1305,6 +1322,7 @@ struct SatPass : public Pass {
basecase.ignore_unknown_cells = ignore_unknown_cells; basecase.ignore_unknown_cells = ignore_unknown_cells;
for (int timestep = 1; timestep <= seq_len; timestep++) for (int timestep = 1; timestep <= seq_len; timestep++)
if (!tempinduct_inductonly)
basecase.setup(timestep); basecase.setup(timestep);
inductstep.sets = sets; inductstep.sets = sets;
@ -1319,8 +1337,10 @@ struct SatPass : public Pass {
inductstep.satgen.ignore_div_by_zero = ignore_div_by_zero; inductstep.satgen.ignore_div_by_zero = ignore_div_by_zero;
inductstep.ignore_unknown_cells = ignore_unknown_cells; inductstep.ignore_unknown_cells = ignore_unknown_cells;
if (!tempinduct_baseonly) {
inductstep.setup(1); inductstep.setup(1);
inductstep.ez->assume(inductstep.setup_proof(1)); inductstep.ez->assume(inductstep.setup_proof(1));
}
if (tempinduct_def) { if (tempinduct_def) {
std::vector<int> undef_state = inductstep.satgen.importUndefSigSpec(inductstep.satgen.initial_state.export_all(), 1); std::vector<int> undef_state = inductstep.satgen.importUndefSigSpec(inductstep.satgen.initial_state.export_all(), 1);
@ -1333,6 +1353,8 @@ struct SatPass : public Pass {
// phase 1: proving base case // phase 1: proving base case
if (!tempinduct_inductonly)
{
basecase.setup(seq_len + inductlen); basecase.setup(seq_len + inductlen);
int property = basecase.setup_proof(seq_len + inductlen); int property = basecase.setup_proof(seq_len + inductlen);
basecase.generate_model(); basecase.generate_model();
@ -1364,11 +1386,14 @@ struct SatPass : public Pass {
log("Base case for induction length %d proven.\n", inductlen); log("Base case for induction length %d proven.\n", inductlen);
basecase.ez->assume(property); basecase.ez->assume(property);
}
// phase 2: proving induction step // phase 2: proving induction step
if (!tempinduct_baseonly)
{
inductstep.setup(inductlen + 1); inductstep.setup(inductlen + 1);
property = inductstep.setup_proof(inductlen + 1); int property = inductstep.setup_proof(inductlen + 1);
inductstep.generate_model(); inductstep.generate_model();
if (inductlen > 1) if (inductlen > 1)
@ -1411,6 +1436,7 @@ struct SatPass : public Pass {
inductstep.print_model(); inductstep.print_model();
} }
} }
}
log("\nReached maximum number of time steps -> proof failed.\n"); log("\nReached maximum number of time steps -> proof failed.\n");
if(!vcd_file_name.empty()) if(!vcd_file_name.empty())