From 32dce4a870e8f556897096a0c252b2e43f5622e5 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 14 Dec 2014 17:37:46 +0100 Subject: [PATCH] Added "blif -unbuf" feature --- backends/blif/blif.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/backends/blif/blif.cc b/backends/blif/blif.cc index 216e59fb5..18f76f7e4 100644 --- a/backends/blif/blif.cc +++ b/backends/blif/blif.cc @@ -40,6 +40,7 @@ struct BlifDumperConfig bool param_mode; std::string buf_type, buf_in, buf_out; + std::map> unbuf_types; std::string true_type, true_out, false_type, false_out; BlifDumperConfig() : icells_mode(false), conn_mode(false), impltf_mode(false), gates_mode(false), param_mode(false) { } @@ -146,6 +147,13 @@ struct BlifDumper { RTLIL::Cell *cell = cell_it.second; + if (config->unbuf_types.count(cell->type)) { + auto portnames = config->unbuf_types.at(cell->type); + f << stringf(".names %s %s\n1 1\n", + cstr(cell->getPort(portnames.first)), cstr(cell->getPort(portnames.second))); + continue; + } + if (!config->icells_mode && cell->type == "$_NOT_") { f << stringf(".names %s %s\n0 1\n", cstr(cell->getPort("\\A")), cstr(cell->getPort("\\Y"))); @@ -279,6 +287,10 @@ struct BlifBackend : public Backend { log(" -buf \n"); log(" use cells of type with the specified port names for buffers\n"); log("\n"); + log(" -unbuf \n"); + log(" replace buffer cells with the specified name and port names with\n"); + log(" a .names statement that models a buffer\n"); + log("\n"); log(" -true \n"); log(" -false \n"); log(" use the specified cell types to drive nets that are constant 1 or 0\n"); @@ -329,6 +341,13 @@ struct BlifBackend : public Backend { config.buf_out = args[++argidx]; continue; } + if (args[argidx] == "-unbuf" && argidx+3 < args.size()) { + RTLIL::IdString unbuf_type = RTLIL::escape_id(args[++argidx]); + RTLIL::IdString unbuf_in = RTLIL::escape_id(args[++argidx]); + RTLIL::IdString unbuf_out = RTLIL::escape_id(args[++argidx]); + config.unbuf_types[unbuf_type] = std::pair(unbuf_in, unbuf_out); + continue; + } if (args[argidx] == "-true" && argidx+2 < args.size()) { config.true_type = args[++argidx]; config.true_out = args[++argidx]; -- 2.30.2