diff options
Diffstat (limited to 'passes/techmap/nlutmap.cc')
-rw-r--r-- | passes/techmap/nlutmap.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/passes/techmap/nlutmap.cc b/passes/techmap/nlutmap.cc index 7ece4005..6fcdf82b 100644 --- a/passes/techmap/nlutmap.cc +++ b/passes/techmap/nlutmap.cc @@ -26,6 +26,7 @@ PRIVATE_NAMESPACE_BEGIN struct NlutmapConfig { vector<int> luts; + bool assert_mode = false; }; struct NlutmapWorker @@ -64,7 +65,7 @@ struct NlutmapWorker { vector<int> available_luts = config.luts; - while (!available_luts.empty()) + while (GetSize(available_luts) > 1) { int n_luts = available_luts.back(); int lut_size = GetSize(available_luts); @@ -84,7 +85,7 @@ struct NlutmapWorker if (cell->type != "$lut" || mapped_cells.count(cell)) continue; - if (GetSize(cell->getPort("\\A")) == lut_size) + if (GetSize(cell->getPort("\\A")) == lut_size || lut_size == 2) candidate_ratings[cell] = 0; for (auto &conn : cell->connections()) @@ -116,6 +117,12 @@ struct NlutmapWorker available_luts.back() += n_luts; } + if (config.assert_mode) { + for (auto cell : module->cells()) + if (cell->type == "$lut" && !mapped_cells.count(cell)) + log_error("Insufficient number of LUTs to map all logic cells!\n"); + } + run_abc(0); } }; @@ -135,6 +142,9 @@ struct NlutmapPass : public Pass { log(" The number of LUTs with 1, 2, 3, ... inputs that are\n"); log(" available in the target architecture.\n"); log("\n"); + log(" -assert\n"); + log(" Create an error if not all logic can be mapped\n"); + log("\n"); log("Excess logic that does not fit into the specified LUTs is mapped back\n"); log("to generic logic gates ($_AND_, etc.).\n"); log("\n"); @@ -143,7 +153,7 @@ struct NlutmapPass : public Pass { { NlutmapConfig config; - log_header("Executing NLUTMAP pass (mapping to constant drivers).\n"); + log_header(design, "Executing NLUTMAP pass (mapping to constant drivers).\n"); log_push(); size_t argidx; @@ -156,6 +166,10 @@ struct NlutmapPass : public Pass { config.luts.push_back(atoi(token.c_str())); continue; } + if (args[argidx] == "-assert") { + config.assert_mode = true; + continue; + } break; } extra_args(args, argidx, design); |