From 84fec7e82fb76ba5efdfda1c3921889a599b13fe Mon Sep 17 00:00:00 2001 From: David Shah Date: Sat, 18 Jan 2020 15:37:13 +0000 Subject: Fixes for partial reconfig demo Signed-off-by: David Shah --- common/router1.cc | 26 +++++++++++++++++++++++++- frontend/frontend_base.h | 21 +++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/common/router1.cc b/common/router1.cc index 02c817c7..f97cb89b 100644 --- a/common/router1.cc +++ b/common/router1.cc @@ -400,7 +400,7 @@ struct Router1 dst_to_arc[dst_wire] = arc; - if (net_info->wires.count(src_wire) == 0) { + if (net_info->wires.count(dst_wire) == 0) { arc_queue_insert(arc, src_wire, dst_wire); continue; } @@ -527,6 +527,18 @@ struct Router1 conflictWireNet = ctx->getConflictingWireNet(next_wire); if (conflictWireNet == nullptr) continue; + else { + if (conflictWireNet->wires.count(next_wire) && + conflictWireNet->wires.at(next_wire).strength > STRENGTH_STRONG) + continue; + } + } else { + NetInfo *conflicting = ctx->getBoundWireNet(conflictWireWire); + if (conflicting != nullptr) { + if (conflicting->wires.count(conflictWireWire) && + conflicting->wires.at(conflictWireWire).strength > STRENGTH_STRONG) + continue; + } } } @@ -538,6 +550,18 @@ struct Router1 conflictPipNet = ctx->getConflictingPipNet(pip); if (conflictPipNet == nullptr) continue; + else { + if (conflictPipNet->wires.count(next_wire) && + conflictPipNet->wires.at(next_wire).strength > STRENGTH_STRONG) + continue; + } + } else { + NetInfo *conflicting = ctx->getBoundWireNet(conflictPipWire); + if (conflicting != nullptr) { + if (conflicting->wires.count(conflictPipWire) && + conflicting->wires.at(conflictPipWire).strength > STRENGTH_STRONG) + continue; + } } } diff --git a/frontend/frontend_base.h b/frontend/frontend_base.h index df562c9a..fa0e30b9 100644 --- a/frontend/frontend_base.h +++ b/frontend/frontend_base.h @@ -284,6 +284,7 @@ template struct GenericFrontend } import_module_netnames(m, data); import_module_cells(m, data); + import_net_attrs(m, data); if (m.is_toplevel) { import_toplevel_ports(m, data); // Mark design as loaded through nextpnr @@ -410,6 +411,26 @@ template struct GenericFrontend }); } + void import_net_attrs(HierModuleState &m, const mod_dat_t &data) + { + impl.foreach_netname(data, [&](const std::string &basename, const netname_dat_t &nn) { + const auto &bits = impl.get_net_bits(nn); + int width = impl.get_vector_length(bits); + for (int i = 0; i < width; i++) { + if (impl.is_vector_bit_constant(bits, i)) + continue; + int net_bit = impl.get_vector_bit_signal(bits, i); + int mapped_bit = m.net_by_idx(net_bit); + if (mapped_bit != -1) { + NetInfo *ni = net_flatindex.at(mapped_bit); + impl.foreach_attr(nn, [&](const std::string &name, const Property &value) { + ni->attrs[ctx->id(name)] = value; + }); + } + } + }); + } + // Create a new constant net; given a hint for what the name should be and its value NetInfo *create_constant_net(HierModuleState &m, const std::string &name_hint, char constval) { -- cgit v1.2.3 From 9dc8e1e35d7ab1226207b49e89a4de0194b39b81 Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 20 Jan 2020 14:58:38 +0000 Subject: ecp5: Don't reroute existing globals Signed-off-by: David Shah --- ecp5/globals.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ecp5/globals.cc b/ecp5/globals.cc index c0f4b504..6dbd7b6b 100644 --- a/ecp5/globals.cc +++ b/ecp5/globals.cc @@ -457,7 +457,8 @@ class Ecp5GlobalRouter log_info("Promoting globals...\n"); auto clocks = get_clocks(); for (auto clock : clocks) { - bool is_noglobal = bool_or_default(clock->attrs, ctx->id("noglobal"), false); + bool is_noglobal = bool_or_default(clock->attrs, ctx->id("noglobal"), false) || + bool_or_default(clock->attrs, ctx->id("ECP5_IS_GLOBAL"), false); if (is_noglobal) continue; log_info(" promoting clock net %s to global network\n", clock->name.c_str(ctx)); -- cgit v1.2.3 From f1dbb0c4f2242862dd365da8865e059d2c05a310 Mon Sep 17 00:00:00 2001 From: David Shah Date: Tue, 21 Jan 2020 19:06:46 +0000 Subject: Fix latent bug in generic out-of-context IO mode Signed-off-by: David Shah --- generic/pack.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generic/pack.cc b/generic/pack.cc index e92e04c5..f3aa9880 100644 --- a/generic/pack.cc +++ b/generic/pack.cc @@ -263,7 +263,8 @@ static void pack_io(Context *ctx) iob = new_cells.back().get(); } packed_cells.insert(ci->name); - std::copy(ci->attrs.begin(), ci->attrs.end(), std::inserter(iob->attrs, iob->attrs.begin())); + if (iob != nullptr) + std::copy(ci->attrs.begin(), ci->attrs.end(), std::inserter(iob->attrs, iob->attrs.begin())); } } for (auto pcell : packed_cells) { -- cgit v1.2.3