From 2cc4e75914eddcf8a850bb5b7ce7bcdb093fa75e Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 17 May 2015 15:25:03 +0200 Subject: Added read_blif command --- frontends/blif/blifparse.cc | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'frontends') diff --git a/frontends/blif/blifparse.cc b/frontends/blif/blifparse.cc index fb71cee1..cc06dfbd 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 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 -- cgit v1.2.3