453 log_header(
"Executing DFFLIBMAP pass (mapping DFF cells to sequential cells from liberty file).\n");
455 std::string liberty_file;
458 for (argidx = 1; argidx <
args.size(); argidx++)
460 std::string arg =
args[argidx];
461 if (arg ==
"-liberty" && argidx+1 <
args.size()) {
462 liberty_file =
args[++argidx];
469 if (liberty_file.empty())
473 f.open(liberty_file.c_str());
475 log_cmd_error(
"Can't open liberty file `%s': %s\n", liberty_file.c_str(), strerror(errno));
476 LibertyParser libparser(f);
479 find_cell(libparser.ast,
"$_DFF_N_",
false,
false,
false,
false);
480 find_cell(libparser.ast,
"$_DFF_P_",
true,
false,
false,
false);
482 find_cell(libparser.ast,
"$_DFF_NN0_",
false,
true,
false,
false);
483 find_cell(libparser.ast,
"$_DFF_NN1_",
false,
true,
false,
true);
484 find_cell(libparser.ast,
"$_DFF_NP0_",
false,
true,
true,
false);
485 find_cell(libparser.ast,
"$_DFF_NP1_",
false,
true,
true,
true);
486 find_cell(libparser.ast,
"$_DFF_PN0_",
true,
true,
false,
false);
487 find_cell(libparser.ast,
"$_DFF_PN1_",
true,
true,
false,
true);
488 find_cell(libparser.ast,
"$_DFF_PP0_",
true,
true,
true,
false);
489 find_cell(libparser.ast,
"$_DFF_PP1_",
true,
true,
true,
true);
491 find_cell_sr(libparser.ast,
"$_DFFSR_NNN_",
false,
false,
false);
492 find_cell_sr(libparser.ast,
"$_DFFSR_NNP_",
false,
false,
true);
493 find_cell_sr(libparser.ast,
"$_DFFSR_NPN_",
false,
true,
false);
494 find_cell_sr(libparser.ast,
"$_DFFSR_NPP_",
false,
true,
true);
495 find_cell_sr(libparser.ast,
"$_DFFSR_PNN_",
true,
false,
false);
496 find_cell_sr(libparser.ast,
"$_DFFSR_PNP_",
true,
false,
true);
497 find_cell_sr(libparser.ast,
"$_DFFSR_PPN_",
true,
true,
false);
498 find_cell_sr(libparser.ast,
"$_DFFSR_PPP_",
true,
true,
true);
531 log(
" final dff cell mappings:\n");
535 if (design->
selected(it.second) && !it.second->get_bool_attribute(
"\\blackbox"))
bool selected(T1 *module) const
static std::map< RTLIL::IdString, cell_mapping > cell_mappings
void log_header(const char *format,...)
static void find_cell(LibertyAst *ast, std::string cell_type, bool clkpol, bool has_reset, bool rstpol, bool rstval)
static void find_cell_sr(LibertyAst *ast, std::string cell_type, bool clkpol, bool setpol, bool clrpol)
void log_cmd_error(const char *format,...)
static bool expand_cellmap(std::string pattern, std::string inv)
std::map< RTLIL::IdString, RTLIL::Module * > modules_
static void map_sr_to_arst(const char *from, const char *to)
void log(const char *format,...)
static void dfflibmap(RTLIL::Design *design, RTLIL::Module *module)
void extra_args(std::vector< std::string > args, size_t argidx, RTLIL::Design *design, bool select=true)