Skip to content

Commit f10d522

Browse files
committed
Clock prerouting Gowin fix?
1 parent b7f91e5 commit f10d522

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

himbaechel/uarch/gowin/constids.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,4 +1192,5 @@ X(HCLK_OUT3)
11921192
X(BUFG)
11931193
X(CLOCK)
11941194

1195-
1195+
// Globally routed
1196+
X(GLOBALLY_ROUTED)

himbaechel/uarch/gowin/globals.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,10 @@ struct GowinGlobalRouter
196196
}
197197
if (routed == NOT_ROUTED) {
198198
ctx->unbindWire(src);
199+
} else {
200+
net->attrs[id_GLOBALLY_ROUTED] = Property("YES");
199201
}
202+
200203
return routed;
201204
}
202205

@@ -233,6 +236,8 @@ struct GowinGlobalRouter
233236
}
234237
if (routed == NOT_ROUTED) {
235238
ctx->unbindWire(src);
239+
} else {
240+
net->attrs[id_GLOBALLY_ROUTED] = Property("YES");
236241
}
237242

238243
// b) route net before buf from whatever to the buf input

himbaechel/uarch/gowin/gowin.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ struct GowinImpl : HimbaechelAPI
4141

4242
// wires
4343
bool checkPipAvail(PipId pip) const override;
44+
bool checkPipAvailForNet(PipId pip, const NetInfo *net) const override;
4445

4546
// Cluster
4647
bool isClusterStrict(const CellInfo *cell) const { return true; }
@@ -188,6 +189,16 @@ void GowinImpl::init(Context *ctx)
188189
// We do not allow the use of global wires that bypass a special router.
189190
bool GowinImpl::checkPipAvail(PipId pip) const { return !gwu.is_global_pip(pip); }
190191

192+
bool GowinImpl::checkPipAvailForNet(PipId pip, const NetInfo *net) const {
193+
if (gwu.is_global_pip(pip)) {
194+
// Available for a globally routed net
195+
auto prop = net->attrs.find(id_GLOBALLY_ROUTED);
196+
return prop != net->attrs.end() && prop->second == Property("YES");
197+
}
198+
199+
return true;
200+
}
201+
191202
void GowinImpl::pack()
192203
{
193204
if (ctx->settings.count(ctx->id("cst.filename"))) {

0 commit comments

Comments
 (0)