From b5c15636c5594c2ea2f5b73919edf66d3e2478e7 Mon Sep 17 00:00:00 2001 From: Andrew Zonenberg Date: Mon, 28 Aug 2017 20:52:08 -0700 Subject: [PATCH] Refactoring: Renamed greenpak4_counters pass to extract_counter, moved it to techmap/ since it's going to become a generic pass --- passes/techmap/Makefile.inc | 1 + .../techmap/extract_counter.cc | 22 +++++++++---------- techlibs/greenpak4/Makefile.inc | 1 - techlibs/greenpak4/synth_greenpak4.cc | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) rename techlibs/greenpak4/greenpak4_counters.cc => passes/techmap/extract_counter.cc (95%) diff --git a/passes/techmap/Makefile.inc b/passes/techmap/Makefile.inc index 3f8a6feb5..140a9f892 100644 --- a/passes/techmap/Makefile.inc +++ b/passes/techmap/Makefile.inc @@ -17,6 +17,7 @@ OBJS += passes/techmap/iopadmap.o OBJS += passes/techmap/hilomap.o OBJS += passes/techmap/extract.o OBJS += passes/techmap/extract_fa.o +OBJS += passes/techmap/extract_counter.o OBJS += passes/techmap/extract_reduce.o OBJS += passes/techmap/alumacc.o OBJS += passes/techmap/dff2dffe.o diff --git a/techlibs/greenpak4/greenpak4_counters.cc b/passes/techmap/extract_counter.cc similarity index 95% rename from techlibs/greenpak4/greenpak4_counters.cc rename to passes/techmap/extract_counter.cc index 50a237b1b..54584b6f3 100644 --- a/techlibs/greenpak4/greenpak4_counters.cc +++ b/passes/techmap/extract_counter.cc @@ -103,7 +103,7 @@ struct CounterExtraction }; //attempt to extract a counter centered on the given adder cell -int greenpak4_counters_tryextract(ModIndex& index, Cell *cell, CounterExtraction& extract) +int counter_tryextract(ModIndex& index, Cell *cell, CounterExtraction& extract) { SigMap& sigmap = index.sigmap; @@ -276,7 +276,7 @@ int greenpak4_counters_tryextract(ModIndex& index, Cell *cell, CounterExtraction return 0; } -void greenpak4_counters_worker( +void counter_worker( ModIndex& index, Cell *cell, unsigned int& total_counters, @@ -328,7 +328,7 @@ void greenpak4_counters_worker( //Attempt to extract a counter CounterExtraction extract; - int reason = greenpak4_counters_tryextract(index, cell, extract); + int reason = counter_tryextract(index, cell, extract); //Nonzero code - we could not find a matchable counter. //Do nothing, unless extraction was forced in which case give an error @@ -455,21 +455,21 @@ void greenpak4_counters_worker( cells_to_rename.insert(pair(cell, countname)); } -struct Greenpak4CountersPass : public Pass { - Greenpak4CountersPass() : Pass("greenpak4_counters", "Extract GreenPak4 counter cells") { } +struct ExtractCounterPass : public Pass { + ExtractCounterPass() : Pass("extract_counter", "Extract GreenPak4 counter cells") { } virtual void help() { // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| log("\n"); - log(" greenpak4_counters [options] [selection]\n"); + log(" extract_counter [options] [selection]\n"); log("\n"); - log("This pass converts non-resettable or async resettable down counters to GreenPak4\n"); - log("counter cells (All other GreenPak4 counter modes must be instantiated manually.)\n"); + log("This pass converts non-resettable or async resettable down counters to\n"); + log("counter cells\n"); log("\n"); } virtual void execute(std::vector args, RTLIL::Design *design) { - log_header(design, "Executing GREENPAK4_COUNTERS pass (mapping counters to hard IP blocks).\n"); + log_header(design, "Executing EXTRACT_COUNTER pass (find counters in netlist).\n"); size_t argidx; for (argidx = 1; argidx < args.size(); argidx++) @@ -490,7 +490,7 @@ struct Greenpak4CountersPass : public Pass { ModIndex index(module); for (auto cell : module->selected_cells()) - greenpak4_counters_worker(index, cell, total_counters, cells_to_remove, cells_to_rename); + counter_worker(index, cell, total_counters, cells_to_remove, cells_to_rename); for(auto cell : cells_to_remove) { @@ -508,6 +508,6 @@ struct Greenpak4CountersPass : public Pass { if(total_counters) log("Extracted %u counters\n", total_counters); } -} Greenpak4CountersPass; +} ExtractCounterPass; PRIVATE_NAMESPACE_END diff --git a/techlibs/greenpak4/Makefile.inc b/techlibs/greenpak4/Makefile.inc index f9614e779..1169b23cf 100644 --- a/techlibs/greenpak4/Makefile.inc +++ b/techlibs/greenpak4/Makefile.inc @@ -1,6 +1,5 @@ OBJS += techlibs/greenpak4/synth_greenpak4.o -OBJS += techlibs/greenpak4/greenpak4_counters.o OBJS += techlibs/greenpak4/greenpak4_dffinv.o $(eval $(call add_share_file,share/greenpak4,techlibs/greenpak4/cells_latch.v)) diff --git a/techlibs/greenpak4/synth_greenpak4.cc b/techlibs/greenpak4/synth_greenpak4.cc index 92bcc8de7..1fb99c348 100644 --- a/techlibs/greenpak4/synth_greenpak4.cc +++ b/techlibs/greenpak4/synth_greenpak4.cc @@ -155,7 +155,7 @@ struct SynthGreenPAK4Pass : public ScriptPass if (check_label("fine")) { - run("greenpak4_counters"); + run("extract_counter"); run("clean"); run("opt -fast -mux_undef -undriven -fine"); run("memory_map"); -- 2.30.2