Skip to content

Commit

Permalink
Fix bug loading libraries when they are already loaded
Browse files Browse the repository at this point in the history
ArcaneNibble authored and azonenberg committed Aug 30, 2017
1 parent 365fb30 commit 5fd9c2a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion passes/techmap/extract_tff.cc
Original file line number Diff line number Diff line change
@@ -45,16 +45,21 @@ struct ExtractTFFPass : public ScriptPass
}

bool no_final_abc;
bool already_loaded_lib;

virtual void clear_flags() YS_OVERRIDE
{
no_final_abc = false;
already_loaded_lib = false;
}

virtual void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
{
clear_flags();

if (design->has("\\__TFF_N_"))
already_loaded_lib = true;

size_t argidx;
for (argidx = 1; argidx < args.size(); argidx++)
{
@@ -78,7 +83,9 @@ struct ExtractTFFPass : public ScriptPass
{
run("abc -g AND,XOR");
run("extract -map +/untechmap/tff_untechmap.v");
run("read_verilog -lib +/untechmap/tff_untechmap.v");
// Load this library only if the design doesn't already have it
if (!already_loaded_lib)
run("read_verilog -lib +/untechmap/tff_untechmap.v");

if (!no_final_abc)
run("abc");

0 comments on commit 5fd9c2a

Please sign in to comment.