diff options
author | David Shah <davey1576@gmail.com> | 2018-08-07 12:16:51 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-09-29 16:09:21 +0100 |
commit | dfdaaa6f57a0a9f87878491a24b659e94aaec5fd (patch) | |
tree | 941ba224ad557a6d4f01dd43cb77fde992672201 /ecp5 | |
parent | 97b12fa741a48efed1014aecf8283eabb2919d20 (diff) | |
download | nextpnr-dfdaaa6f57a0a9f87878491a24b659e94aaec5fd.tar.gz nextpnr-dfdaaa6f57a0a9f87878491a24b659e94aaec5fd.tar.bz2 nextpnr-dfdaaa6f57a0a9f87878491a24b659e94aaec5fd.zip |
ecp5: Adding DCCA insertion function
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ecp5')
-rw-r--r-- | ecp5/cells.cc | 4 | ||||
-rw-r--r-- | ecp5/globals.cc | 29 |
2 files changed, 33 insertions, 0 deletions
diff --git a/ecp5/cells.cc b/ecp5/cells.cc index e3532f36..c7afdbc2 100644 --- a/ecp5/cells.cc +++ b/ecp5/cells.cc @@ -124,6 +124,10 @@ std::unique_ptr<CellInfo> create_ecp5_cell(Context *ctx, IdString type, std::str add_port(ctx, new_cell.get(), "C", PORT_IN); add_port(ctx, new_cell.get(), "D", PORT_IN); add_port(ctx, new_cell.get(), "Z", PORT_OUT); + } else if (type == ctx->id("DCCA")) { + add_port(ctx, new_cell.get(), "CLKI", PORT_IN); + add_port(ctx, new_cell.get(), "CLKO", PORT_OUT); + add_port(ctx, new_cell.get(), "CE", PORT_IN); } else { log_error("unable to create ECP5 cell of type %s", type.c_str(ctx)); } diff --git a/ecp5/globals.cc b/ecp5/globals.cc index df7f4461..3d7d7518 100644 --- a/ecp5/globals.cc +++ b/ecp5/globals.cc @@ -21,6 +21,7 @@ #include <iomanip> #include <queue> #include "nextpnr.h" +#include "cells.h" #include "log.h" @@ -230,6 +231,34 @@ class Ecp5GlobalRouter } } + + // Insert a DCC into a net to promote it to a global + NetInfo *insert_dcc(NetInfo *net) + { + auto dcc = create_ecp5_cell(ctx, ctx->id("DCCA"), "$gbuf$" + net->name.str(ctx)); + + std::unique_ptr<NetInfo> glbnet = std::unique_ptr<NetInfo>(new NetInfo); + glbnet->name = ctx->id("$glbnet$" + net->name.str(ctx)); + glbnet->driver.cell = dcc.get(); + glbnet->driver.port = ctx->id("CLKO"); + + for (auto user : net->users) { + user.cell->ports.at(user.port).net = glbnet.get(); + } + net->users.clear(); + + dcc->ports[ctx->id("CLKI")].net = net; + PortRef clki_pr; + clki_pr.port = ctx->id("CLKI"); + clki_pr.cell = dcc.get(); + net->users.push_back(clki_pr); + + ctx->cells[dcc->name] = std::move(dcc); + NetInfo *glbptr = glbnet.get(); + ctx->nets[glbnet->name] = std::move(glbnet); + return glbptr; + } + Context *ctx; }; |