Call internal checker more often

This commit is contained in:
Clifford Wolf 2013-11-10 23:24:21 +01:00
parent 223892ac28
commit 378cc509cd
4 changed files with 11 additions and 9 deletions

View File

@ -856,6 +856,7 @@ RTLIL::IdString AstModule::derive(RTLIL::Design *design, std::map<RTLIL::IdStrin
if (design->modules.count(modname) == 0) { if (design->modules.count(modname) == 0) {
new_ast->str = modname; new_ast->str = modname;
design->modules[modname] = process_module(new_ast); design->modules[modname] = process_module(new_ast);
design->modules[modname]->check();
} else { } else {
log("Found cached RTLIL representation for module `%s'.\n", modname.c_str()); log("Found cached RTLIL representation for module `%s'.\n", modname.c_str());
} }

View File

@ -67,14 +67,10 @@ static void run_frontend(std::string filename, std::string command, RTLIL::Desig
if (f == NULL) if (f == NULL)
log_error("Can't open script file `%s' for reading: %s\n", filename.c_str(), strerror(errno)); log_error("Can't open script file `%s' for reading: %s\n", filename.c_str(), strerror(errno));
std::string command; std::string command;
while (fgetline(f, command)) { while (fgetline(f, command))
Pass::call(design, command); Pass::call(design, command);
design->check(); if (!command.empty())
}
if (!command.empty()) {
Pass::call(design, command); Pass::call(design, command);
design->check();
}
if (filename != "-") if (filename != "-")
fclose(f); fclose(f);
if (backend_command != NULL && *backend_command == "auto") if (backend_command != NULL && *backend_command == "auto")
@ -89,7 +85,6 @@ static void run_frontend(std::string filename, std::string command, RTLIL::Desig
} }
Frontend::frontend_call(design, NULL, filename, command); Frontend::frontend_call(design, NULL, filename, command);
design->check();
} }
static void run_pass(std::string command, RTLIL::Design *design) static void run_pass(std::string command, RTLIL::Design *design)
@ -97,7 +92,6 @@ static void run_pass(std::string command, RTLIL::Design *design)
log("\n-- Running pass `%s' --\n", command.c_str()); log("\n-- Running pass `%s' --\n", command.c_str());
Pass::call(design, command); Pass::call(design, command);
design->check();
} }
static void run_backend(std::string filename, std::string command, RTLIL::Design *design) static void run_backend(std::string filename, std::string command, RTLIL::Design *design)
@ -125,7 +119,6 @@ static void run_backend(std::string filename, std::string command, RTLIL::Design
} }
Backend::backend_call(design, NULL, filename, command); Backend::backend_call(design, NULL, filename, command);
design->check();
} }
static char *readline_cmd_generator(const char *text, int state) static char *readline_cmd_generator(const char *text, int state)

View File

@ -178,6 +178,8 @@ void Pass::call(RTLIL::Design *design, std::vector<std::string> args)
pass_register[args[0]]->execute(args, design); pass_register[args[0]]->execute(args, design);
while (design->selection_stack.size() > orig_sel_stack_pos) while (design->selection_stack.size() > orig_sel_stack_pos)
design->selection_stack.pop_back(); design->selection_stack.pop_back();
design->check();
} }
Frontend::Frontend(std::string name, std::string short_help) : Pass("read_"+name, short_help), frontend_name(name) Frontend::Frontend(std::string name, std::string short_help) : Pass("read_"+name, short_help), frontend_name(name)
@ -270,6 +272,8 @@ void Frontend::frontend_call(RTLIL::Design *design, FILE *f, std::string filenam
args.push_back(filename); args.push_back(filename);
frontend_register[args[0]]->execute(args, design); frontend_register[args[0]]->execute(args, design);
} }
design->check();
} }
Backend::Backend(std::string name, std::string short_help) : Pass("write_"+name, short_help), backend_name(name) Backend::Backend(std::string name, std::string short_help) : Pass("write_"+name, short_help), backend_name(name)
@ -364,6 +368,8 @@ void Backend::backend_call(RTLIL::Design *design, FILE *f, std::string filename,
while (design->selection_stack.size() > orig_sel_stack_pos) while (design->selection_stack.size() > orig_sel_stack_pos)
design->selection_stack.pop_back(); design->selection_stack.pop_back();
design->check();
} }
struct HelpPass : public Pass { struct HelpPass : public Pass {

View File

@ -352,6 +352,8 @@ struct TechmapPass : public Pass {
for (auto &mod_it : design->modules) for (auto &mod_it : design->modules)
if (techmap_module(design, mod_it.second, map, handled_cells, celltypeMap, false, opt_mode)) if (techmap_module(design, mod_it.second, map, handled_cells, celltypeMap, false, opt_mode))
did_something = true; did_something = true;
if (did_something)
design->check();
} }
log("No more expansions possible.\n"); log("No more expansions possible.\n");