diff options
author | YRabbit <rabbit@yrabbit.cyou> | 2023-01-26 20:26:05 +1000 |
---|---|---|
committer | YRabbit <rabbit@yrabbit.cyou> | 2023-01-26 20:26:05 +1000 |
commit | 2d45d57b3246814ad20988c6ecf941180faf58a6 (patch) | |
tree | 2e7578b8e3677cd946a2cc8254dfec35ba357558 /gowin/pack.cc | |
parent | 9b5e5f124c186942652e6be03c356cf0edf88124 (diff) | |
download | nextpnr-2d45d57b3246814ad20988c6ecf941180faf58a6.tar.gz nextpnr-2d45d57b3246814ad20988c6ecf941180faf58a6.tar.bz2 nextpnr-2d45d57b3246814ad20988c6ecf941180faf58a6.zip |
gowin: Add PLL support for the GW1NR-9C chip
This chip is used in the Tangnano9k board.
* all parameters of the rPLL primitive are supported;
* all PLL outputs are treated as clock sources and optimized routing
is applied to them;
* primitive rPLL on different chips has a completely different
structure: for example in GW1N-1 it takes two cells, and in GW1NR-9C
as many as four, despite this unification was carried out and
different chips are processed by the same functions, but this led to
the fact that you can not use the PLL chip GW1N-1 with the old
apicula bases - will issue a warning and refuse to encode primitive.
In other cases compatibility is supported.
* Cosmetic change: the usage report shows the rPLL names without any
service bels.
* I use ctx->idf() on occasion, it's not a total redesign.
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
Diffstat (limited to 'gowin/pack.cc')
-rw-r--r-- | gowin/pack.cc | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/gowin/pack.cc b/gowin/pack.cc index 1ebd5315..cb24ac02 100644 --- a/gowin/pack.cc +++ b/gowin/pack.cc @@ -1034,7 +1034,7 @@ static void pack_plls(Context *ctx) if (ctx->verbose) log_info("cell '%s' is of type '%s'\n", ctx->nameOf(ci), ci->type.c_str(ctx)); if (is_pll(ctx, ci)) { - std::string parm_device = str_or_default(ci->params, id_DEVICE, "GW1N-1"); + std::string parm_device = str_or_default(ci->params, id_DEVICE, ctx->device.c_str()); if (parm_device != ctx->device) { log_error("Cell '%s': wrong PLL device:%s instead of %s\n", ctx->nameOf(ci), parm_device.c_str(), ctx->device.c_str()); @@ -1043,27 +1043,21 @@ static void pack_plls(Context *ctx) switch (ci->type.hash()) { case ID_rPLL: { - if (parm_device == "GW1N-1" || parm_device == "GW1NZ-1") { + if (parm_device == "GW1N-1" || parm_device == "GW1NZ-1" || parm_device == "GW1NR-9C") { pll_disable_unused_ports(ctx, ci); - // B half - std::unique_ptr<CellInfo> cell = create_generic_cell(ctx, id_RPLLB, ci->name.str(ctx) + "$rpllb"); - reconnect_rpllb(ctx, ci, cell.get()); + // A cell + std::unique_ptr<CellInfo> cell = create_generic_cell(ctx, id_rPLL, ci->name.str(ctx) + "$rpll"); + reconnect_rpll(ctx, ci, cell.get()); new_cells.push_back(std::move(cell)); - auto pllb_cell = new_cells.back().get(); - // A half - cell = create_generic_cell(ctx, id_RPLLA, ci->name.str(ctx) + "$rplla"); - reconnect_rplla(ctx, ci, cell.get()); - new_cells.push_back(std::move(cell)); - auto plla_cell = new_cells.back().get(); + auto pll_cell = new_cells.back().get(); // need params for gowin_pack for (auto &parm : ci->params) { - plla_cell->setParam(parm.first, parm.second); - pllb_cell->setParam(parm.first, parm.second); + pll_cell->setParam(parm.first, parm.second); } packed_cells.insert(ci->name); } else { - log_error("PLL isn't supported for %s\n", ctx->device.c_str()); + log_error("rPLL isn't supported for %s\n", ctx->device.c_str()); } } break; case ID_PLLVR: { @@ -1080,7 +1074,7 @@ static void pack_plls(Context *ctx) } packed_cells.insert(ci->name); } else { - log_error("PLL isn't supported for %s\n", ctx->device.c_str()); + log_error("PLLVR isn't supported for %s\n", ctx->device.c_str()); } } break; default: |