From 15a1d4f582e9d1706665fd862ade9ef3671ec8d6 Mon Sep 17 00:00:00 2001 From: David Shah Date: Fri, 7 Jun 2019 11:55:20 +0100 Subject: ecp5: Use an attribute to store is_global Signed-off-by: David Shah --- ecp5/arch.cc | 3 ++- ecp5/globals.cc | 2 +- ecp5/pack.cc | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ecp5/arch.cc b/ecp5/arch.cc index b5ffa5dc..1abbd2aa 100644 --- a/ecp5/arch.cc +++ b/ecp5/arch.cc @@ -531,6 +531,7 @@ bool Arch::place() bool Arch::route() { route_ecp5_globals(getCtx()); + assignArchInfo(); assign_budget(getCtx(), true); bool result = router1(getCtx(), Router1Cfg(getCtx())); @@ -994,7 +995,7 @@ void Arch::archInfoToAttributes() for (auto &net : getCtx()->nets) { auto ni = net.second.get(); ni->attrs[id("IS_GLOBAL")] = ni->is_global ? "1" : "0"; - } + } } void Arch::attributesToArchInfo() diff --git a/ecp5/globals.cc b/ecp5/globals.cc index fae2c683..026f3a85 100644 --- a/ecp5/globals.cc +++ b/ecp5/globals.cc @@ -382,7 +382,7 @@ class Ecp5GlobalRouter glbnet->name = ctx->id("$glbnet$" + net->name.str(ctx)); glbnet->driver.cell = dcc.get(); glbnet->driver.port = id_CLKO; - glbnet->is_global = true; + glbnet->attrs[ctx->id("ECP5_IS_GLOBAL")] = "1"; dcc->ports[id_CLKO].net = glbnet.get(); std::vector keep_users; diff --git a/ecp5/pack.cc b/ecp5/pack.cc index 5b924759..20130aad 100644 --- a/ecp5/pack.cc +++ b/ecp5/pack.cc @@ -1508,7 +1508,8 @@ class Ecp5Packer std::unique_ptr promoted_ecknet(new NetInfo); promoted_ecknet->name = eckname; - promoted_ecknet->is_global = true; // Prevents router etc touching this special net + promoted_ecknet->attrs[ctx->id("ECP5_IS_GLOBAL")] = + "1"; // Prevents router etc touching this special net eclk.buf = promoted_ecknet.get(); NPNR_ASSERT(!ctx->nets.count(eckname)); ctx->nets[eckname] = std::move(promoted_ecknet); @@ -1654,7 +1655,7 @@ class Ecp5Packer port.c_str(ctx), ci->name.c_str(ctx), usr.port.c_str(ctx), usr.cell->name.c_str(ctx)); } - pn->is_global = true; + pn->attrs[ctx->id("ECP5_IS_GLOBAL")] = "1"; } for (auto zport : @@ -2470,6 +2471,9 @@ void Arch::assignArchInfo() ci->sliceInfo.has_l6mux = true; } } + for (auto net : sorted(nets)) { + net.second->is_global = bool_or_default(net.second->attrs, id("ECP5_IS_GLOBAL")); + } } NEXTPNR_NAMESPACE_END -- cgit v1.2.3