gowin: Use local aliases

In the Gowin chips, the tiles are connected to each other by a one-hop
wire, among others. There are 4 one-hop wires, of which 2 are shared
between north/south and east/west, have three names: e.g. SN10 and N110
and S110.

But only one of them, the first, occurs as a sink for PIP, that is, you
can not get a route that would pass through the S110 for example.

This commit corrects the names to SN?0 and EW?0 at the wire creation
stage to avoid dead wires.

In addition, the SN?0 and EW?0 are among the few sinks for global clock
wires and now there is the possibility of a more optimal clock routing.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
This commit is contained in:
YRabbit 2022-06-09 08:20:29 +10:00
parent 2da7caf657
commit bd0af4052c

View File

@ -34,6 +34,8 @@
NEXTPNR_NAMESPACE_BEGIN NEXTPNR_NAMESPACE_BEGIN
const PairPOD *pairLookup(const PairPOD *list, const size_t len, const int dest);
// GUI // GUI
void Arch::fixClockSpineDecals(void) void Arch::fixClockSpineDecals(void)
{ {
@ -627,7 +629,15 @@ IdString Arch::wireToGlobal(int &row, int &col, const DatabasePOD *db, IdString
} }
snprintf(buf, 32, "%c%d0", direction, num); snprintf(buf, 32, "%c%d0", direction, num);
wire = id(buf); wire = id(buf);
// local aliases
const TilePOD *tile = db->grid[row * db->cols + col].get();
auto local_alias = pairLookup(tile->aliases.get(), tile->num_aliases, wire.index);
if (local_alias != nullptr) {
wire = IdString(local_alias->src_id);
snprintf(buf, 32, "R%dC%d_%s", row + 1, col + 1, wire.c_str(this));
} else {
snprintf(buf, 32, "R%dC%d_%c%d", row + 1, col + 1, direction, num); snprintf(buf, 32, "R%dC%d_%c%d", row + 1, col + 1, direction, num);
}
return id(buf); return id(buf);
} }
@ -1491,12 +1501,6 @@ Arch::Arch(ArchArgs args) : args(args)
snprintf(buf, 32, "R%dC%d_%s_%s", row + 1, col + 1, srcid.c_str(this), destid.c_str(this)); snprintf(buf, 32, "R%dC%d_%s_%s", row + 1, col + 1, srcid.c_str(this), destid.c_str(this));
IdString pipname = id(buf); IdString pipname = id(buf);
DelayQuad delay = getWireTypeDelay(destid); DelayQuad delay = getWireTypeDelay(destid);
// local alias
auto local_alias = pairLookup(tile->aliases.get(), tile->num_aliases, srcid.index);
if (local_alias != nullptr) {
srcid = IdString(local_alias->src_id);
gsrcname = wireToGlobal(srcrow, srccol, db, srcid);
}
// global alias // global alias
srcid = IdString(pip.src_id); srcid = IdString(pip.src_id);
GlobalAliasPOD alias; GlobalAliasPOD alias;