From ccfed6ef3f1a28e7ee7211c21b0d6204516330a7 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Thu, 9 May 2024 19:39:59 +0200 Subject: [PATCH] cost: fix $sop model --- kernel/cost.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kernel/cost.cc b/kernel/cost.cc index 42989f4d238..4e5355d4fc2 100644 --- a/kernel/cost.cc +++ b/kernel/cost.cc @@ -59,11 +59,8 @@ static unsigned int max_inp_coef(RTLIL::IdString type) return 2; } else if (type == ID($lcu)) { return 5; - } else if ( - // comparison - type.in(ID($lt), ID($le), ID($ge), ID($gt)) || - // others - type == ID($sop)) { + } else if (type.in(ID($lt), ID($le), ID($ge), ID($gt))) { + // comparison return 6; } return 0; @@ -174,6 +171,11 @@ unsigned int CellCosts::get(RTLIL::Cell *cell) unsigned int cost = 1U << (unsigned int)width; log_debug("%s is 2**%d\n", cell->name.c_str(), width); return cost; + } else if (cell->type == ID($sop)) { + int width = cell->getParam(ID::WIDTH).as_int(); + int depth = cell->getParam(ID::DEPTH).as_int(); + log_debug("%s is (2*%d + 1)*%d + %d\n", cell->name.c_str(), width, depth); + return (2 * width + 1) * depth; } else if (is_free(cell->type)) { log_debug("%s is free\n", cell->name.c_str()); return 0;