diff options
author | gatecat <gatecat@ds0.me> | 2022-03-12 15:43:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-12 15:43:26 +0000 |
commit | 233ea62c13cc4a5da29a704619cac2c6a5de4fce (patch) | |
tree | c81c3aa7ff1ad04ab1e731ebfe01a727fd099b2b /gowin/pack.cc | |
parent | 20e595e2113bb5d2de479e70f64ebd980e756716 (diff) | |
parent | 4a2aa6deb49b70ed69f386898bcde7a6b2572618 (diff) | |
download | nextpnr-233ea62c13cc4a5da29a704619cac2c6a5de4fce.tar.gz nextpnr-233ea62c13cc4a5da29a704619cac2c6a5de4fce.tar.bz2 nextpnr-233ea62c13cc4a5da29a704619cac2c6a5de4fce.zip |
Merge pull request #941 from yrabbit/gsr
gowin: Add the Global Set/Reset primitive
Diffstat (limited to 'gowin/pack.cc')
-rw-r--r-- | gowin/pack.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gowin/pack.cc b/gowin/pack.cc index c17a20c7..24daee31 100644 --- a/gowin/pack.cc +++ b/gowin/pack.cc @@ -660,6 +660,41 @@ static void pack_constants(Context *ctx) } } +// Pack global set-reset +static void pack_gsr(Context *ctx) +{ + log_info("Packing GSR..\n"); + + bool user_gsr = false; + for (auto &cell : ctx->cells) { + CellInfo *ci = cell.second.get(); + if (ctx->verbose) + log_info("cell '%s' is of type '%s'\n", ctx->nameOf(ci), ci->type.c_str(ctx)); + if (ci->type == id_GSR) { + user_gsr = true; + break; + } + } + if (!user_gsr) { + // XXX + bool have_gsr_bel = false; + for (auto bi : ctx->bels) { + if (bi.second.type == id_GSR) { + have_gsr_bel = true; + break; + } + } + if (have_gsr_bel) { + // make default GSR + std::unique_ptr<CellInfo> gsr_cell = create_generic_cell(ctx, id_GSR, "GSR"); + gsr_cell->connectPort(id_GSRI, ctx->nets[ctx->id("$PACKER_VCC_NET")].get()); + ctx->cells[gsr_cell->name] = std::move(gsr_cell); + } else { + log_info("No GSR in the chip base\n"); + } + } +} + static bool is_nextpnr_iob(const Context *ctx, CellInfo *cell) { return cell->type == ctx->id("$nextpnr_ibuf") || cell->type == ctx->id("$nextpnr_obuf") || @@ -857,6 +892,7 @@ bool Arch::pack() try { log_break(); pack_constants(ctx); + pack_gsr(ctx); pack_io(ctx); pack_diff_io(ctx); pack_wideluts(ctx); |