Skip to content

Commit 8a968dc

Browse files
committed
fix missing ZINV_T1 bits when routing tristate IOs with router1
1 parent 4bde997 commit 8a968dc

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

xilinx/fasm.cc

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,52 @@ struct FasmBackend
211211

212212
void write_pip(PipId pip, NetInfo *net)
213213
{
214+
const bool debug_this = false;
215+
214216
pips_by_tile[pip.tile].push_back(pip);
215217

216218
auto dst_intent = ctx->wireIntent(ctx->getPipDstWire(pip));
217219
if (dst_intent == ID_PSEUDO_GND || dst_intent == ID_PSEUDO_VCC)
218220
return;
219221

220222
auto &pd = ctx->locInfo(pip).pip_data[pip.index];
221-
if (pd.flags != PIP_TILE_ROUTING)
223+
if (debug_this) {
224+
IdString src_debug = IdString(ctx->locInfo(pip).wire_data[pd.src_index].name);
225+
IdString dst_debug = IdString(ctx->locInfo(pip).wire_data[pd.dst_index].name);
226+
std::cerr << "==> looking at pip " << ctx->getPipName(pip).str(ctx) << " on tile " << get_tile_name(pip.tile) << " from " << src_debug.c_str(ctx) << " to " << dst_debug.c_str(ctx) << std::endl;
227+
}
228+
229+
if (pd.flags != PIP_TILE_ROUTING && pd.flags != PIP_SITE_INTERNAL)
222230
return;
223231

224232
IdString src = IdString(ctx->locInfo(pip).wire_data[pd.src_index].name);
225233
IdString dst = IdString(ctx->locInfo(pip).wire_data[pd.dst_index].name);
226234

235+
// handle certain site internal pips:
236+
// this is necessary, because in tristate outputs, the
237+
// ZINV_T1 bit needs to be set, because in the OLOGIC tiles the
238+
// tristate control signals are inverted if this bit is not set
239+
// this only applies to router1, because router2 does not generate
240+
// site internal pips here.
241+
if (pd.flags == PIP_SITE_INTERNAL) {
242+
if (src.str(ctx) == "T1" && dst.str(ctx) == "T1INV_OUT") {
243+
auto srcwire_uphill_iter = ctx->getPipsUphill(ctx->getPipSrcWire(pip));
244+
auto uphill = srcwire_uphill_iter.begin();
245+
if (uphill != srcwire_uphill_iter.end()) {
246+
// source wire should be like: LIOI3_X0Y73/IOI_OLOGIC1_T1
247+
auto loc = ctx->getWireName(ctx->getPipSrcWire(*uphill)).str(ctx);
248+
boost::replace_all(loc, "/", ".");
249+
boost::erase_all(loc, "_T1");
250+
boost::replace_all(loc, "IOI_OLOGIC", "OLOGIC_Y");
251+
// the replacements transformed it into : LIOI3_X0Y73.OLOGIC_Y1
252+
if (debug_this) std::cerr << "writing bit " << loc << "." << "ZINV_T1" << std::endl;
253+
out << loc << "." << "ZINV_T1" << std::endl;
254+
}
255+
}
256+
return;
257+
}
258+
259+
// handle tile routing pips
227260
PseudoPipKey ppk{IdString(ctx->locInfo(pip).type), dst, src};
228261

229262
if (pp_config.count(ppk)) {
@@ -240,6 +273,7 @@ struct FasmBackend
240273
c.replace(y0pos, 2, "Y1");
241274
}
242275
}
276+
if (debug_this) std::cerr << "writing pp " << c << " for tile " << tile_name << std::endl;
243277
out << tile_name << "." << c << std::endl;
244278
}
245279
if (!pp.empty())

0 commit comments

Comments
 (0)