372 std::vector<RTLIL::Cell*> lge_cells, eq_cells;
376 if (cell->type.in(
"$lt",
"$le",
"$ge",
"$gt"))
377 lge_cells.push_back(cell);
378 if (cell->type.in(
"$eq",
"$eqx",
"$ne",
"$nex"))
379 eq_cells.push_back(cell);
382 for (
auto cell : lge_cells)
384 log(
" creating $alu model for %s (%s):",
log_id(cell),
log_id(cell->type));
386 bool cmp_less = cell->type.in(
"$lt",
"$le");
387 bool cmp_equal = cell->type.in(
"$le",
"$ge");
388 bool is_signed = cell->getParam(
"\\A_SIGNED").as_bool();
395 cmp_less = !cmp_less;
399 alunode_t *
n =
nullptr;
402 if (node->is_signed == is_signed && node->invert_b && node->c ==
RTLIL::S1) {
413 n->is_signed = is_signed;
418 log(
" merged with %s.\n",
log_id(n->cells.front()));
421 n->cells.push_back(cell);
422 n->cmp.push_back(std::make_tuple(cmp_less, !cmp_less, cmp_equal,
false, Y));
425 for (
auto cell : eq_cells)
427 bool cmp_equal = cell->type.in(
"$eq",
"$eqx");
428 bool is_signed = cell->getParam(
"\\A_SIGNED").as_bool();
437 alunode_t *n =
nullptr;
440 if (node->is_signed == is_signed && node->invert_b && node->c ==
RTLIL::S1) {
446 log(
" creating $alu model for %s (%s): merged with %s.\n",
log_id(cell),
log_id(cell->type),
log_id(n->cells.front()));
447 n->cells.push_back(cell);
448 n->cmp.push_back(std::make_tuple(
false,
false, cmp_equal, !cmp_equal, Y));
int GetSize(RTLIL::Wire *wire)
RTLIL::Wire * addWire(RTLIL::IdString name, int width=1)
std::vector< RTLIL::Cell * > selected_cells() const
std::map< RTLIL::SigSig, std::set< alunode_t * > > sig_alu
void log(const char *format,...)
std::pair< SigSpec, SigSpec > SigSig
const char * log_id(RTLIL::IdString str)