aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5/cells.cc
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-07-17 16:45:39 +0200
committerDavid Shah <davey1576@gmail.com>2018-07-17 16:45:39 +0200
commit2eb783d626a9a17baf70d2f7750be3c11623d5bc (patch)
tree2e653dc4ab26d7d2dd95add96e382c3ea59e1477 /ecp5/cells.cc
parentf62f04e376f83d650ab1067cdf0f058151828b8a (diff)
downloadnextpnr-2eb783d626a9a17baf70d2f7750be3c11623d5bc.tar.gz
nextpnr-2eb783d626a9a17baf70d2f7750be3c11623d5bc.tar.bz2
nextpnr-2eb783d626a9a17baf70d2f7750be3c11623d5bc.zip
ecp5: Fixing packer bugs
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ecp5/cells.cc')
-rw-r--r--ecp5/cells.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/ecp5/cells.cc b/ecp5/cells.cc
index 4a20ce80..59504735 100644
--- a/ecp5/cells.cc
+++ b/ecp5/cells.cc
@@ -41,7 +41,7 @@ std::unique_ptr<CellInfo> create_ecp5_cell(Context *ctx, IdString type, std::str
new_cell->name = ctx->id(name);
}
new_cell->type = type;
- if (type == ctx->id("TRELLIS_LC")) {
+ if (type == ctx->id("TRELLIS_SLICE")) {
new_cell->params[ctx->id("MODE")] = "LOGIC";
new_cell->params[ctx->id("GSR")] = "DISABLED";
new_cell->params[ctx->id("SRMODE")] = "LSR_OVER_CE";
@@ -131,7 +131,7 @@ static void set_param_safe(bool has_ff, CellInfo *lc, IdString name, const std::
static void replace_port_safe(bool has_ff, CellInfo *ff, IdString ff_port, CellInfo *lc, IdString lc_port)
{
if (has_ff) {
- assert(lc->ports.at(lc_port).net == ff->ports.at(ff_port).net);
+ NPNR_ASSERT(lc->ports.at(lc_port).net == ff->ports.at(ff_port).net);
NetInfo *ffnet = ff->ports.at(ff_port).net;
if (ffnet != nullptr)
ffnet->users.erase(
@@ -154,8 +154,10 @@ void ff_to_slice(Context *ctx, CellInfo *ff, CellInfo *lc, int index, bool drive
lc->params[ctx->id(reg + "_SD")] = driven_by_lut ? "1" : "0";
lc->params[ctx->id(reg + "_REGSET")] = str_or_default(ff->params, ctx->id("REGSET"), "RESET");
replace_port_safe(has_ff, ff, ctx->id("CLK"), lc, ctx->id("CLK"));
- replace_port_safe(has_ff, ff, ctx->id("LSR"), lc, ctx->id("LSR"));
- replace_port_safe(has_ff, ff, ctx->id("CE"), lc, ctx->id("CE"));
+ if (ff->ports.find(ctx->id("LSR")) != ff->ports.end())
+ replace_port_safe(has_ff, ff, ctx->id("LSR"), lc, ctx->id("LSR"));
+ if (ff->ports.find(ctx->id("CE")) != ff->ports.end())
+ replace_port_safe(has_ff, ff, ctx->id("CE"), lc, ctx->id("CE"));
replace_port(ff, ctx->id("Q"), lc, ctx->id("Q" + std::to_string(index)));
if (driven_by_lut) {