aboutsummaryrefslogtreecommitdiffstats
path: root/generic/cells.cc
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2019-11-08 16:28:39 +0000
committerGitHub <noreply@github.com>2019-11-08 16:28:39 +0000
commit6a335411da6eb54f0960eb514c5384e4ae60c3a7 (patch)
tree0ff3e83dc88a2b59275136e098ba5e59ed473480 /generic/cells.cc
parentcaf7abdb8dd7ec97801fd13efc8ae132e637ecd3 (diff)
parenta4848f6902f81b6d3f2a36ab853922047e177288 (diff)
downloadnextpnr-6a335411da6eb54f0960eb514c5384e4ae60c3a7.tar.gz
nextpnr-6a335411da6eb54f0960eb514c5384e4ae60c3a7.tar.bz2
nextpnr-6a335411da6eb54f0960eb514c5384e4ae60c3a7.zip
Merge pull request #350 from pepijndevos/newslice
Dedicated output for LUT in GENERIC_SLICE
Diffstat (limited to 'generic/cells.cc')
-rw-r--r--generic/cells.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/generic/cells.cc b/generic/cells.cc
index 53886e33..2b555f62 100644
--- a/generic/cells.cc
+++ b/generic/cells.cc
@@ -42,7 +42,7 @@ std::unique_ptr<CellInfo> create_generic_cell(Context *ctx, IdString type, std::
}
new_cell->type = type;
if (type == ctx->id("GENERIC_SLICE")) {
- new_cell->params[ctx->id("K")] = std::to_string(ctx->args.K);
+ new_cell->params[ctx->id("K")] = ctx->args.K;
new_cell->params[ctx->id("INIT")] = 0;
new_cell->params[ctx->id("FF_USED")] = 0;
@@ -51,6 +51,7 @@ std::unique_ptr<CellInfo> create_generic_cell(Context *ctx, IdString type, std::
add_port(ctx, new_cell.get(), "CLK", PORT_IN);
+ add_port(ctx, new_cell.get(), "F", PORT_OUT);
add_port(ctx, new_cell.get(), "Q", PORT_OUT);
} else if (type == ctx->id("GENERIC_IOB")) {
new_cell->params[ctx->id("INPUT_USED")] = 0;
@@ -80,8 +81,8 @@ void lut_to_lc(const Context *ctx, CellInfo *lut, CellInfo *lc, bool no_dff)
}
if (no_dff) {
- replace_port(lut, ctx->id("Q"), lc, ctx->id("Q"));
lc->params[ctx->id("FF_USED")] = 0;
+ replace_port(lut, ctx->id("Q"), lc, ctx->id("F"));
}
}
@@ -91,7 +92,14 @@ void dff_to_lc(const Context *ctx, CellInfo *dff, CellInfo *lc, bool pass_thru_l
replace_port(dff, ctx->id("CLK"), lc, ctx->id("CLK"));
if (pass_thru_lut) {
- lc->params[ctx->id("INIT")] = 2;
+ // Fill LUT with alternating 10
+ const int init_size = 1 << lc->params[ctx->id("K")].as_int64();
+ std::string init;
+ init.reserve(init_size);
+ for(int i = 0; i < init_size; i+=2)
+ init.append("10");
+ lc->params[ctx->id("INIT")] = Property::from_string(init);
+
replace_port(dff, ctx->id("D"), lc, ctx->id("I[0]"));
}