diff options
author | William D. Jones <thor0505@comcast.net> | 2021-02-02 09:55:42 -0500 |
---|---|---|
committer | gatecat <gatecat@ds0.me> | 2021-02-12 10:36:59 +0000 |
commit | 086bca18b828488cab4f2a825cffa34812ab8c8f (patch) | |
tree | 87353bac147949e58edb11ca1c04e0b99e571ebf /machxo2/cells.cc | |
parent | 3ab300a28e9fcfbc7c2d35424eab849da0d4b866 (diff) | |
download | nextpnr-086bca18b828488cab4f2a825cffa34812ab8c8f.tar.gz nextpnr-086bca18b828488cab4f2a825cffa34812ab8c8f.tar.bz2 nextpnr-086bca18b828488cab4f2a825cffa34812ab8c8f.zip |
machxo2: Add packing logic to handle FFs fed with constant value; UART test core routes.
Diffstat (limited to 'machxo2/cells.cc')
-rw-r--r-- | machxo2/cells.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/machxo2/cells.cc b/machxo2/cells.cc index 20e68ab5..7d15b1af 100644 --- a/machxo2/cells.cc +++ b/machxo2/cells.cc @@ -154,15 +154,24 @@ void lut_to_lc(const Context *ctx, CellInfo *lut, CellInfo *lc, bool no_dff) replace_port(lut, ctx->id("Z"), lc, ctx->id("F0")); } -void dff_to_lc(const Context *ctx, CellInfo *dff, CellInfo *lc, bool pass_thru_lut) +void dff_to_lc(Context *ctx, CellInfo *dff, CellInfo *lc, bool pass_thru_lut) { // FIXME: This will have to change once we support FFs with reset value of 1. lc->params[ctx->id("REG0_REGSET")] = std::string("RESET"); replace_port(dff, ctx->id("CLK"), lc, ctx->id("CLK")); - replace_port(dff, ctx->id("DI"), lc, ctx->id("DI0")); replace_port(dff, ctx->id("LSR"), lc, ctx->id("LSR")); replace_port(dff, ctx->id("Q"), lc, ctx->id("Q0")); + + // If a register's DI port is fed by a constant, options for placing are + // limited. Use the LUT to get around this. + if(pass_thru_lut) { + lc->params[ctx->id("LUT0_INITVAL")] = 0xAAAA; + replace_port(dff, ctx->id("DI"), lc, ctx->id("A0")); + connect_ports(ctx, lc, ctx->id("F0"), lc, ctx->id("DI0")); + } else { + replace_port(dff, ctx->id("DI"), lc, ctx->id("DI0")); + } } void nxio_to_iob(Context *ctx, CellInfo *nxio, CellInfo *iob, std::unordered_set<IdString> &todelete_cells) {} |