-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0fc5812
commit b71219b
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include "kernel/yosys.h" | ||
#include "kernel/ff.h" | ||
|
||
USING_YOSYS_NAMESPACE | ||
PRIVATE_NAMESPACE_BEGIN | ||
|
||
struct ClockgatePass : public Pass { | ||
ClockgatePass() : Pass("clock_gate", "extract clock gating out of flip flops") { } | ||
void help() override | ||
{ | ||
// TODO | ||
} | ||
|
||
SigMap sigmap; | ||
FfInitVals initvals; | ||
|
||
void execute(std::vector<std::string> args, RTLIL::Design *design) override | ||
{ | ||
log_header(design, "Executing CLOCK_GATE pass (extract clock gating out of flip flops).\n"); | ||
|
||
std::string pos_icg_cell; | ||
std::string neg_icg_cell; | ||
size_t argidx; | ||
for (argidx = 1; argidx < args.size(); argidx++) | ||
{ | ||
if (args[argidx] == "-pos" && argidx+1 < args.size()) { | ||
pos_icg_cell = args[++argidx]; | ||
} | ||
if (args[argidx] == "-neg" && argidx+1 < args.size()) { | ||
neg_icg_cell = args[++argidx]; | ||
} | ||
break; | ||
} | ||
|
||
|
||
extra_args(args, argidx, design); | ||
|
||
for (auto module : design->selected_whole_modules()) { | ||
sigmap.set(module); | ||
initvals.set(&sigmap, module); | ||
for (auto cell : module->cells()) { | ||
if (!RTLIL::builtin_ff_cell_types().count(cell->type)) | ||
continue; | ||
FfData ff(&initvals, cell); | ||
if (ff.has_ce) { | ||
|
||
// TODO do stuff | ||
|
||
|
||
bool ce_pol = ff.pol_ce; | ||
if (!ce_pol) { | ||
//TODO invert CE | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
} ClockgatePass; | ||
|
||
|
||
PRIVATE_NAMESPACE_END |