aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/cells.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ice40/cells.cc')
-rw-r--r--ice40/cells.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/ice40/cells.cc b/ice40/cells.cc
index 1e9a012b..7abf83ff 100644
--- a/ice40/cells.cc
+++ b/ice40/cells.cc
@@ -38,6 +38,7 @@ CellInfo *create_ice_cell(Design *design, IdString type, IdString name)
} else {
new_cell->name = name;
}
+ new_cell->type = type;
if (type == "ICESTORM_LC") {
new_cell->params["LUT_INIT"] = "0";
new_cell->params["NEG_CLK"] = "0";
@@ -62,10 +63,22 @@ CellInfo *create_ice_cell(Design *design, IdString type, IdString name)
} else {
log_error("unable to create iCE40 cell of type %s", type.c_str());
}
- design->cells[new_cell->name] = new_cell;
return new_cell;
}
+void lut_to_lc(CellInfo *lut, CellInfo *lc, bool no_dff)
+{
+ lc->params["LUT_INIT"] = lut->params["LUT_INIT"];
+ replace_port(lut, "I0", lc, "I0");
+ replace_port(lut, "I1", lc, "I1");
+ replace_port(lut, "I2", lc, "I2");
+ replace_port(lut, "I3", lc, "I3");
+ if (no_dff) {
+ replace_port(lut, "O", lc, "O");
+ lc->params["DFF_ENABLE"] = "0";
+ }
+}
+
void dff_to_lc(CellInfo *dff, CellInfo *lc, bool pass_thru_lut)
{
lc->params["DFF_ENABLE"] = "1";
@@ -109,6 +122,8 @@ void dff_to_lc(CellInfo *dff, CellInfo *lc, bool pass_thru_lut)
lc->params["LUT_INIT"] = "2";
replace_port(dff, "D", lc, "I0");
}
+
+ replace_port(dff, "Q", lc, "O");
}
NEXTPNR_NAMESPACE_END