903 log_header(
"Executing TECHMAP pass (map to technology primitives).\n");
909 std::vector<std::string> map_files;
910 std::string verilog_frontend =
"verilog -ignore_redef";
914 for (argidx = 1; argidx <
args.size(); argidx++) {
915 if (
args[argidx] ==
"-map" && argidx+1 <
args.size()) {
916 if (
args[argidx+1].substr(0, 2) ==
"+/")
919 map_files.push_back(
args[++argidx]);
922 if (
args[argidx] ==
"-share_map" && argidx+1 <
args.size()) {
926 if (
args[argidx] ==
"-max_iter" && argidx+1 <
args.size()) {
927 max_iter = atoi(
args[++argidx].c_str());
930 if (
args[argidx] ==
"-D" && argidx+1 <
args.size()) {
931 verilog_frontend +=
" -D " +
args[++argidx];
934 if (
args[argidx] ==
"-I" && argidx+1 <
args.size()) {
935 verilog_frontend +=
" -I " +
args[++argidx];
938 if (
args[argidx] ==
"-assert") {
942 if (
args[argidx] ==
"-extern") {
946 if (
args[argidx] ==
"-recursive") {
950 if (
args[argidx] ==
"-autoproc") {
959 if (map_files.empty()) {
960 std::istringstream f(stdcells_code);
963 for (
auto &fn : map_files)
964 if (fn.substr(0, 1) ==
"%") {
970 if (!map->
has(mod->name))
971 map->
add(mod->clone());
977 Frontend::frontend_call(map, &f, fn, (fn.size() > 3 && fn.substr(fn.size()-3) ==
".il") ?
"ilang" : verilog_frontend);
980 std::map<RTLIL::IdString, RTLIL::Module*> modules_new;
982 if (it.first.substr(0, 2) ==
"\\$")
983 it.second->name = it.first.substr(1);
984 modules_new[it.second->name] = it.second;
988 std::map<RTLIL::IdString, std::set<RTLIL::IdString, RTLIL::sort_by_id_str>> celltypeMap;
990 if (it.second->attributes.count(
"\\techmap_celltype") && !it.second->attributes.at(
"\\techmap_celltype").bits.empty()) {
991 char *p = strdup(it.second->attributes.at(
"\\techmap_celltype").decode_string().c_str());
992 for (
char *q = strtok(p,
" \t\r\n"); q; q = strtok(
NULL,
" \t\r\n"))
996 celltypeMap[it.first].insert(it.first);
1008 std::set<RTLIL::Cell*> handled_cells;
1009 while (did_something) {
1010 did_something =
false;
1011 if (worker.
techmap_module(design, module, map, handled_cells, celltypeMap,
false))
1012 did_something =
true;
1015 if (max_iter > 0 && --max_iter == 0)
1020 log(
"No more expansions possible.\n");
std::set< RTLIL::Module *, RTLIL::IdString::compare_ptr_by_name< RTLIL::Module > > module_queue
void add(RTLIL::Module *module)
void log_header(const char *format,...)
static void frontend_call(RTLIL::Design *design, std::istream *f, std::string filename, std::string command)
std::map< RTLIL::IdString, void(*)(RTLIL::Module *, RTLIL::Cell *)> simplemap_mappers
YOSYS_NAMESPACE_BEGIN void simplemap_get_mappers(std::map< RTLIL::IdString, void(*)(RTLIL::Module *, RTLIL::Cell *)> &mappers)
static std::string escape_id(std::string str)
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN bool did_something
std::map< std::string, RTLIL::Design * > saved_designs
bool techmap_module(RTLIL::Design *design, RTLIL::Module *module, RTLIL::Design *map, std::set< RTLIL::Cell * > &handled_cells, const std::map< RTLIL::IdString, std::set< RTLIL::IdString, RTLIL::sort_by_id_str >> &celltypeMap, bool in_recursion)
void log_cmd_error(const char *format,...)
bool has(RTLIL::IdString id) const
RTLIL::ObjRange< RTLIL::Module * > modules()
std::map< RTLIL::IdString, RTLIL::Module * > modules_
void log(const char *format,...)
std::string proc_share_dirname()
void extra_args(std::vector< std::string > args, size_t argidx, RTLIL::Design *design, bool select=true)