aboutsummaryrefslogtreecommitdiffstats
path: root/nexus/fasm.cc
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2020-10-13 10:07:28 +0100
committerDavid Shah <dave@ds0.me>2020-11-30 08:45:27 +0000
commit1bb509897c77b7a8931f10b84dc1de98668c04bd (patch)
tree7f4780fbb09d23823d8c0c6422626ab33c2fd762 /nexus/fasm.cc
parent0eb5c72cc5b95a7fb6b848e8d09ea9b235bce9b3 (diff)
downloadnextpnr-1bb509897c77b7a8931f10b84dc1de98668c04bd.tar.gz
nextpnr-1bb509897c77b7a8931f10b84dc1de98668c04bd.tar.bz2
nextpnr-1bb509897c77b7a8931f10b84dc1de98668c04bd.zip
nexus: More pin styles and FASM pinmux gen
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'nexus/fasm.cc')
-rw-r--r--nexus/fasm.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/nexus/fasm.cc b/nexus/fasm.cc
index 7d25de58..50b41e06 100644
--- a/nexus/fasm.cc
+++ b/nexus/fasm.cc
@@ -184,6 +184,30 @@ struct NexusFasmWriter
write_pip(p);
blank();
}
+ // Write out the mux config for a cell
+ void write_cell_muxes(const CellInfo *cell)
+ {
+ for (auto port : sorted_cref(cell->ports)) {
+ // Only relevant to inputs
+ if (port.second.type != PORT_IN)
+ continue;
+ auto pin_style = ctx->get_cell_pin_style(cell, port.first);
+ auto pin_mux = ctx->get_cell_pinmux(cell, port.first);
+ // Invertible pins
+ if (pin_style & PINOPT_INV) {
+ if (pin_mux == PINMUX_INV || pin_mux == PINMUX_0)
+ write_bit(stringf("%sMUX.INV", ctx->nameOf(port.first)));
+ else if (pin_mux == PINMUX_SIG)
+ write_bit(stringf("%sMUX.%s", ctx->nameOf(port.first), ctx->nameOf(port.first)));
+ }
+ // Pins that must be explictly enabled
+ if ((pin_style & PINBIT_GATED) && (pin_mux == PINMUX_SIG))
+ write_bit(stringf("%sMUX.%s", ctx->nameOf(port.first), ctx->nameOf(port.first)));
+ // Pins that must be explictly set to 1 rather than just left floating
+ if ((pin_style & PINBIT_1) && (pin_mux == PINMUX_1))
+ write_bit(stringf("%sMUX.1", ctx->nameOf(port.first)));
+ }
+ }
// Write config for an OXIDE_COMB cell
void write_comb(const CellInfo *cell)
{