aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/pack.cc
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-26 15:55:50 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-26 15:55:50 +0200
commit21d5a04501e411b8c1391606c1eafba5d4789c41 (patch)
tree874a37f8746845a37b492a259ae3c3a116a1c2b0 /ice40/pack.cc
parent6f12f2b7e8c58a0b14c6f1f3df2112b8860a6e4f (diff)
downloadnextpnr-21d5a04501e411b8c1391606c1eafba5d4789c41.tar.gz
nextpnr-21d5a04501e411b8c1391606c1eafba5d4789c41.tar.bz2
nextpnr-21d5a04501e411b8c1391606c1eafba5d4789c41.zip
Carry chains now routable
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ice40/pack.cc')
-rw-r--r--ice40/pack.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc
index 0d48d58c..6e4eade1 100644
--- a/ice40/pack.cc
+++ b/ice40/pack.cc
@@ -178,12 +178,27 @@ static void pack_carries(Context *ctx)
std::unique_ptr<CellInfo> created_lc =
create_ice_cell(ctx, ctx->id("ICESTORM_LC"), cell.first.str(ctx) + "$CARRY");
carry_lc = created_lc.get();
+ created_lc->ports.at(ctx->id("I1")).net = i0_net;
+ if (i0_net) {
+ PortRef pr;
+ pr.cell = created_lc.get();
+ pr.port = ctx->id("I1");
+ i0_net->users.push_back(pr);
+ }
+ created_lc->ports.at(ctx->id("I2")).net = i1_net;
+ if (i1_net) {
+ PortRef pr;
+ pr.cell = created_lc.get();
+ pr.port = ctx->id("I2");
+ i1_net->users.push_back(pr);
+ }
new_cells.push_back(std::move(created_lc));
+
} else {
carry_lc = ctx->cells.at(*carry_lcs.begin()).get();
}
}
- carry_lc->attrs[ctx->id("CARRY_ENABLE")] = "1";
+ carry_lc->params[ctx->id("CARRY_ENABLE")] = "1";
replace_port(ci, ctx->id("CI"), carry_lc, ctx->id("CIN"));
replace_port(ci, ctx->id("CO"), carry_lc, ctx->id("COUT"));
if (i0_net) {
@@ -203,8 +218,8 @@ static void pack_carries(Context *ctx)
if (carry_lc->ports.at(ctx->id("CIN")).net != nullptr) {
IdString cin_net = carry_lc->ports.at(ctx->id("CIN")).net->name;
if (cin_net == ctx->id("$PACKER_GND_NET") || cin_net == ctx->id("$PACKER_VCC_NET")) {
- carry_lc->attrs[ctx->id("CIN_CONST")] = "1";
- carry_lc->attrs[ctx->id("CIN_SET")] = cin_net == ctx->id("$PACKER_VCC_NET") ? "1" : "0";
+ carry_lc->params[ctx->id("CIN_CONST")] = "1";
+ carry_lc->params[ctx->id("CIN_SET")] = cin_net == ctx->id("$PACKER_VCC_NET") ? "1" : "0";
carry_lc->ports.at(ctx->id("CIN")).net = nullptr;
auto cin_users = ctx->nets.at(cin_net)->users;
cin_users.erase(