diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-05-17 15:25:03 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-05-17 15:25:03 +0200 |
commit | 2cc4e75914eddcf8a850bb5b7ce7bcdb093fa75e (patch) | |
tree | 2618c1de2e64a11b4ca52bb80224477e408e9ce9 | |
parent | e5116eeb77c5b7d77f726da4d512f14b7f31eada (diff) | |
download | yosys-2cc4e75914eddcf8a850bb5b7ce7bcdb093fa75e.tar.gz yosys-2cc4e75914eddcf8a850bb5b7ce7bcdb093fa75e.tar.bz2 yosys-2cc4e75914eddcf8a850bb5b7ce7bcdb093fa75e.zip |
Added read_blif command
-rw-r--r-- | frontends/blif/blifparse.cc | 32 | ||||
-rw-r--r-- | kernel/yosys.cc | 2 |
2 files changed, 33 insertions, 1 deletions
diff --git a/frontends/blif/blifparse.cc b/frontends/blif/blifparse.cc index fb71cee16..cc06dfbd3 100644 --- a/frontends/blif/blifparse.cc +++ b/frontends/blif/blifparse.cc @@ -133,7 +133,7 @@ void parse_blif(RTLIL::Design *design, std::istream &f, std::string dff_name) continue; } - if (!strcmp(cmd, ".gate")) + if (!strcmp(cmd, ".gate") || !strcmp(cmd, ".subckt")) { char *p = strtok(NULL, " \t\r\n"); if (p == NULL) @@ -268,5 +268,35 @@ error: log_error("Syntax error in line %d!\n", line_count); } +struct BlifFrontend : public Frontend { + BlifFrontend() : Frontend("blif", "read BLIF file") { } + virtual void help() + { + // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| + log("\n"); + log(" read_blif [filename]\n"); + log("\n"); + log("Load modules from a BLIF file into the current design.\n"); + log("\n"); + } + virtual void execute(std::istream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design) + { + log_header("Executing BLIF frontend.\n"); + + size_t argidx; + for (argidx = 1; argidx < args.size(); argidx++) { + std::string arg = args[argidx]; + // if (arg == "-lib") { + // flag_lib = true; + // continue; + // } + break; + } + extra_args(f, filename, args, argidx); + + parse_blif(design, *f, "\\DFF"); + } +} BlifFrontend; + YOSYS_NAMESPACE_END diff --git a/kernel/yosys.cc b/kernel/yosys.cc index 1d6e7113b..d66f33b1e 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -746,6 +746,8 @@ void run_frontend(std::string filename, std::string command, std::string *backen command = "verilog"; else if (filename.size() > 2 && filename.substr(filename.size()-3) == ".sv") command = "verilog -sv"; + else if (filename.size() > 4 && filename.substr(filename.size()-5) == ".blif") + command = "blif"; else if (filename.size() > 3 && filename.substr(filename.size()-3) == ".il") command = "ilang"; else if (filename.size() > 3 && filename.substr(filename.size()-3) == ".ys") |