| 1 |
/* |
| 2 |
* nextpnr -- Next Generation Place and Route |
| 3 |
* |
| 4 |
* Copyright (C) 2024 The Project Peppercorn Authors. |
| 5 |
* |
| 6 |
* Permission to use, copy, modify, and/or distribute this software for any |
| 7 |
* purpose with or without fee is hereby granted, provided that the above |
| 8 |
* copyright notice and this permission notice appear in all copies. |
| 9 |
* |
| 10 |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 11 |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 12 |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 13 |
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 14 |
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 15 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 |
* |
| 18 |
*/ |
| 19 |
|
| 20 |
#include "gatemate.h" |
| 21 |
#include "log.h" |
| 22 |
|
| 23 |
#define HIMBAECHEL_CONSTIDS "uarch/gatemate/constids.inc" |
| 24 |
#include "himbaechel_constids.h" |
| 25 |
|
| 26 |
namespace { |
| 27 |
USING_NEXTPNR_NAMESPACE; |
| 28 |
|
| 29 |
bool is_fourgroup_a_within_tile(const GateMateTileExtraDataPOD *ti, int &x_within_fourgroup, int &y_within_fourgroup) |
| 30 |
{ |
| 31 |
auto x_fourgroup = ti->tile_x % 4; |
| 32 |
auto y_fourgroup = ti->tile_y % 4; |
| 33 |
x_within_fourgroup = ti->tile_x % 2; |
| 34 |
y_within_fourgroup = ti->tile_y % 2; |
| 35 |
return (x_fourgroup < 2 && y_fourgroup < 2) || (x_fourgroup >= 2 && y_fourgroup >= 2); |
| 36 |
} |
| 37 |
|
| 38 |
void find_and_bind_downhill_pip(Context *ctx, WireId from, WireId to, NetInfo *net) |
| 39 |
{ |
| 40 |
NPNR_ASSERT(from != WireId()); |
| 41 |
NPNR_ASSERT(to != WireId()); |
| 42 |
for (auto pip : ctx->getPipsDownhill(from)) { |
| 43 |
if (ctx->getPipDstWire(pip) == to) { |
| 44 |
if (ctx->debug) |
| 45 |
log_info(" pip %s: %s -> %s\n", ctx->nameOfPip(pip), ctx->nameOfWire(from), ctx->nameOfWire(to)); |
| 46 |
|
| 47 |
ctx->bindPip(pip, net, STRENGTH_LOCKED); |
| 48 |
return; |
| 49 |
} |
| 50 |
} |
| 51 |
log_error("Couldn't find pip from %s to %s.\n", ctx->nameOfWire(from), ctx->nameOfWire(to)); |
| 52 |
} |
| 53 |
|
| 54 |
void route_mult_diag(Context *ctx, NetInfo *net, Loc loc, WireId last_wire, int plane) |
| 55 |
{ |
| 56 |
auto hops = 0; |
| 57 |
auto in_port = ctx->idf("IN%d", plane); |
| 58 |
for (auto user : net->users) { |
| 59 |
if (user.port == in_port) |
| 60 |
hops++; |
| 61 |
} |
| 62 |
|
| 63 |
if (ctx->debug) |
| 64 |
log_info(" routing diagonal: %d hops\n", hops); |
| 65 |
|
| 66 |
for (int i = 0; i < hops; i++) { |
| 67 |
auto in_mux_y = ctx->getWireByName( |
| 68 |
IdStringList::concat(ctx->idf("X%dY%d", loc.x + i, loc.y + i), ctx->idf("IM.P%02d.Y", plane))); |
| 69 |
auto d4 = ctx->getWireByName( |
| 70 |
IdStringList::concat(ctx->idf("X%dY%d", loc.x + i + 1, loc.y + i + 1), ctx->idf("IM.P%02d.D4", plane))); |
| 71 |
auto cpe_in = ctx->getWireByName( |
| 72 |
IdStringList::concat(ctx->idf("X%dY%d", loc.x + i, loc.y + i), ctx->idf("CPE.IN%d", plane))); |
| 73 |
auto cpe_in_int = ctx->getWireByName( |
| 74 |
IdStringList::concat(ctx->idf("X%dY%d", loc.x + i, loc.y + i), ctx->idf("CPE.IN%d_int", plane))); |
| 75 |
|
| 76 |
find_and_bind_downhill_pip(ctx, last_wire, in_mux_y, net); |
| 77 |
find_and_bind_downhill_pip(ctx, in_mux_y, cpe_in, net); |
| 78 |
find_and_bind_downhill_pip(ctx, cpe_in, cpe_in_int, net); |
| 79 |
|
| 80 |
if (i != hops - 1) |
| 81 |
find_and_bind_downhill_pip(ctx, in_mux_y, d4, net); |
| 82 |
|
| 83 |
last_wire = d4; |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
void route_mult_x1y1_lower(Context *ctx, NetInfo *net, CellInfo *lower, Loc loc, bool is_fourgroup_a) |
| 88 |
{ |
| 89 |
if (ctx->debug) |
| 90 |
log_info(" routing net '%s' -> IN5 using x1y1\n", net->name.c_str(ctx)); |
| 91 |
|
| 92 |
auto x1y1 = ctx->idf("X%dY%d", loc.x, loc.y); |
| 93 |
auto x2y1 = ctx->idf("X%dY%d", loc.x + 1, loc.y); |
| 94 |
|
| 95 |
auto cpe_combout1 = ctx->getBelPinWire(lower->bel, id_OUT); |
| 96 |
auto cpe_out1_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT1_int"))); |
| 97 |
auto cpe_out1 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT1"))); |
| 98 |
auto in_mux = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("IM.P05.D0"))); |
| 99 |
|
| 100 |
ctx->bindWire(cpe_combout1, net, STRENGTH_LOCKED); |
| 101 |
find_and_bind_downhill_pip(ctx, cpe_combout1, cpe_out1_int, net); |
| 102 |
find_and_bind_downhill_pip(ctx, cpe_out1_int, cpe_out1, net); |
| 103 |
|
| 104 |
if (is_fourgroup_a) { |
| 105 |
auto sb_big_d0 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P05.D0"))); |
| 106 |
auto sb_big_y1 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P05.Y1"))); |
| 107 |
|
| 108 |
find_and_bind_downhill_pip(ctx, cpe_out1, sb_big_d0, net); |
| 109 |
find_and_bind_downhill_pip(ctx, sb_big_d0, sb_big_y1, net); |
| 110 |
find_and_bind_downhill_pip(ctx, sb_big_y1, in_mux, net); |
| 111 |
} else { |
| 112 |
auto sb_sml_d0 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P05.D0"))); |
| 113 |
auto sb_sml_y1_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P05.Y1_int"))); |
| 114 |
auto sb_sml_y1 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P05.Y1"))); |
| 115 |
|
| 116 |
find_and_bind_downhill_pip(ctx, cpe_out1, sb_sml_d0, net); |
| 117 |
find_and_bind_downhill_pip(ctx, sb_sml_d0, sb_sml_y1_int, net); |
| 118 |
find_and_bind_downhill_pip(ctx, sb_sml_y1_int, sb_sml_y1, net); |
| 119 |
find_and_bind_downhill_pip(ctx, sb_sml_y1, in_mux, net); // inverting |
| 120 |
} |
| 121 |
|
| 122 |
route_mult_diag(ctx, net, Loc{loc.x + 1, loc.y, 0}, in_mux, 5); |
| 123 |
} |
| 124 |
|
| 125 |
void route_mult_x1y1_upper_in1(Context *ctx, NetInfo *net, CellInfo *upper, Loc loc, bool is_fourgroup_a) |
| 126 |
{ |
| 127 |
if (ctx->debug) |
| 128 |
log_info(" routing net '%s' -> IN1 using x1y1\n", net->name.c_str(ctx)); |
| 129 |
|
| 130 |
auto x1y1 = ctx->idf("X%dY%d", loc.x, loc.y); |
| 131 |
auto x2y1 = ctx->idf("X%dY%d", loc.x + 1, loc.y); |
| 132 |
|
| 133 |
auto cpe_combout2 = ctx->getBelPinWire(upper->bel, id_OUT); |
| 134 |
auto cpe_out2_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2_int"))); |
| 135 |
auto cpe_out2 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2"))); |
| 136 |
auto in_mux = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("IM.P01.D0"))); |
| 137 |
|
| 138 |
ctx->bindWire(cpe_combout2, net, STRENGTH_LOCKED); |
| 139 |
find_and_bind_downhill_pip(ctx, cpe_combout2, cpe_out2_int, net); |
| 140 |
find_and_bind_downhill_pip(ctx, cpe_out2_int, cpe_out2, net); |
| 141 |
|
| 142 |
if (is_fourgroup_a) { |
| 143 |
auto sb_big_d0 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P01.D0"))); |
| 144 |
auto sb_big_y1 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P01.Y1"))); |
| 145 |
|
| 146 |
find_and_bind_downhill_pip(ctx, cpe_out2, sb_big_d0, net); |
| 147 |
find_and_bind_downhill_pip(ctx, sb_big_d0, sb_big_y1, net); |
| 148 |
find_and_bind_downhill_pip(ctx, sb_big_y1, in_mux, net); // inverting |
| 149 |
} else { |
| 150 |
auto sb_sml_d0 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P01.D0"))); |
| 151 |
auto sb_sml_y1_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P01.Y1_int"))); |
| 152 |
auto sb_sml_y1 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P01.Y1"))); |
| 153 |
|
| 154 |
find_and_bind_downhill_pip(ctx, cpe_out2, sb_sml_d0, net); |
| 155 |
find_and_bind_downhill_pip(ctx, sb_sml_d0, sb_sml_y1_int, net); |
| 156 |
find_and_bind_downhill_pip(ctx, sb_sml_y1_int, sb_sml_y1, net); |
| 157 |
find_and_bind_downhill_pip(ctx, sb_sml_y1, in_mux, net); |
| 158 |
} |
| 159 |
|
| 160 |
route_mult_diag(ctx, net, Loc{loc.x + 1, loc.y, 0}, in_mux, 1); |
| 161 |
} |
| 162 |
|
| 163 |
void route_mult_x1y1_upper_in8(Context *ctx, NetInfo *net, CellInfo *upper, Loc loc, bool is_fourgroup_a, |
| 164 |
bool bind_route_start = false) |
| 165 |
{ |
| 166 |
if (ctx->debug) |
| 167 |
log_info(" routing net '%s' -> IN8 using x1y1\n", net->name.c_str(ctx)); |
| 168 |
|
| 169 |
auto x1y1 = ctx->idf("X%dY%d", loc.x, loc.y); |
| 170 |
auto x2y2 = ctx->idf("X%dY%d", loc.x + 1, loc.y + 1); |
| 171 |
auto x4y2 = ctx->idf("X%dY%d", loc.x + 3, loc.y + 1); |
| 172 |
|
| 173 |
auto cpe_combout2 = ctx->getBelPinWire(upper->bel, id_OUT); |
| 174 |
auto cpe_out2_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2_int"))); |
| 175 |
auto cpe_out2 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2"))); |
| 176 |
auto out_mux_d0 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("OM.P12.D0"))); |
| 177 |
auto out_mux_y = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("OM.P12.Y"))); |
| 178 |
auto in_mux_p12 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P12.D2"))); |
| 179 |
|
| 180 |
if (bind_route_start) { |
| 181 |
ctx->bindWire(cpe_combout2, net, STRENGTH_LOCKED); |
| 182 |
find_and_bind_downhill_pip(ctx, cpe_combout2, cpe_out2_int, net); |
| 183 |
find_and_bind_downhill_pip(ctx, cpe_out2_int, cpe_out2, net); |
| 184 |
} |
| 185 |
|
| 186 |
find_and_bind_downhill_pip(ctx, cpe_out2, out_mux_d0, net); |
| 187 |
find_and_bind_downhill_pip(ctx, out_mux_d0, out_mux_y, net); // inverting |
| 188 |
|
| 189 |
if (is_fourgroup_a) { |
| 190 |
auto sb_sml_d0 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("SB_SML.P12.D0"))); |
| 191 |
auto sb_sml_y1_int = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("SB_SML.P12.Y1_int"))); |
| 192 |
auto sb_sml_y1 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("SB_SML.P12.Y1"))); |
| 193 |
auto sb_big_d2_1 = ctx->getWireByName(IdStringList::concat(x4y2, ctx->idf("SB_BIG.P12.D2_1"))); |
| 194 |
auto sb_big_y1 = ctx->getWireByName(IdStringList::concat(x4y2, ctx->idf("SB_BIG.P12.Y1"))); |
| 195 |
auto sb_big_ydiag = ctx->getWireByName(IdStringList::concat(x4y2, ctx->idf("SB_BIG.P12.YDIAG"))); |
| 196 |
auto sb_big_y3 = ctx->getWireByName(IdStringList::concat(x4y2, ctx->idf("SB_BIG.P12.Y3"))); |
| 197 |
|
| 198 |
find_and_bind_downhill_pip(ctx, out_mux_y, sb_sml_d0, net); |
| 199 |
find_and_bind_downhill_pip(ctx, sb_sml_d0, sb_sml_y1_int, net); |
| 200 |
find_and_bind_downhill_pip(ctx, sb_sml_y1_int, sb_sml_y1, net); |
| 201 |
find_and_bind_downhill_pip(ctx, sb_sml_y1, sb_big_d2_1, net); // inverting |
| 202 |
find_and_bind_downhill_pip(ctx, sb_big_d2_1, sb_big_y1, net); // inverting |
| 203 |
find_and_bind_downhill_pip(ctx, sb_big_y1, sb_big_ydiag, net); // inverting |
| 204 |
find_and_bind_downhill_pip(ctx, sb_big_ydiag, sb_big_y3, net); // inverting |
| 205 |
find_and_bind_downhill_pip(ctx, sb_big_y3, in_mux_p12, net); // inverting |
| 206 |
} else { |
| 207 |
auto sb_big_d0 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("SB_BIG.P12.D0"))); |
| 208 |
auto sb_big_y1 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("SB_BIG.P12.Y1"))); |
| 209 |
auto sb_sml_d2_1 = ctx->getWireByName(IdStringList::concat(x4y2, ctx->idf("SB_SML.P12.D2_1"))); |
| 210 |
auto sb_sml_y1_int = ctx->getWireByName(IdStringList::concat(x4y2, ctx->idf("SB_SML.P12.Y1_int"))); |
| 211 |
auto sb_sml_ydiag_int = ctx->getWireByName(IdStringList::concat(x4y2, ctx->idf("SB_SML.P12.YDIAG_int"))); |
| 212 |
auto sb_sml_y3_int = ctx->getWireByName(IdStringList::concat(x4y2, ctx->idf("SB_SML.P12.Y3_int"))); |
| 213 |
auto sb_sml_y3 = ctx->getWireByName(IdStringList::concat(x4y2, ctx->idf("SB_SML.P12.Y3"))); |
| 214 |
|
| 215 |
find_and_bind_downhill_pip(ctx, out_mux_y, sb_big_d0, net); |
| 216 |
find_and_bind_downhill_pip(ctx, sb_big_d0, sb_big_y1, net); |
| 217 |
find_and_bind_downhill_pip(ctx, sb_big_y1, sb_sml_d2_1, net); |
| 218 |
find_and_bind_downhill_pip(ctx, sb_sml_d2_1, sb_sml_y1_int, net); |
| 219 |
find_and_bind_downhill_pip(ctx, sb_sml_y1_int, sb_sml_ydiag_int, net); |
| 220 |
find_and_bind_downhill_pip(ctx, sb_sml_ydiag_int, sb_sml_y3_int, net); |
| 221 |
find_and_bind_downhill_pip(ctx, sb_sml_y3_int, sb_sml_y3, net); |
| 222 |
find_and_bind_downhill_pip(ctx, sb_sml_y3, in_mux_p12, net); |
| 223 |
} |
| 224 |
|
| 225 |
auto in_mux_p12_y = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P12.Y"))); |
| 226 |
auto in_mux_p04 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P04.D7"))); |
| 227 |
auto in_mux_p04_y = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P04.Y"))); |
| 228 |
auto in_mux_p08 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P08.D6"))); |
| 229 |
|
| 230 |
find_and_bind_downhill_pip(ctx, in_mux_p12, in_mux_p12_y, net); |
| 231 |
find_and_bind_downhill_pip(ctx, in_mux_p12_y, in_mux_p04, net); |
| 232 |
find_and_bind_downhill_pip(ctx, in_mux_p04, in_mux_p04_y, net); |
| 233 |
find_and_bind_downhill_pip(ctx, in_mux_p04_y, in_mux_p08, net); |
| 234 |
|
| 235 |
route_mult_diag(ctx, net, Loc{loc.x + 1, loc.y + 1, 0}, in_mux_p08, 8); |
| 236 |
} |
| 237 |
|
| 238 |
void route_mult_x1y2_lower(Context *ctx, NetInfo *net, CellInfo *lower, Loc loc, bool is_fourgroup_a) |
| 239 |
{ |
| 240 |
if (ctx->debug) |
| 241 |
log_info(" routing net '%s' -> IN5 using x1y2\n", net->name.c_str(ctx)); |
| 242 |
|
| 243 |
auto x1y1 = ctx->idf("X%dY%d", loc.x, loc.y); |
| 244 |
auto x2y1 = ctx->idf("X%dY%d", loc.x + 1, loc.y); |
| 245 |
auto x4y1 = ctx->idf("X%dY%d", loc.x + 3, loc.y); |
| 246 |
|
| 247 |
auto cpe_combout1 = ctx->getBelPinWire(lower->bel, id_OUT); |
| 248 |
auto cpe_out1_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT1_int"))); |
| 249 |
auto cpe_out1 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT1"))); |
| 250 |
auto in_mux = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("IM.P05.D2"))); |
| 251 |
|
| 252 |
ctx->bindWire(cpe_combout1, net, STRENGTH_LOCKED); |
| 253 |
find_and_bind_downhill_pip(ctx, cpe_combout1, cpe_out1_int, net); |
| 254 |
find_and_bind_downhill_pip(ctx, cpe_out1_int, cpe_out1, net); |
| 255 |
|
| 256 |
if (is_fourgroup_a) { |
| 257 |
auto sb_sml_p06_d0 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P06.D0"))); |
| 258 |
auto sb_sml_p06_y1_int = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P06.Y1_int"))); |
| 259 |
auto sb_sml_p06_ydiag_int = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P06.YDIAG_int"))); |
| 260 |
auto sb_sml_p06_ydiag = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P06.YDIAG"))); |
| 261 |
auto sb_sml_p05_x23 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P05.X23"))); |
| 262 |
auto sb_sml_p05_ydiag_int = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P05.YDIAG_int"))); |
| 263 |
auto sb_sml_p05_y1_int = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P05.Y1_int"))); |
| 264 |
auto sb_sml_p05_y1 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P05.Y1"))); |
| 265 |
auto sb_big_d2_1 = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_BIG.P05.D2_1"))); |
| 266 |
auto sb_big_y1 = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_BIG.P05.Y1"))); |
| 267 |
auto sb_big_ydiag = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_BIG.P05.YDIAG"))); |
| 268 |
auto sb_big_y3 = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_BIG.P05.Y3"))); |
| 269 |
|
| 270 |
find_and_bind_downhill_pip(ctx, cpe_out1, sb_sml_p06_d0, net); |
| 271 |
find_and_bind_downhill_pip(ctx, sb_sml_p06_d0, sb_sml_p06_y1_int, net); |
| 272 |
find_and_bind_downhill_pip(ctx, sb_sml_p06_y1_int, sb_sml_p06_ydiag_int, net); |
| 273 |
find_and_bind_downhill_pip(ctx, sb_sml_p06_ydiag_int, sb_sml_p06_ydiag, net); |
| 274 |
find_and_bind_downhill_pip(ctx, sb_sml_p06_ydiag, sb_sml_p05_x23, net); |
| 275 |
find_and_bind_downhill_pip(ctx, sb_sml_p05_x23, sb_sml_p05_ydiag_int, net); |
| 276 |
find_and_bind_downhill_pip(ctx, sb_sml_p05_ydiag_int, sb_sml_p05_y1_int, net); |
| 277 |
find_and_bind_downhill_pip(ctx, sb_sml_p05_y1_int, sb_sml_p05_y1, net); |
| 278 |
find_and_bind_downhill_pip(ctx, sb_sml_p05_y1, sb_big_d2_1, net); |
| 279 |
find_and_bind_downhill_pip(ctx, sb_big_d2_1, sb_big_y1, net); |
| 280 |
find_and_bind_downhill_pip(ctx, sb_big_y1, sb_big_ydiag, net); |
| 281 |
find_and_bind_downhill_pip(ctx, sb_big_ydiag, sb_big_y3, net); |
| 282 |
find_and_bind_downhill_pip(ctx, sb_big_y3, in_mux, net); |
| 283 |
} else { |
| 284 |
auto sb_big_p06_d0 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_BIG.P06.D0"))); |
| 285 |
auto sb_big_p06_y1 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_BIG.P06.Y1"))); |
| 286 |
auto sb_big_p06_ydiag = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_BIG.P06.YDIAG"))); |
| 287 |
auto sb_big_p05_x23 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_BIG.P05.X23"))); |
| 288 |
auto sb_big_p05_ydiag = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_BIG.P05.YDIAG"))); |
| 289 |
auto sb_big_p05_y1 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_BIG.P05.Y1"))); |
| 290 |
auto sb_sml_d2_1 = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_SML.P05.D2_1"))); |
| 291 |
auto sb_sml_y1_int = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_SML.P05.Y1_int"))); |
| 292 |
auto sb_sml_ydiag_int = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_SML.P05.YDIAG_int"))); |
| 293 |
auto sb_sml_y3_int = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_SML.P05.Y3_int"))); |
| 294 |
auto sb_sml_y3 = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_SML.P05.Y3"))); |
| 295 |
|
| 296 |
find_and_bind_downhill_pip(ctx, cpe_out1, sb_big_p06_d0, net); |
| 297 |
find_and_bind_downhill_pip(ctx, sb_big_p06_d0, sb_big_p06_y1, net); |
| 298 |
find_and_bind_downhill_pip(ctx, sb_big_p06_y1, sb_big_p06_ydiag, net); |
| 299 |
find_and_bind_downhill_pip(ctx, sb_big_p06_ydiag, sb_big_p05_x23, net); |
| 300 |
find_and_bind_downhill_pip(ctx, sb_big_p05_x23, sb_big_p05_ydiag, net); |
| 301 |
find_and_bind_downhill_pip(ctx, sb_big_p05_ydiag, sb_big_p05_y1, net); |
| 302 |
find_and_bind_downhill_pip(ctx, sb_big_p05_y1, sb_sml_d2_1, net); |
| 303 |
find_and_bind_downhill_pip(ctx, sb_sml_d2_1, sb_sml_y1_int, net); |
| 304 |
find_and_bind_downhill_pip(ctx, sb_sml_y1_int, sb_sml_ydiag_int, net); |
| 305 |
find_and_bind_downhill_pip(ctx, sb_sml_ydiag_int, sb_sml_y3_int, net); |
| 306 |
find_and_bind_downhill_pip(ctx, sb_sml_y3_int, sb_sml_y3, net); |
| 307 |
find_and_bind_downhill_pip(ctx, sb_sml_y3, in_mux, net); |
| 308 |
} |
| 309 |
|
| 310 |
route_mult_diag(ctx, net, Loc{loc.x + 1, loc.y, 0}, in_mux, 5); |
| 311 |
} |
| 312 |
|
| 313 |
void route_mult_x1y2_upper_in1(Context *ctx, NetInfo *net, CellInfo *upper, Loc loc, bool is_fourgroup_a) |
| 314 |
{ |
| 315 |
if (ctx->debug) |
| 316 |
log_info(" routing net '%s' -> IN1 using x1y2\n", net->name.c_str(ctx)); |
| 317 |
|
| 318 |
auto x1y1 = ctx->idf("X%dY%d", loc.x, loc.y); |
| 319 |
auto x2y1 = ctx->idf("X%dY%d", loc.x + 1, loc.y); |
| 320 |
auto x4y1 = ctx->idf("X%dY%d", loc.x + 3, loc.y); |
| 321 |
|
| 322 |
auto cpe_combout2 = ctx->getBelPinWire(upper->bel, id_OUT); |
| 323 |
auto cpe_out2_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2_int"))); |
| 324 |
auto cpe_out2 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2"))); |
| 325 |
|
| 326 |
ctx->bindWire(cpe_combout2, net, STRENGTH_LOCKED); |
| 327 |
find_and_bind_downhill_pip(ctx, cpe_combout2, cpe_out2_int, net); |
| 328 |
find_and_bind_downhill_pip(ctx, cpe_out2_int, cpe_out2, net); |
| 329 |
|
| 330 |
auto in_mux = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("IM.P01.D2"))); |
| 331 |
|
| 332 |
if (is_fourgroup_a) { |
| 333 |
auto sb_sml_p02_d0 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P02.D0"))); |
| 334 |
auto sb_sml_p02_y1 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P02.Y1_int"))); |
| 335 |
auto sb_sml_p02_ydiag_int = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P02.YDIAG_int"))); |
| 336 |
auto sb_sml_p02_ydiag = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P02.YDIAG"))); |
| 337 |
auto sb_sml_p01_x23 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P01.X23"))); |
| 338 |
auto sb_sml_p01_ydiag = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P01.YDIAG_int"))); |
| 339 |
auto sb_sml_p01_y1_int = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P01.Y1_int"))); |
| 340 |
auto sb_sml_p01_y1 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P01.Y1"))); |
| 341 |
auto sb_big_d2_1 = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_BIG.P01.D2_1"))); |
| 342 |
auto sb_big_y1 = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_BIG.P01.Y1"))); |
| 343 |
auto sb_big_ydiag = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_BIG.P01.YDIAG"))); |
| 344 |
auto sb_big_y3 = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_BIG.P01.Y3"))); |
| 345 |
|
| 346 |
find_and_bind_downhill_pip(ctx, cpe_out2, sb_sml_p02_d0, net); |
| 347 |
find_and_bind_downhill_pip(ctx, sb_sml_p02_d0, sb_sml_p02_y1, net); |
| 348 |
find_and_bind_downhill_pip(ctx, sb_sml_p02_y1, sb_sml_p02_ydiag_int, net); |
| 349 |
find_and_bind_downhill_pip(ctx, sb_sml_p02_ydiag_int, sb_sml_p02_ydiag, net); |
| 350 |
find_and_bind_downhill_pip(ctx, sb_sml_p02_ydiag, sb_sml_p01_x23, net); |
| 351 |
find_and_bind_downhill_pip(ctx, sb_sml_p01_x23, sb_sml_p01_ydiag, net); |
| 352 |
find_and_bind_downhill_pip(ctx, sb_sml_p01_ydiag, sb_sml_p01_y1_int, net); |
| 353 |
find_and_bind_downhill_pip(ctx, sb_sml_p01_y1_int, sb_sml_p01_y1, net); |
| 354 |
find_and_bind_downhill_pip(ctx, sb_sml_p01_y1, sb_big_d2_1, net); |
| 355 |
find_and_bind_downhill_pip(ctx, sb_big_d2_1, sb_big_y1, net); |
| 356 |
find_and_bind_downhill_pip(ctx, sb_big_y1, sb_big_ydiag, net); |
| 357 |
find_and_bind_downhill_pip(ctx, sb_big_ydiag, sb_big_y3, net); |
| 358 |
find_and_bind_downhill_pip(ctx, sb_big_y3, in_mux, net); |
| 359 |
} else { |
| 360 |
auto sb_big_p02_d0 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_BIG.P02.D0"))); |
| 361 |
auto sb_big_p02_y1 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_BIG.P02.Y1"))); |
| 362 |
auto sb_big_p02_ydiag = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_BIG.P02.YDIAG"))); |
| 363 |
auto sb_big_p01_x23 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_BIG.P01.X23"))); |
| 364 |
auto sb_big_p01_ydiag = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_BIG.P01.YDIAG"))); |
| 365 |
auto sb_big_p01_y1 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_BIG.P01.Y1"))); |
| 366 |
auto sb_sml_d2_1 = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_SML.P01.D2_1"))); |
| 367 |
auto sb_sml_y1 = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_SML.P01.Y1_int"))); |
| 368 |
auto sb_sml_ydiag = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_SML.P01.YDIAG_int"))); |
| 369 |
auto sb_sml_y3_int = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_SML.P01.Y3_int"))); |
| 370 |
auto sb_sml_y3 = ctx->getWireByName(IdStringList::concat(x4y1, ctx->idf("SB_SML.P01.Y3"))); |
| 371 |
|
| 372 |
find_and_bind_downhill_pip(ctx, cpe_out2, sb_big_p02_d0, net); |
| 373 |
find_and_bind_downhill_pip(ctx, sb_big_p02_d0, sb_big_p02_y1, net); |
| 374 |
find_and_bind_downhill_pip(ctx, sb_big_p02_y1, sb_big_p02_ydiag, net); |
| 375 |
find_and_bind_downhill_pip(ctx, sb_big_p02_ydiag, sb_big_p01_x23, net); |
| 376 |
find_and_bind_downhill_pip(ctx, sb_big_p01_x23, sb_big_p01_ydiag, net); |
| 377 |
find_and_bind_downhill_pip(ctx, sb_big_p01_ydiag, sb_big_p01_y1, net); |
| 378 |
find_and_bind_downhill_pip(ctx, sb_big_p01_y1, sb_sml_d2_1, net); |
| 379 |
find_and_bind_downhill_pip(ctx, sb_sml_d2_1, sb_sml_y1, net); |
| 380 |
find_and_bind_downhill_pip(ctx, sb_sml_y1, sb_sml_ydiag, net); |
| 381 |
find_and_bind_downhill_pip(ctx, sb_sml_ydiag, sb_sml_y3_int, net); |
| 382 |
find_and_bind_downhill_pip(ctx, sb_sml_y3_int, sb_sml_y3, net); |
| 383 |
find_and_bind_downhill_pip(ctx, sb_sml_y3, in_mux, net); |
| 384 |
} |
| 385 |
|
| 386 |
route_mult_diag(ctx, net, Loc{loc.x + 1, loc.y, 0}, in_mux, 1); |
| 387 |
} |
| 388 |
|
| 389 |
void route_mult_x1y2_upper_in8(Context *ctx, NetInfo *net, CellInfo *upper, Loc loc, bool is_fourgroup_a, |
| 390 |
bool bind_route_start = false) |
| 391 |
{ |
| 392 |
if (ctx->debug) |
| 393 |
log_info(" routing net '%s' -> IN8 using x1y2\n", net->name.c_str(ctx)); |
| 394 |
|
| 395 |
auto x1y1 = ctx->idf("X%dY%d", loc.x, loc.y); |
| 396 |
auto x2y1 = ctx->idf("X%dY%d", loc.x + 1, loc.y); |
| 397 |
auto x2y2 = ctx->idf("X%dY%d", loc.x + 1, loc.y + 1); |
| 398 |
|
| 399 |
auto cpe_combout2 = ctx->getBelPinWire(upper->bel, id_OUT); |
| 400 |
auto cpe_out2_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2_int"))); |
| 401 |
auto cpe_out2 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2"))); |
| 402 |
auto out_mux_d1 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("OM.P10.D1"))); |
| 403 |
auto out_mux_y = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("OM.P10.Y"))); |
| 404 |
auto in_mux_p10 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P10.D1"))); |
| 405 |
|
| 406 |
if (bind_route_start) { |
| 407 |
ctx->bindWire(cpe_combout2, net, STRENGTH_LOCKED); |
| 408 |
find_and_bind_downhill_pip(ctx, cpe_combout2, cpe_out2_int, net); |
| 409 |
find_and_bind_downhill_pip(ctx, cpe_out2_int, cpe_out2, net); |
| 410 |
} |
| 411 |
|
| 412 |
find_and_bind_downhill_pip(ctx, cpe_out2, out_mux_d1, net); |
| 413 |
find_and_bind_downhill_pip(ctx, out_mux_d1, out_mux_y, net); // inverting |
| 414 |
|
| 415 |
if (is_fourgroup_a) { |
| 416 |
auto sb_sml_d0 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P10.D0"))); |
| 417 |
auto sb_sml_y2_int = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P10.Y2_int"))); |
| 418 |
auto sb_sml_y2 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_SML.P10.Y2"))); |
| 419 |
|
| 420 |
find_and_bind_downhill_pip(ctx, out_mux_y, sb_sml_d0, net); |
| 421 |
find_and_bind_downhill_pip(ctx, sb_sml_d0, sb_sml_y2_int, net); |
| 422 |
find_and_bind_downhill_pip(ctx, sb_sml_y2_int, sb_sml_y2, net); |
| 423 |
find_and_bind_downhill_pip(ctx, sb_sml_y2, in_mux_p10, net); |
| 424 |
} else { |
| 425 |
auto sb_big_d0 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_BIG.P10.D0"))); |
| 426 |
auto sb_big_y2 = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("SB_BIG.P10.Y2"))); |
| 427 |
|
| 428 |
find_and_bind_downhill_pip(ctx, out_mux_y, sb_big_d0, net); |
| 429 |
find_and_bind_downhill_pip(ctx, sb_big_d0, sb_big_y2, net); |
| 430 |
find_and_bind_downhill_pip(ctx, sb_big_y2, in_mux_p10, net); |
| 431 |
} |
| 432 |
|
| 433 |
auto in_mux_p10_y = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P10.Y"))); |
| 434 |
auto in_mux_p12 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P12.D6"))); |
| 435 |
auto in_mux_p12_y = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P12.Y"))); |
| 436 |
auto in_mux_p04 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P04.D7"))); |
| 437 |
auto in_mux_p04_y = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P04.Y"))); |
| 438 |
auto in_mux_p08 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P08.D6"))); |
| 439 |
|
| 440 |
find_and_bind_downhill_pip(ctx, in_mux_p10, in_mux_p10_y, net); |
| 441 |
find_and_bind_downhill_pip(ctx, in_mux_p10_y, in_mux_p12, net); |
| 442 |
find_and_bind_downhill_pip(ctx, in_mux_p12, in_mux_p12_y, net); |
| 443 |
find_and_bind_downhill_pip(ctx, in_mux_p12_y, in_mux_p04, net); |
| 444 |
find_and_bind_downhill_pip(ctx, in_mux_p04, in_mux_p04_y, net); |
| 445 |
find_and_bind_downhill_pip(ctx, in_mux_p04_y, in_mux_p08, net); |
| 446 |
|
| 447 |
route_mult_diag(ctx, net, Loc{loc.x + 1, loc.y + 1, 0}, in_mux_p08, 8); |
| 448 |
} |
| 449 |
|
| 450 |
void route_mult_x2y1_lower(Context *ctx, NetInfo *net, CellInfo *lower, Loc loc, bool is_fourgroup_a) |
| 451 |
{ |
| 452 |
if (ctx->debug) |
| 453 |
log_info(" routing net '%s' -> IN5 using x2y1\n", net->name.c_str(ctx)); |
| 454 |
|
| 455 |
auto x0y1 = ctx->idf("X%dY%d", loc.x - 1, loc.y); |
| 456 |
auto x1y1 = ctx->idf("X%dY%d", loc.x, loc.y); |
| 457 |
auto x2y1 = ctx->idf("X%dY%d", loc.x + 1, loc.y); |
| 458 |
|
| 459 |
auto cpe_combout1 = ctx->getBelPinWire(lower->bel, id_OUT); |
| 460 |
auto cpe_out1_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT1_int"))); |
| 461 |
auto cpe_out1 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT1"))); |
| 462 |
auto in_mux = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("IM.P05.D0"))); |
| 463 |
|
| 464 |
ctx->bindWire(cpe_combout1, net, STRENGTH_LOCKED); |
| 465 |
find_and_bind_downhill_pip(ctx, cpe_combout1, cpe_out1_int, net); |
| 466 |
find_and_bind_downhill_pip(ctx, cpe_out1_int, cpe_out1, net); |
| 467 |
|
| 468 |
if (is_fourgroup_a) { |
| 469 |
auto sb_big_p07_d0 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P07.D0"))); |
| 470 |
auto sb_big_p07_y1 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P07.Y1"))); |
| 471 |
auto sb_big_p07_ydiag = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P07.YDIAG"))); |
| 472 |
auto sb_big_p06_x23 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P06.X23"))); |
| 473 |
auto sb_big_p06_ydiag = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P06.YDIAG"))); |
| 474 |
auto sb_big_p05_x23 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P05.X23"))); |
| 475 |
auto sb_big_p05_ydiag = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P05.YDIAG"))); |
| 476 |
auto sb_big_p05_y1 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P05.Y1"))); |
| 477 |
|
| 478 |
find_and_bind_downhill_pip(ctx, cpe_out1, sb_big_p07_d0, net); |
| 479 |
find_and_bind_downhill_pip(ctx, sb_big_p07_d0, sb_big_p07_y1, net); |
| 480 |
find_and_bind_downhill_pip(ctx, sb_big_p07_y1, sb_big_p07_ydiag, net); |
| 481 |
find_and_bind_downhill_pip(ctx, sb_big_p07_ydiag, sb_big_p06_x23, net); |
| 482 |
find_and_bind_downhill_pip(ctx, sb_big_p06_x23, sb_big_p06_ydiag, net); |
| 483 |
find_and_bind_downhill_pip(ctx, sb_big_p06_ydiag, sb_big_p05_x23, net); |
| 484 |
find_and_bind_downhill_pip(ctx, sb_big_p05_x23, sb_big_p05_ydiag, net); |
| 485 |
find_and_bind_downhill_pip(ctx, sb_big_p05_ydiag, sb_big_p05_y1, net); |
| 486 |
find_and_bind_downhill_pip(ctx, sb_big_p05_y1, in_mux, net); |
| 487 |
} else { |
| 488 |
auto sb_sml_p07_d0 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P07.D0"))); |
| 489 |
auto sb_sml_p07_y1_int = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P07.Y1_int"))); |
| 490 |
auto sb_sml_p07_ydiag_int = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P07.YDIAG_int"))); |
| 491 |
auto sb_sml_p07_ydiag = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P07.YDIAG"))); |
| 492 |
auto sb_sml_p06_x23 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P06.X23"))); |
| 493 |
auto sb_sml_p06_ydiag_int = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P06.YDIAG_int"))); |
| 494 |
auto sb_sml_p06_ydiag = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P06.YDIAG"))); |
| 495 |
auto sb_sml_p05_x23 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P05.X23"))); |
| 496 |
auto sb_sml_p05_ydiag_int = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P05.YDIAG_int"))); |
| 497 |
auto sb_sml_p05_y1_int = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P05.Y1_int"))); |
| 498 |
auto sb_sml_p05_y1 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P05.Y1"))); |
| 499 |
|
| 500 |
find_and_bind_downhill_pip(ctx, cpe_out1, sb_sml_p07_d0, net); |
| 501 |
find_and_bind_downhill_pip(ctx, sb_sml_p07_d0, sb_sml_p07_y1_int, net); |
| 502 |
find_and_bind_downhill_pip(ctx, sb_sml_p07_y1_int, sb_sml_p07_ydiag_int, net); |
| 503 |
find_and_bind_downhill_pip(ctx, sb_sml_p07_ydiag_int, sb_sml_p07_ydiag, net); |
| 504 |
find_and_bind_downhill_pip(ctx, sb_sml_p07_ydiag, sb_sml_p06_x23, net); |
| 505 |
find_and_bind_downhill_pip(ctx, sb_sml_p06_x23, sb_sml_p06_ydiag_int, net); |
| 506 |
find_and_bind_downhill_pip(ctx, sb_sml_p06_ydiag_int, sb_sml_p06_ydiag, net); |
| 507 |
find_and_bind_downhill_pip(ctx, sb_sml_p06_ydiag, sb_sml_p05_x23, net); |
| 508 |
find_and_bind_downhill_pip(ctx, sb_sml_p05_x23, sb_sml_p05_ydiag_int, net); |
| 509 |
find_and_bind_downhill_pip(ctx, sb_sml_p05_ydiag_int, sb_sml_p05_y1_int, net); |
| 510 |
find_and_bind_downhill_pip(ctx, sb_sml_p05_y1_int, sb_sml_p05_y1, net); |
| 511 |
find_and_bind_downhill_pip(ctx, sb_sml_p05_y1, in_mux, net); |
| 512 |
} |
| 513 |
|
| 514 |
route_mult_diag(ctx, net, Loc{loc.x + 1, loc.y, 0}, in_mux, 5); |
| 515 |
} |
| 516 |
|
| 517 |
void route_mult_x2y1_upper_in1(Context *ctx, NetInfo *net, CellInfo *upper, Loc loc, bool is_fourgroup_a) |
| 518 |
{ |
| 519 |
if (ctx->debug) |
| 520 |
log_info(" routing net '%s' -> IN1 using x2y1\n", net->name.c_str(ctx)); |
| 521 |
|
| 522 |
auto x0y1 = ctx->idf("X%dY%d", loc.x - 1, loc.y); |
| 523 |
auto x1y1 = ctx->idf("X%dY%d", loc.x, loc.y); |
| 524 |
auto x2y1 = ctx->idf("X%dY%d", loc.x + 1, loc.y); |
| 525 |
|
| 526 |
auto cpe_combout2 = ctx->getBelPinWire(upper->bel, id_OUT); |
| 527 |
auto cpe_out2_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2_int"))); |
| 528 |
auto cpe_out2 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2"))); |
| 529 |
auto in_mux = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("IM.P01.D0"))); |
| 530 |
|
| 531 |
ctx->bindWire(cpe_combout2, net, STRENGTH_LOCKED); |
| 532 |
find_and_bind_downhill_pip(ctx, cpe_combout2, cpe_out2_int, net); |
| 533 |
find_and_bind_downhill_pip(ctx, cpe_out2_int, cpe_out2, net); |
| 534 |
|
| 535 |
if (is_fourgroup_a) { |
| 536 |
auto sb_big_p03_d0 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P03.D0"))); |
| 537 |
auto sb_big_p03_y1 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P03.Y1"))); |
| 538 |
auto sb_big_p03_ydiag = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P03.YDIAG"))); |
| 539 |
auto sb_big_p02_x23 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P02.X23"))); |
| 540 |
auto sb_big_p02_ydiag = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P02.YDIAG"))); |
| 541 |
auto sb_big_p01_x23 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P01.X23"))); |
| 542 |
auto sb_big_p01_ydiag = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P01.YDIAG"))); |
| 543 |
auto sb_big_p01_y1 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_BIG.P01.Y1"))); |
| 544 |
|
| 545 |
find_and_bind_downhill_pip(ctx, cpe_out2, sb_big_p03_d0, net); |
| 546 |
find_and_bind_downhill_pip(ctx, sb_big_p03_d0, sb_big_p03_y1, net); |
| 547 |
find_and_bind_downhill_pip(ctx, sb_big_p03_y1, sb_big_p03_ydiag, net); |
| 548 |
find_and_bind_downhill_pip(ctx, sb_big_p03_ydiag, sb_big_p02_x23, net); |
| 549 |
find_and_bind_downhill_pip(ctx, sb_big_p02_x23, sb_big_p02_ydiag, net); |
| 550 |
find_and_bind_downhill_pip(ctx, sb_big_p02_ydiag, sb_big_p01_x23, net); |
| 551 |
find_and_bind_downhill_pip(ctx, sb_big_p01_x23, sb_big_p01_ydiag, net); |
| 552 |
find_and_bind_downhill_pip(ctx, sb_big_p01_ydiag, sb_big_p01_y1, net); |
| 553 |
find_and_bind_downhill_pip(ctx, sb_big_p01_y1, in_mux, net); |
| 554 |
} else { |
| 555 |
auto sb_sml_p03_d0 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P03.D0"))); |
| 556 |
auto sb_sml_p03_y1_int = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P03.Y1_int"))); |
| 557 |
auto sb_sml_p03_ydiag_int = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P03.YDIAG_int"))); |
| 558 |
auto sb_sml_p03_ydiag = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P03.YDIAG"))); |
| 559 |
auto sb_sml_p02_x23 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P02.X23"))); |
| 560 |
auto sb_sml_p02_ydiag_int = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P02.YDIAG_int"))); |
| 561 |
auto sb_sml_p02_ydiag = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P02.YDIAG"))); |
| 562 |
auto sb_sml_p01_x23 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P01.X23"))); |
| 563 |
auto sb_sml_p01_ydiag_int = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P01.YDIAG_int"))); |
| 564 |
auto sb_sml_p01_y1_int = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P01.Y1_int"))); |
| 565 |
auto sb_sml_p01_y1 = ctx->getWireByName(IdStringList::concat(x0y1, ctx->idf("SB_SML.P01.Y1"))); |
| 566 |
|
| 567 |
find_and_bind_downhill_pip(ctx, cpe_out2, sb_sml_p03_d0, net); |
| 568 |
find_and_bind_downhill_pip(ctx, sb_sml_p03_d0, sb_sml_p03_y1_int, net); |
| 569 |
find_and_bind_downhill_pip(ctx, sb_sml_p03_y1_int, sb_sml_p03_ydiag_int, net); |
| 570 |
find_and_bind_downhill_pip(ctx, sb_sml_p03_ydiag_int, sb_sml_p03_ydiag, net); |
| 571 |
find_and_bind_downhill_pip(ctx, sb_sml_p03_ydiag, sb_sml_p02_x23, net); |
| 572 |
find_and_bind_downhill_pip(ctx, sb_sml_p02_x23, sb_sml_p02_ydiag_int, net); |
| 573 |
find_and_bind_downhill_pip(ctx, sb_sml_p02_ydiag_int, sb_sml_p02_ydiag, net); |
| 574 |
find_and_bind_downhill_pip(ctx, sb_sml_p02_ydiag, sb_sml_p01_x23, net); |
| 575 |
find_and_bind_downhill_pip(ctx, sb_sml_p01_x23, sb_sml_p01_ydiag_int, net); |
| 576 |
find_and_bind_downhill_pip(ctx, sb_sml_p01_ydiag_int, sb_sml_p01_y1_int, net); |
| 577 |
find_and_bind_downhill_pip(ctx, sb_sml_p01_y1_int, sb_sml_p01_y1, net); |
| 578 |
find_and_bind_downhill_pip(ctx, sb_sml_p01_y1, in_mux, net); |
| 579 |
} |
| 580 |
|
| 581 |
route_mult_diag(ctx, net, Loc{loc.x + 1, loc.y, 0}, in_mux, 1); |
| 582 |
} |
| 583 |
|
| 584 |
void route_mult_x2y1_upper_in8(Context *ctx, NetInfo *net, CellInfo *upper, Loc loc, bool is_fourgroup_a, |
| 585 |
bool bind_route_start = false) |
| 586 |
{ |
| 587 |
if (ctx->debug) |
| 588 |
log_info(" routing net '%s' -> IN8 using x2y1\n", net->name.c_str(ctx)); |
| 589 |
|
| 590 |
auto x1y1 = ctx->idf("X%dY%d", loc.x, loc.y); |
| 591 |
auto x1y2 = ctx->idf("X%dY%d", loc.x, loc.y + 1); |
| 592 |
auto x2y2 = ctx->idf("X%dY%d", loc.x + 1, loc.y + 1); |
| 593 |
|
| 594 |
auto cpe_combout2 = ctx->getBelPinWire(upper->bel, id_OUT); |
| 595 |
auto cpe_out2_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2_int"))); |
| 596 |
auto cpe_out2 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2"))); |
| 597 |
auto out_mux_d2 = ctx->getWireByName(IdStringList::concat(x1y2, ctx->idf("OM.P09.D2"))); |
| 598 |
auto out_mux_y = ctx->getWireByName(IdStringList::concat(x1y2, ctx->idf("OM.P09.Y"))); |
| 599 |
auto in_mux_p09 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P09.D0"))); |
| 600 |
|
| 601 |
if (bind_route_start) { |
| 602 |
ctx->bindWire(cpe_combout2, net, STRENGTH_LOCKED); |
| 603 |
find_and_bind_downhill_pip(ctx, cpe_combout2, cpe_out2_int, net); |
| 604 |
find_and_bind_downhill_pip(ctx, cpe_out2_int, cpe_out2, net); |
| 605 |
} |
| 606 |
|
| 607 |
find_and_bind_downhill_pip(ctx, cpe_out2, out_mux_d2, net); |
| 608 |
find_and_bind_downhill_pip(ctx, out_mux_d2, out_mux_y, net); // inverting |
| 609 |
|
| 610 |
if (is_fourgroup_a) { |
| 611 |
auto sb_sml_d0 = ctx->getWireByName(IdStringList::concat(x1y2, ctx->idf("SB_SML.P09.D0"))); |
| 612 |
auto sb_sml_y1_int = ctx->getWireByName(IdStringList::concat(x1y2, ctx->idf("SB_SML.P09.Y1_int"))); |
| 613 |
auto sb_sml_y1 = ctx->getWireByName(IdStringList::concat(x1y2, ctx->idf("SB_SML.P09.Y1"))); |
| 614 |
|
| 615 |
find_and_bind_downhill_pip(ctx, out_mux_y, sb_sml_d0, net); |
| 616 |
find_and_bind_downhill_pip(ctx, sb_sml_d0, sb_sml_y1_int, net); |
| 617 |
find_and_bind_downhill_pip(ctx, sb_sml_y1_int, sb_sml_y1, net); |
| 618 |
find_and_bind_downhill_pip(ctx, sb_sml_y1, in_mux_p09, net); // inverting |
| 619 |
} else { |
| 620 |
auto sb_big_d0 = ctx->getWireByName(IdStringList::concat(x1y2, ctx->idf("SB_BIG.P09.D0"))); |
| 621 |
auto sb_big_y1 = ctx->getWireByName(IdStringList::concat(x1y2, ctx->idf("SB_BIG.P09.Y1"))); |
| 622 |
|
| 623 |
find_and_bind_downhill_pip(ctx, out_mux_y, sb_big_d0, net); |
| 624 |
find_and_bind_downhill_pip(ctx, sb_big_d0, sb_big_y1, net); |
| 625 |
find_and_bind_downhill_pip(ctx, sb_big_y1, in_mux_p09, net); |
| 626 |
} |
| 627 |
|
| 628 |
auto in_mux_p09_y = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P09.Y"))); |
| 629 |
auto in_mux_p12 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P12.D7"))); |
| 630 |
auto in_mux_p12_y = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P12.Y"))); |
| 631 |
auto in_mux_p04 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P04.D7"))); |
| 632 |
auto in_mux_p04_y = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P04.Y"))); |
| 633 |
auto in_mux_p08 = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P08.D6"))); |
| 634 |
|
| 635 |
find_and_bind_downhill_pip(ctx, in_mux_p09, in_mux_p09_y, net); |
| 636 |
find_and_bind_downhill_pip(ctx, in_mux_p09_y, in_mux_p12, net); |
| 637 |
find_and_bind_downhill_pip(ctx, in_mux_p12, in_mux_p12_y, net); |
| 638 |
find_and_bind_downhill_pip(ctx, in_mux_p12_y, in_mux_p04, net); |
| 639 |
find_and_bind_downhill_pip(ctx, in_mux_p04, in_mux_p04_y, net); |
| 640 |
find_and_bind_downhill_pip(ctx, in_mux_p04_y, in_mux_p08, net); |
| 641 |
|
| 642 |
route_mult_diag(ctx, net, Loc{loc.x + 1, loc.y + 1, 0}, in_mux_p08, 8); |
| 643 |
} |
| 644 |
|
| 645 |
void route_mult_x2y2_lower(Context *ctx, NetInfo *net, CellInfo *lower, Loc loc, bool is_fourgroup_a) |
| 646 |
{ |
| 647 |
if (ctx->debug) |
| 648 |
log_info(" routing net '%s' -> IN5 using x2y2\n", net->name.c_str(ctx)); |
| 649 |
|
| 650 |
auto x1y1 = ctx->idf("X%dY%d", loc.x, loc.y); |
| 651 |
auto x2y1 = ctx->idf("X%dY%d", loc.x + 1, loc.y); |
| 652 |
|
| 653 |
auto cpe_combout1 = ctx->getBelPinWire(lower->bel, id_OUT); |
| 654 |
auto cpe_out1_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT1_int"))); |
| 655 |
auto cpe_out1 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT1"))); |
| 656 |
auto in_mux = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("IM.P05.D0"))); |
| 657 |
|
| 658 |
ctx->bindWire(cpe_combout1, net, STRENGTH_LOCKED); |
| 659 |
find_and_bind_downhill_pip(ctx, cpe_combout1, cpe_out1_int, net); |
| 660 |
find_and_bind_downhill_pip(ctx, cpe_out1_int, cpe_out1, net); |
| 661 |
|
| 662 |
if (is_fourgroup_a) { |
| 663 |
auto sb_sml_p08_d0 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P08.D0"))); |
| 664 |
auto sb_sml_p08_y1_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P08.Y1_int"))); |
| 665 |
auto sb_sml_p08_ydiag_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P08.YDIAG_int"))); |
| 666 |
auto sb_sml_p08_ydiag = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P08.YDIAG"))); |
| 667 |
auto sb_sml_p07_x23 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P07.X23"))); |
| 668 |
auto sb_sml_p07_ydiag_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P07.YDIAG_int"))); |
| 669 |
auto sb_sml_p07_ydiag = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P07.YDIAG"))); |
| 670 |
auto sb_sml_p06_x23 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P06.X23"))); |
| 671 |
auto sb_sml_p06_ydiag_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P06.YDIAG_int"))); |
| 672 |
auto sb_sml_p06_ydiag = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P06.YDIAG"))); |
| 673 |
auto sb_sml_p05_x23 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P05.X23"))); |
| 674 |
auto sb_sml_p05_ydiag_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P05.YDIAG_int"))); |
| 675 |
auto sb_sml_p05_y1_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P05.Y1_int"))); |
| 676 |
auto sb_sml_p05_y1 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P05.Y1"))); |
| 677 |
|
| 678 |
find_and_bind_downhill_pip(ctx, cpe_out1, sb_sml_p08_d0, net); |
| 679 |
find_and_bind_downhill_pip(ctx, sb_sml_p08_d0, sb_sml_p08_y1_int, net); |
| 680 |
find_and_bind_downhill_pip(ctx, sb_sml_p08_y1_int, sb_sml_p08_ydiag_int, net); |
| 681 |
find_and_bind_downhill_pip(ctx, sb_sml_p08_ydiag_int, sb_sml_p08_ydiag, net); // inverting |
| 682 |
find_and_bind_downhill_pip(ctx, sb_sml_p08_ydiag, sb_sml_p07_x23, net); |
| 683 |
find_and_bind_downhill_pip(ctx, sb_sml_p07_x23, sb_sml_p07_ydiag_int, net); |
| 684 |
find_and_bind_downhill_pip(ctx, sb_sml_p07_ydiag_int, sb_sml_p07_ydiag, net); // inverting |
| 685 |
find_and_bind_downhill_pip(ctx, sb_sml_p07_ydiag, sb_sml_p06_x23, net); |
| 686 |
find_and_bind_downhill_pip(ctx, sb_sml_p06_x23, sb_sml_p06_ydiag_int, net); |
| 687 |
find_and_bind_downhill_pip(ctx, sb_sml_p06_ydiag_int, sb_sml_p06_ydiag, net); // inverting |
| 688 |
find_and_bind_downhill_pip(ctx, sb_sml_p06_ydiag, sb_sml_p05_x23, net); |
| 689 |
find_and_bind_downhill_pip(ctx, sb_sml_p05_x23, sb_sml_p05_ydiag_int, net); |
| 690 |
find_and_bind_downhill_pip(ctx, sb_sml_p05_ydiag_int, sb_sml_p05_y1_int, net); |
| 691 |
find_and_bind_downhill_pip(ctx, sb_sml_p05_y1_int, sb_sml_p05_y1, net); |
| 692 |
find_and_bind_downhill_pip(ctx, sb_sml_p05_y1, in_mux, net); |
| 693 |
} else { |
| 694 |
auto sb_big_p08_d0 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P08.D0"))); |
| 695 |
auto sb_big_p08_y1 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P08.Y1"))); |
| 696 |
auto sb_big_p08_ydiag = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P08.YDIAG"))); |
| 697 |
auto sb_big_p07_x23 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P07.X23"))); |
| 698 |
auto sb_big_p07_ydiag = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P07.YDIAG"))); |
| 699 |
auto sb_big_p06_x23 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P06.X23"))); |
| 700 |
auto sb_big_p06_ydiag = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P06.YDIAG"))); |
| 701 |
auto sb_big_p05_x23 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P05.X23"))); |
| 702 |
auto sb_big_p05_ydiag = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P05.YDIAG"))); |
| 703 |
auto sb_big_p05_y1 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P05.Y1"))); |
| 704 |
|
| 705 |
find_and_bind_downhill_pip(ctx, cpe_out1, sb_big_p08_d0, net); |
| 706 |
find_and_bind_downhill_pip(ctx, sb_big_p08_d0, sb_big_p08_y1, net); |
| 707 |
find_and_bind_downhill_pip(ctx, sb_big_p08_y1, sb_big_p08_ydiag, net); |
| 708 |
find_and_bind_downhill_pip(ctx, sb_big_p08_ydiag, sb_big_p07_x23, net); |
| 709 |
find_and_bind_downhill_pip(ctx, sb_big_p07_x23, sb_big_p07_ydiag, net); |
| 710 |
find_and_bind_downhill_pip(ctx, sb_big_p07_ydiag, sb_big_p06_x23, net); |
| 711 |
find_and_bind_downhill_pip(ctx, sb_big_p06_x23, sb_big_p06_ydiag, net); |
| 712 |
find_and_bind_downhill_pip(ctx, sb_big_p06_ydiag, sb_big_p05_x23, net); |
| 713 |
find_and_bind_downhill_pip(ctx, sb_big_p05_x23, sb_big_p05_ydiag, net); |
| 714 |
find_and_bind_downhill_pip(ctx, sb_big_p05_ydiag, sb_big_p05_y1, net); |
| 715 |
find_and_bind_downhill_pip(ctx, sb_big_p05_y1, in_mux, net); |
| 716 |
} |
| 717 |
|
| 718 |
route_mult_diag(ctx, net, Loc{loc.x + 1, loc.y, 0}, in_mux, 5); |
| 719 |
} |
| 720 |
|
| 721 |
void route_mult_x2y2_upper_in1(Context *ctx, NetInfo *net, CellInfo *upper, Loc loc, bool is_fourgroup_a) |
| 722 |
{ |
| 723 |
if (ctx->debug) |
| 724 |
log_info(" routing net '%s' -> IN1 using x2y2\n", net->name.c_str(ctx)); |
| 725 |
|
| 726 |
auto x1y1 = ctx->idf("X%dY%d", loc.x, loc.y); |
| 727 |
auto x2y1 = ctx->idf("X%dY%d", loc.x + 1, loc.y); |
| 728 |
|
| 729 |
auto cpe_combout2 = ctx->getBelPinWire(upper->bel, id_OUT); |
| 730 |
auto cpe_out2_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2_int"))); |
| 731 |
auto cpe_out2 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2"))); |
| 732 |
auto in_mux = ctx->getWireByName(IdStringList::concat(x2y1, ctx->idf("IM.P01.D0"))); |
| 733 |
|
| 734 |
ctx->bindWire(cpe_combout2, net, STRENGTH_LOCKED); |
| 735 |
find_and_bind_downhill_pip(ctx, cpe_combout2, cpe_out2_int, net); |
| 736 |
find_and_bind_downhill_pip(ctx, cpe_out2_int, cpe_out2, net); |
| 737 |
|
| 738 |
if (is_fourgroup_a) { |
| 739 |
auto sb_sml_p04_d0 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P04.D0"))); |
| 740 |
auto sb_sml_p04_y1_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P04.Y1_int"))); |
| 741 |
auto sb_sml_p04_ydiag_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P04.YDIAG_int"))); |
| 742 |
auto sb_sml_p04_ydiag = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P04.YDIAG"))); |
| 743 |
auto sb_sml_p03_x23 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P03.X23"))); |
| 744 |
auto sb_sml_p03_ydiag_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P03.YDIAG_int"))); |
| 745 |
auto sb_sml_p03_ydiag = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P03.YDIAG"))); |
| 746 |
auto sb_sml_p02_x23 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P02.X23"))); |
| 747 |
auto sb_sml_p02_ydiag_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P02.YDIAG_int"))); |
| 748 |
auto sb_sml_p02_ydiag = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P02.YDIAG"))); |
| 749 |
auto sb_sml_p01_x23 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P01.X23"))); |
| 750 |
auto sb_sml_p01_ydiag_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P01.YDIAG_int"))); |
| 751 |
auto sb_sml_p01_y1_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P01.Y1_int"))); |
| 752 |
auto sb_sml_p01_y1 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_SML.P01.Y1"))); |
| 753 |
|
| 754 |
find_and_bind_downhill_pip(ctx, cpe_out2, sb_sml_p04_d0, net); |
| 755 |
find_and_bind_downhill_pip(ctx, sb_sml_p04_d0, sb_sml_p04_y1_int, net); |
| 756 |
find_and_bind_downhill_pip(ctx, sb_sml_p04_y1_int, sb_sml_p04_ydiag_int, net); |
| 757 |
find_and_bind_downhill_pip(ctx, sb_sml_p04_ydiag_int, sb_sml_p04_ydiag, net); |
| 758 |
find_and_bind_downhill_pip(ctx, sb_sml_p04_ydiag, sb_sml_p03_x23, net); |
| 759 |
find_and_bind_downhill_pip(ctx, sb_sml_p03_x23, sb_sml_p03_ydiag_int, net); |
| 760 |
find_and_bind_downhill_pip(ctx, sb_sml_p03_ydiag_int, sb_sml_p03_ydiag, net); |
| 761 |
find_and_bind_downhill_pip(ctx, sb_sml_p03_ydiag, sb_sml_p02_x23, net); |
| 762 |
find_and_bind_downhill_pip(ctx, sb_sml_p02_x23, sb_sml_p02_ydiag_int, net); |
| 763 |
find_and_bind_downhill_pip(ctx, sb_sml_p02_ydiag_int, sb_sml_p02_ydiag, net); |
| 764 |
find_and_bind_downhill_pip(ctx, sb_sml_p02_ydiag, sb_sml_p01_x23, net); |
| 765 |
find_and_bind_downhill_pip(ctx, sb_sml_p01_x23, sb_sml_p01_ydiag_int, net); |
| 766 |
find_and_bind_downhill_pip(ctx, sb_sml_p01_ydiag_int, sb_sml_p01_y1_int, net); |
| 767 |
find_and_bind_downhill_pip(ctx, sb_sml_p01_y1_int, sb_sml_p01_y1, net); |
| 768 |
find_and_bind_downhill_pip(ctx, sb_sml_p01_y1, in_mux, net); |
| 769 |
} else { |
| 770 |
auto sb_big_p04_d0 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P04.D0"))); |
| 771 |
auto sb_big_p04_y1 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P04.Y1"))); |
| 772 |
auto sb_big_p04_ydiag = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P04.YDIAG"))); |
| 773 |
auto sb_big_p03_x23 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P03.X23"))); |
| 774 |
auto sb_big_p03_ydiag = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P03.YDIAG"))); |
| 775 |
auto sb_big_p02_x23 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P02.X23"))); |
| 776 |
auto sb_big_p02_ydiag = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P02.YDIAG"))); |
| 777 |
auto sb_big_p01_x23 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P01.X23"))); |
| 778 |
auto sb_big_p01_ydiag = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P01.YDIAG"))); |
| 779 |
auto sb_big_p01_y1 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("SB_BIG.P01.Y1"))); |
| 780 |
|
| 781 |
find_and_bind_downhill_pip(ctx, cpe_out2, sb_big_p04_d0, net); |
| 782 |
find_and_bind_downhill_pip(ctx, sb_big_p04_d0, sb_big_p04_y1, net); |
| 783 |
find_and_bind_downhill_pip(ctx, sb_big_p04_y1, sb_big_p04_ydiag, net); |
| 784 |
find_and_bind_downhill_pip(ctx, sb_big_p04_ydiag, sb_big_p03_x23, net); |
| 785 |
find_and_bind_downhill_pip(ctx, sb_big_p03_x23, sb_big_p03_ydiag, net); |
| 786 |
find_and_bind_downhill_pip(ctx, sb_big_p03_ydiag, sb_big_p02_x23, net); |
| 787 |
find_and_bind_downhill_pip(ctx, sb_big_p02_x23, sb_big_p02_ydiag, net); |
| 788 |
find_and_bind_downhill_pip(ctx, sb_big_p02_ydiag, sb_big_p01_x23, net); |
| 789 |
find_and_bind_downhill_pip(ctx, sb_big_p01_x23, sb_big_p01_ydiag, net); |
| 790 |
find_and_bind_downhill_pip(ctx, sb_big_p01_ydiag, sb_big_p01_y1, net); |
| 791 |
find_and_bind_downhill_pip(ctx, sb_big_p01_y1, in_mux, net); |
| 792 |
} |
| 793 |
|
| 794 |
route_mult_diag(ctx, net, Loc{loc.x + 1, loc.y, 0}, in_mux, 1); |
| 795 |
} |
| 796 |
|
| 797 |
void route_mult_x2y2_upper_in8(Context *ctx, NetInfo *net, CellInfo *upper, Loc loc, bool is_fourgroup_a, |
| 798 |
bool bind_route_start = false) |
| 799 |
{ |
| 800 |
if (ctx->debug) |
| 801 |
log_info(" routing net '%s' -> IN8 using x2y2\n", net->name.c_str(ctx)); |
| 802 |
|
| 803 |
auto x0y0 = ctx->idf("X%dY%d", loc.x - 1, loc.y - 1); |
| 804 |
auto x1y1 = ctx->idf("X%dY%d", loc.x, loc.y); |
| 805 |
auto x2y0 = ctx->idf("X%dY%d", loc.x + 1, loc.y - 1); |
| 806 |
auto x2y2 = ctx->idf("X%dY%d", loc.x + 1, loc.y + 1); |
| 807 |
|
| 808 |
auto cpe_combout2 = ctx->getBelPinWire(upper->bel, id_OUT); |
| 809 |
auto cpe_out2_int = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2_int"))); |
| 810 |
auto cpe_out2 = ctx->getWireByName(IdStringList::concat(x1y1, ctx->idf("CPE.OUT2"))); |
| 811 |
auto in_mux = ctx->getWireByName(IdStringList::concat(x2y2, ctx->idf("IM.P08.D1"))); |
| 812 |
|
| 813 |
if (bind_route_start) { |
| 814 |
ctx->bindWire(cpe_combout2, net, STRENGTH_LOCKED); |
| 815 |
find_and_bind_downhill_pip(ctx, cpe_combout2, cpe_out2_int, net); |
| 816 |
find_and_bind_downhill_pip(ctx, cpe_out2_int, cpe_out2, net); |
| 817 |
} |
| 818 |
|
| 819 |
if (is_fourgroup_a) { |
| 820 |
auto sb_big_d0 = ctx->getWireByName(IdStringList::concat(x0y0, ctx->idf("SB_BIG.P08.D0"))); |
| 821 |
auto sb_big_y1 = ctx->getWireByName(IdStringList::concat(x0y0, ctx->idf("SB_BIG.P08.Y1"))); |
| 822 |
auto sb_sml_d2_1 = ctx->getWireByName(IdStringList::concat(x2y0, ctx->idf("SB_SML.P08.D2_1"))); |
| 823 |
auto sb_sml_y1_int = ctx->getWireByName(IdStringList::concat(x2y0, ctx->idf("SB_SML.P08.Y1_int"))); |
| 824 |
auto sb_sml_ydiag_int = ctx->getWireByName(IdStringList::concat(x2y0, ctx->idf("SB_SML.P08.YDIAG_int"))); |
| 825 |
auto sb_sml_y2_int = ctx->getWireByName(IdStringList::concat(x2y0, ctx->idf("SB_SML.P08.Y2_int"))); |
| 826 |
auto sb_sml_y2 = ctx->getWireByName(IdStringList::concat(x2y0, ctx->idf("SB_SML.P08.Y2"))); |
| 827 |
|
| 828 |
find_and_bind_downhill_pip(ctx, cpe_out2, sb_big_d0, net); |
| 829 |
find_and_bind_downhill_pip(ctx, sb_big_d0, sb_big_y1, net); |
| 830 |
find_and_bind_downhill_pip(ctx, sb_big_y1, sb_sml_d2_1, net); |
| 831 |
find_and_bind_downhill_pip(ctx, sb_sml_d2_1, sb_sml_y1_int, net); |
| 832 |
find_and_bind_downhill_pip(ctx, sb_sml_y1_int, sb_sml_ydiag_int, net); |
| 833 |
find_and_bind_downhill_pip(ctx, sb_sml_ydiag_int, sb_sml_y2_int, net); |
| 834 |
find_and_bind_downhill_pip(ctx, sb_sml_y2_int, sb_sml_y2, net); |
| 835 |
find_and_bind_downhill_pip(ctx, sb_sml_y2, in_mux, net); |
| 836 |
} else { |
| 837 |
auto sb_sml_d0 = ctx->getWireByName(IdStringList::concat(x0y0, ctx->idf("SB_SML.P08.D0"))); |
| 838 |
auto sb_sml_y1_int = ctx->getWireByName(IdStringList::concat(x0y0, ctx->idf("SB_SML.P08.Y1_int"))); |
| 839 |
auto sb_sml_y1 = ctx->getWireByName(IdStringList::concat(x0y0, ctx->idf("SB_SML.P08.Y1"))); |
| 840 |
auto sb_big_d2_1 = ctx->getWireByName(IdStringList::concat(x2y0, ctx->idf("SB_BIG.P08.D2_1"))); |
| 841 |
auto sb_big_y1 = ctx->getWireByName(IdStringList::concat(x2y0, ctx->idf("SB_BIG.P08.Y1"))); |
| 842 |
auto sb_big_ydiag = ctx->getWireByName(IdStringList::concat(x2y0, ctx->idf("SB_BIG.P08.YDIAG"))); |
| 843 |
auto sb_big_y2 = ctx->getWireByName(IdStringList::concat(x2y0, ctx->idf("SB_BIG.P08.Y2"))); |
| 844 |
|
| 845 |
find_and_bind_downhill_pip(ctx, cpe_out2, sb_sml_d0, net); |
| 846 |
find_and_bind_downhill_pip(ctx, sb_sml_d0, sb_sml_y1_int, net); |
| 847 |
find_and_bind_downhill_pip(ctx, sb_sml_y1_int, sb_sml_y1, net); |
| 848 |
find_and_bind_downhill_pip(ctx, sb_sml_y1, sb_big_d2_1, net); |
| 849 |
find_and_bind_downhill_pip(ctx, sb_big_d2_1, sb_big_y1, net); |
| 850 |
find_and_bind_downhill_pip(ctx, sb_big_y1, sb_big_ydiag, net); |
| 851 |
find_and_bind_downhill_pip(ctx, sb_big_ydiag, sb_big_y2, net); |
| 852 |
find_and_bind_downhill_pip(ctx, sb_big_y2, in_mux, net); |
| 853 |
} |
| 854 |
|
| 855 |
route_mult_diag(ctx, net, Loc{loc.x + 1, loc.y + 1, 0}, in_mux, 8); |
| 856 |
} |
| 857 |
} // namespace |
| 858 |
|
| 859 |
NEXTPNR_NAMESPACE_BEGIN |
| 860 |
|
| 861 |
void GateMateImpl::route_mult() |
| 862 |
{ |
| 863 |
int x_within_fourgroup, y_within_fourgroup; |
| 864 |
log_info("Routing multipliers...\n"); |
| 865 |
|
| 866 |
// I am fully aware the nextpnr API is absolutely not designed around naming specific pips. |
| 867 |
// Unfortunately, this is the easiest way to describe the specific routing required. |
| 868 |
// Myrtle, please forgive me. |
| 869 |
for (auto a_passthru_lower : this->multiplier_a_passthru_lowers) { |
| 870 |
auto *lower = ctx->cells.at(a_passthru_lower).get(); |
| 871 |
auto *lower_out = lower->ports.at(id_OUT).net; |
| 872 |
|
| 873 |
auto loc = ctx->getBelLocation(lower->bel); |
| 874 |
bool is_fourgroup_a = |
| 875 |
is_fourgroup_a_within_tile(tile_extra_data(lower->bel.tile), x_within_fourgroup, y_within_fourgroup); |
| 876 |
|
| 877 |
if (ctx->debug) { |
| 878 |
log_info(" A passthrough at (%d, %d) has 4-group %c\n", loc.x, loc.y, is_fourgroup_a ? 'A' : 'B'); |
| 879 |
|
| 880 |
log_info(" lower.OUT [OUT1] = %s\n", ctx->nameOfWire(ctx->getBelPinWire(lower->bel, id_OUT))); |
| 881 |
for (auto sink_port : lower->ports.at(id_OUT).net->users) { |
| 882 |
auto sink_loc = ctx->getBelLocation(sink_port.cell->bel); |
| 883 |
log_info(" -> %s.%s at (%d, %d)\n", sink_port.cell->name.c_str(ctx), sink_port.port.c_str(ctx), |
| 884 |
sink_loc.x, sink_loc.y); |
| 885 |
} |
| 886 |
} |
| 887 |
|
| 888 |
if (x_within_fourgroup == 0 && y_within_fourgroup == 0) { |
| 889 |
route_mult_x1y1_lower(ctx, lower_out, lower, loc, is_fourgroup_a); |
| 890 |
} else if (x_within_fourgroup == 0 && y_within_fourgroup == 1) { |
| 891 |
route_mult_x1y2_lower(ctx, lower_out, lower, loc, is_fourgroup_a); |
| 892 |
} else if (x_within_fourgroup == 1 && y_within_fourgroup == 0) { |
| 893 |
route_mult_x2y1_lower(ctx, lower_out, lower, loc, is_fourgroup_a); |
| 894 |
} else /* if (x_within_fourgroup == 1 && y_within_fourgroup == 1) */ { |
| 895 |
route_mult_x2y2_lower(ctx, lower_out, lower, loc, is_fourgroup_a); |
| 896 |
} |
| 897 |
} |
| 898 |
|
| 899 |
for (auto a_passthru_upper : this->multiplier_a_passthru_uppers) { |
| 900 |
auto *upper = ctx->cells.at(a_passthru_upper).get(); |
| 901 |
auto *upper_out = upper->ports.at(id_OUT).net; |
| 902 |
|
| 903 |
auto loc = ctx->getBelLocation(upper->bel); |
| 904 |
bool is_fourgroup_a = |
| 905 |
is_fourgroup_a_within_tile(tile_extra_data(upper->bel.tile), x_within_fourgroup, y_within_fourgroup); |
| 906 |
|
| 907 |
bool needs_in8_route = false; |
| 908 |
|
| 909 |
if (ctx->debug) { |
| 910 |
log_info(" A passthrough at (%d, %d) has 4-group %c\n", loc.x, loc.y, is_fourgroup_a ? 'A' : 'B'); |
| 911 |
|
| 912 |
log_info(" upper.OUT [OUT2] = %s\n", ctx->nameOfWire(ctx->getBelPinWire(upper->bel, id_OUT))); |
| 913 |
} |
| 914 |
for (auto sink_port : upper->ports.at(id_OUT).net->users) { |
| 915 |
if (sink_port.port == id_IN8) |
| 916 |
needs_in8_route = true; |
| 917 |
auto sink_loc = ctx->getBelLocation(sink_port.cell->bel); |
| 918 |
if (ctx->debug) |
| 919 |
log_info(" -> %s.%s at (%d, %d)\n", sink_port.cell->name.c_str(ctx), sink_port.port.c_str(ctx), |
| 920 |
sink_loc.x, sink_loc.y); |
| 921 |
} |
| 922 |
|
| 923 |
if (x_within_fourgroup == 0 && y_within_fourgroup == 0) { |
| 924 |
route_mult_x1y1_upper_in1(ctx, upper_out, upper, loc, is_fourgroup_a); |
| 925 |
if (needs_in8_route) |
| 926 |
route_mult_x1y1_upper_in8(ctx, upper_out, upper, loc, is_fourgroup_a); |
| 927 |
} else if (x_within_fourgroup == 0 && y_within_fourgroup == 1) { |
| 928 |
route_mult_x1y2_upper_in1(ctx, upper_out, upper, loc, is_fourgroup_a); |
| 929 |
if (needs_in8_route) |
| 930 |
route_mult_x1y2_upper_in8(ctx, upper_out, upper, loc, is_fourgroup_a); |
| 931 |
} else if (x_within_fourgroup == 1 && y_within_fourgroup == 0) { |
| 932 |
route_mult_x2y1_upper_in1(ctx, upper_out, upper, loc, is_fourgroup_a); |
| 933 |
if (needs_in8_route) |
| 934 |
route_mult_x2y1_upper_in8(ctx, upper_out, upper, loc, is_fourgroup_a); |
| 935 |
} else /* if (x_within_fourgroup == 1 && y_within_fourgroup == 1) */ { |
| 936 |
route_mult_x2y2_upper_in1(ctx, upper_out, upper, loc, is_fourgroup_a); |
| 937 |
if (needs_in8_route) |
| 938 |
route_mult_x2y2_upper_in8(ctx, upper_out, upper, loc, is_fourgroup_a); |
| 939 |
} |
| 940 |
} |
| 941 |
|
| 942 |
for (auto zero_driver_name : this->multiplier_zero_drivers) { |
| 943 |
auto *zero_driver = ctx->cells.at(zero_driver_name).get(); |
| 944 |
auto *out = zero_driver->ports.at(id_OUT).net; |
| 945 |
|
| 946 |
auto loc = ctx->getBelLocation(zero_driver->bel); |
| 947 |
bool is_fourgroup_a = is_fourgroup_a_within_tile(tile_extra_data(zero_driver->bel.tile), x_within_fourgroup, |
| 948 |
y_within_fourgroup); |
| 949 |
|
| 950 |
if (ctx->debug) { |
| 951 |
log_info(" Zero driver at (%d, %d) has 4-group %c\n", loc.x, loc.y, is_fourgroup_a ? 'A' : 'B'); |
| 952 |
|
| 953 |
log_info(" zero_driver.OUT [OUT2] = %s\n", |
| 954 |
ctx->nameOfWire(ctx->getBelPinWire(zero_driver->bel, id_OUT))); |
| 955 |
for (auto sink_port : zero_driver->ports.at(id_OUT).net->users) { |
| 956 |
auto sink_loc = ctx->getBelLocation(sink_port.cell->bel); |
| 957 |
log_info(" -> %s.%s at (%d, %d)\n", sink_port.cell->name.c_str(ctx), sink_port.port.c_str(ctx), |
| 958 |
sink_loc.x, sink_loc.y); |
| 959 |
} |
| 960 |
} |
| 961 |
|
| 962 |
if (x_within_fourgroup == 0 && y_within_fourgroup == 0) { |
| 963 |
route_mult_x1y1_upper_in8(ctx, out, zero_driver, loc, is_fourgroup_a, /*bind_route_start=*/true); |
| 964 |
} else if (x_within_fourgroup == 0 && y_within_fourgroup == 1) { |
| 965 |
route_mult_x1y2_upper_in8(ctx, out, zero_driver, loc, is_fourgroup_a, /*bind_route_start=*/true); |
| 966 |
} else if (x_within_fourgroup == 1 && y_within_fourgroup == 0) { |
| 967 |
route_mult_x2y1_upper_in8(ctx, out, zero_driver, loc, is_fourgroup_a, /*bind_route_start=*/true); |
| 968 |
} else /* if (x_within_fourgroup == 1 && y_within_fourgroup == 1) */ { |
| 969 |
route_mult_x2y2_upper_in8(ctx, out, zero_driver, loc, is_fourgroup_a, /*bind_route_start=*/true); |
| 970 |
} |
| 971 |
} |
| 972 |
} |
| 973 |
|
| 974 |
NEXTPNR_NAMESPACE_END |