Merge pull request #1433 from YosysHQ/eddie/equiv_opt_async2sync

async2sync to be called by equiv_opt only when -async2sync given
This commit is contained in:
Eddie Hung 2019-10-08 10:53:44 -07:00 committed by GitHub
commit 4c89a4e642
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 13 deletions

View File

@ -50,6 +50,9 @@ struct EquivOptPass:public ScriptPass
log(" -multiclock\n"); log(" -multiclock\n");
log(" run clk2fflogic before equivalence checking.\n"); log(" run clk2fflogic before equivalence checking.\n");
log("\n"); log("\n");
log(" -async2sync\n");
log(" run async2sync before equivalence checking.\n");
log("\n");
log(" -undef\n"); log(" -undef\n");
log(" enable modelling of undef states during equiv_induct.\n"); log(" enable modelling of undef states during equiv_induct.\n");
log("\n"); log("\n");
@ -59,7 +62,7 @@ struct EquivOptPass:public ScriptPass
} }
std::string command, techmap_opts; std::string command, techmap_opts;
bool assert, undef, multiclock; bool assert, undef, multiclock, async2sync;
void clear_flags() YS_OVERRIDE void clear_flags() YS_OVERRIDE
{ {
@ -68,6 +71,7 @@ struct EquivOptPass:public ScriptPass
assert = false; assert = false;
undef = false; undef = false;
multiclock = false; multiclock = false;
async2sync = false;
} }
void execute(std::vector < std::string > args, RTLIL::Design * design) YS_OVERRIDE void execute(std::vector < std::string > args, RTLIL::Design * design) YS_OVERRIDE
@ -101,6 +105,10 @@ struct EquivOptPass:public ScriptPass
multiclock = true; multiclock = true;
continue; continue;
} }
if (args[argidx] == "-async2sync") {
async2sync = true;
continue;
}
break; break;
} }
@ -120,6 +128,9 @@ struct EquivOptPass:public ScriptPass
if (!design->full_selection()) if (!design->full_selection())
log_cmd_error("This command only operates on fully selected designs!\n"); log_cmd_error("This command only operates on fully selected designs!\n");
if (async2sync && multiclock)
log_cmd_error("The '-async2sync' and '-multiclock' options are mutually exclusive!\n");
log_header(design, "Executing EQUIV_OPT pass.\n"); log_header(design, "Executing EQUIV_OPT pass.\n");
log_push(); log_push();
@ -157,8 +168,8 @@ struct EquivOptPass:public ScriptPass
if (check_label("prove")) { if (check_label("prove")) {
if (multiclock || help_mode) if (multiclock || help_mode)
run("clk2fflogic", "(only with -multiclock)"); run("clk2fflogic", "(only with -multiclock)");
if (!multiclock || help_mode) if (async2sync || help_mode)
run("async2sync", "(only without -multiclock)"); run("async2sync", " (only with -async2sync)");
run("equiv_make gold gate equiv"); run("equiv_make gold gate equiv");
if (help_mode) if (help_mode)
run("equiv_induct [-undef] equiv"); run("equiv_induct [-undef] equiv");

View File

@ -1,14 +1,11 @@
read_verilog latches.v read_verilog latches.v
design -save read
proc proc
async2sync # converts latches to a 'sync' variant clocked by a 'super'-clock
flatten flatten
synth_ice40 # Can't run any sort of equivalence check because latches are blown to LUTs
equiv_opt -assert -map +/ice40/cells_sim.v synth_ice40 # equivalency check #equiv_opt -async2sync -assert -map +/ice40/cells_sim.v synth_ice40 # equivalency check
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
design -load read #design -load preopt
synth_ice40 synth_ice40
cd top cd top
select -assert-count 4 t:SB_LUT4 select -assert-count 4 t:SB_LUT4

View File

@ -2,9 +2,7 @@ read_verilog latches.v
proc proc
flatten flatten
equiv_opt -assert -run :prove -map +/xilinx/cells_sim.v synth_xilinx # equivalency check equiv_opt -async2sync -assert -map +/xilinx/cells_sim.v synth_xilinx # equivalency check
async2sync
equiv_opt -assert -run prove: -map +/xilinx/cells_sim.v synth_xilinx # equivalency check
design -load preopt design -load preopt
synth_xilinx synth_xilinx