f2b_count += 1;
RTLIL::Cell *b2fA = module->addCell(NEW_ID, "\\bit_to_fp3");
RTLIL::Cell *b2fB = module->addCell(NEW_ID, "\\bit_to_fp3");
- RTLIL::Cell *nan = module->addCell(NEW_ID, "\\nan");
+ RTLIL::Cell *nan = module->addCell(NEW_ID, "\\nan_fp3");
RTLIL::Cell *f2b = module->addCell(NEW_ID, "\\fp3_to_bit");
+ b2fA->attributes[ID(nan_b2f)] = 3;
+ b2fB->attributes[ID(nan_b2f)] = 3;
+ nan->attributes[ID(nan_cell)] = 3;
+ f2b->attributes[ID(nan_f2b)] = 3;
b2fA->setPort("\\A", cell->getPort("\\A"));
b2fA->setPort("\\Y", module->addWire(NEW_ID, 3));
b2fB->setPort("\\A", cell->getPort("\\B"));
not_count += 1;
f2b_count += 1;
RTLIL::Cell *b2f = module->addCell(NEW_ID, "\\bit_to_fp3");
- RTLIL::Cell *nan = module->addCell(NEW_ID, "\\nan");
+ RTLIL::Cell *nan = module->addCell(NEW_ID, "\\nan_fp3");
RTLIL::Cell *f2b = module->addCell(NEW_ID, "\\fp3_to_bit");
+ b2f->attributes[ID(nan_b2f)] = 3;
+ nan->attributes[ID(nan_cell)] = 3;
+ f2b->attributes[ID(nan_f2b)] = 3;
b2f->setPort("\\A", cell->getPort("\\A"));
b2f->setPort("\\Y", module->addWire(NEW_ID, 3));
f2b->setPort("\\A", module->addWire(NEW_ID, 3));
NandToNaNWorker worker(design, module);
log("Replaced %d NAND gates and %d NOT gates.\n",
worker.nand_count, worker.not_count);
- log("Inserted:\n nan: %5d\n bit_to_fp3: %5d\n fp3_to_bit: %5d\n",
+ log("Inserted:\n nan_fp3: %5d\n bit_to_fp3: %5d\n fp3_to_bit: %5d\n",
worker.nand_count + worker.not_count,
worker.b2f_count, worker.f2b_count);
}
pm.run([&]() { dffs.insert(pm.st.dff); });
for (auto &dff : dffs) {
RTLIL::Cell *f2b = module->addCell(NEW_ID, "\\fp3_to_bit");
+ f2b->attributes[ID(nan_f2b)] = 3;
f2b->setPort("\\A", module->addWire(NEW_ID, 3));
f2b->setPort("\\Y", dff->getPort("\\Q"));
RTLIL::Cell *b2f = module->addCell(NEW_ID, "\\bit_to_fp3");
+ b2f->attributes[ID(nan_b2f)] = 3;
b2f->setPort("\\A", dff->getPort("\\D"));
b2f->setPort("\\Y", module->addWire(NEW_ID, 3));
for (int i = 0; i < 3; i++) {