diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-02-01 13:38:46 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-02-01 13:38:46 +0100 |
commit | 1df81f92ce171ba63cf0e4d10e6f203ca5f7f64e (patch) | |
tree | 4a8ecd5d257d5e90cb1f02984d05089bedaa9143 /kernel | |
parent | 3fe2441185057a5d563fb32157f52a7b6c4205fd (diff) | |
download | yosys-1df81f92ce171ba63cf0e4d10e6f203ca5f7f64e.tar.gz yosys-1df81f92ce171ba63cf0e4d10e6f203ca5f7f64e.tar.bz2 yosys-1df81f92ce171ba63cf0e4d10e6f203ca5f7f64e.zip |
Added "make mklibyosys", some minor API changes
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/driver.cc | 8 | ||||
-rw-r--r-- | kernel/yosys.cc | 20 | ||||
-rw-r--r-- | kernel/yosys.h | 7 |
3 files changed, 25 insertions, 10 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc index 65b6c5a47..e95ef48d3 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -291,7 +291,7 @@ int main(int argc, char **argv) } while (optind < argc) - run_frontend(argv[optind++], frontend_command, yosys_design, output_filename == "-" ? &backend_command : NULL, NULL); + run_frontend(argv[optind++], frontend_command, output_filename == "-" ? &backend_command : NULL); if (!scriptfile.empty()) { if (scriptfile_tcl) { @@ -302,14 +302,14 @@ int main(int argc, char **argv) log_error("Can't exectue TCL script: this version of yosys is not built with TCL support enabled.\n"); #endif } else - run_frontend(scriptfile, "script", yosys_design, output_filename == "-" ? &backend_command : NULL, NULL); + run_frontend(scriptfile, "script", output_filename == "-" ? &backend_command : NULL); } for (auto it = passes_commands.begin(); it != passes_commands.end(); it++) - run_pass(*it, yosys_design); + run_pass(*it); if (!backend_command.empty()) - run_backend(output_filename, backend_command, yosys_design); + run_backend(output_filename, backend_command); if (print_stats) { diff --git a/kernel/yosys.cc b/kernel/yosys.cc index e4a5c3351..530d78796 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -679,8 +679,11 @@ static void handle_label(std::string &command, bool &from_to_active, const std:: } } -void run_frontend(std::string filename, std::string command, RTLIL::Design *design, std::string *backend_command, std::string *from_to_label) +void run_frontend(std::string filename, std::string command, std::string *backend_command, std::string *from_to_label, RTLIL::Design *design) { + if (design == nullptr) + design = yosys_design; + if (command == "auto") { if (filename.size() > 2 && filename.substr(filename.size()-2) == ".v") command = "verilog"; @@ -772,8 +775,16 @@ void run_frontend(std::string filename, std::string command, RTLIL::Design *desi Frontend::frontend_call(design, NULL, filename, command); } +void run_frontend(std::string filename, std::string command, RTLIL::Design *design) +{ + run_frontend(filename, command, nullptr, nullptr, design); +} + void run_pass(std::string command, RTLIL::Design *design) { + if (design == nullptr) + design = yosys_design; + log("\n-- Running command `%s' --\n", command.c_str()); Pass::call(design, command); @@ -781,6 +792,9 @@ void run_pass(std::string command, RTLIL::Design *design) void run_backend(std::string filename, std::string command, RTLIL::Design *design) { + if (design == nullptr) + design = yosys_design; + if (command == "auto") { if (filename.size() > 2 && filename.substr(filename.size()-2) == ".v") command = "verilog"; @@ -1025,9 +1039,9 @@ struct ScriptPass : public Pass { if (args.size() < 2) log_cmd_error("Missing script file.\n"); else if (args.size() == 2) - run_frontend(args[1], "script", design, NULL, NULL); + run_frontend(args[1], "script", design); else if (args.size() == 3) - run_frontend(args[1], "script", design, NULL, &args[2]); + run_frontend(args[1], "script", NULL, &args[2], design); else extra_args(args, 2, design, false); } diff --git a/kernel/yosys.h b/kernel/yosys.h index efdc005eb..47275ecd4 100644 --- a/kernel/yosys.h +++ b/kernel/yosys.h @@ -253,9 +253,10 @@ std::string proc_self_dirname(); std::string proc_share_dirname(); const char *create_prompt(RTLIL::Design *design, int recursion_counter); -void run_frontend(std::string filename, std::string command, RTLIL::Design *design, std::string *backend_command, std::string *from_to_label); -void run_pass(std::string command, RTLIL::Design *design); -void run_backend(std::string filename, std::string command, RTLIL::Design *design); +void run_pass(std::string command, RTLIL::Design *design = nullptr); +void run_frontend(std::string filename, std::string command, std::string *backend_command, std::string *from_to_label = nullptr, RTLIL::Design *design = nullptr); +void run_frontend(std::string filename, std::string command, RTLIL::Design *design = nullptr); +void run_backend(std::string filename, std::string command, RTLIL::Design *design = nullptr); void shell(RTLIL::Design *design); // from kernel/version_*.o (cc source generated from Makefile) |