3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-12 20:18:20 +00:00

Refactoring: Renamed greenpak4_counters pass to extract_counter, moved it to techmap/ since it's going to become a generic pass

This commit is contained in:
Andrew Zonenberg 2017-08-28 20:52:08 -07:00
parent 393b18e8e1
commit b5c15636c5
4 changed files with 13 additions and 13 deletions

View file

@ -17,6 +17,7 @@ OBJS += passes/techmap/iopadmap.o
OBJS += passes/techmap/hilomap.o OBJS += passes/techmap/hilomap.o
OBJS += passes/techmap/extract.o OBJS += passes/techmap/extract.o
OBJS += passes/techmap/extract_fa.o OBJS += passes/techmap/extract_fa.o
OBJS += passes/techmap/extract_counter.o
OBJS += passes/techmap/extract_reduce.o OBJS += passes/techmap/extract_reduce.o
OBJS += passes/techmap/alumacc.o OBJS += passes/techmap/alumacc.o
OBJS += passes/techmap/dff2dffe.o OBJS += passes/techmap/dff2dffe.o

View file

@ -103,7 +103,7 @@ struct CounterExtraction
}; };
//attempt to extract a counter centered on the given adder cell //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; SigMap& sigmap = index.sigmap;
@ -276,7 +276,7 @@ int greenpak4_counters_tryextract(ModIndex& index, Cell *cell, CounterExtraction
return 0; return 0;
} }
void greenpak4_counters_worker( void counter_worker(
ModIndex& index, ModIndex& index,
Cell *cell, Cell *cell,
unsigned int& total_counters, unsigned int& total_counters,
@ -328,7 +328,7 @@ void greenpak4_counters_worker(
//Attempt to extract a counter //Attempt to extract a counter
CounterExtraction extract; 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. //Nonzero code - we could not find a matchable counter.
//Do nothing, unless extraction was forced in which case give an error //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*, string>(cell, countname)); cells_to_rename.insert(pair<Cell*, string>(cell, countname));
} }
struct Greenpak4CountersPass : public Pass { struct ExtractCounterPass : public Pass {
Greenpak4CountersPass() : Pass("greenpak4_counters", "Extract GreenPak4 counter cells") { } ExtractCounterPass() : Pass("extract_counter", "Extract GreenPak4 counter cells") { }
virtual void help() virtual void help()
{ {
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
log("\n"); log("\n");
log(" greenpak4_counters [options] [selection]\n"); log(" extract_counter [options] [selection]\n");
log("\n"); log("\n");
log("This pass converts non-resettable or async resettable down counters to GreenPak4\n"); log("This pass converts non-resettable or async resettable down counters to\n");
log("counter cells (All other GreenPak4 counter modes must be instantiated manually.)\n"); log("counter cells\n");
log("\n"); log("\n");
} }
virtual void execute(std::vector<std::string> args, RTLIL::Design *design) virtual void execute(std::vector<std::string> 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; size_t argidx;
for (argidx = 1; argidx < args.size(); argidx++) for (argidx = 1; argidx < args.size(); argidx++)
@ -490,7 +490,7 @@ struct Greenpak4CountersPass : public Pass {
ModIndex index(module); ModIndex index(module);
for (auto cell : module->selected_cells()) 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) for(auto cell : cells_to_remove)
{ {
@ -508,6 +508,6 @@ struct Greenpak4CountersPass : public Pass {
if(total_counters) if(total_counters)
log("Extracted %u counters\n", total_counters); log("Extracted %u counters\n", total_counters);
} }
} Greenpak4CountersPass; } ExtractCounterPass;
PRIVATE_NAMESPACE_END PRIVATE_NAMESPACE_END

View file

@ -1,6 +1,5 @@
OBJS += techlibs/greenpak4/synth_greenpak4.o OBJS += techlibs/greenpak4/synth_greenpak4.o
OBJS += techlibs/greenpak4/greenpak4_counters.o
OBJS += techlibs/greenpak4/greenpak4_dffinv.o OBJS += techlibs/greenpak4/greenpak4_dffinv.o
$(eval $(call add_share_file,share/greenpak4,techlibs/greenpak4/cells_latch.v)) $(eval $(call add_share_file,share/greenpak4,techlibs/greenpak4/cells_latch.v))

View file

@ -155,7 +155,7 @@ struct SynthGreenPAK4Pass : public ScriptPass
if (check_label("fine")) if (check_label("fine"))
{ {
run("greenpak4_counters"); run("extract_counter");
run("clean"); run("clean");
run("opt -fast -mux_undef -undriven -fine"); run("opt -fast -mux_undef -undriven -fine");
run("memory_map"); run("memory_map");