diff options
-rw-r--r-- | common/router2.cc | 5 | ||||
-rw-r--r-- | common/timing.cc | 10 | ||||
-rw-r--r-- | common/util.h | 20 | ||||
-rw-r--r-- | ice40/pack.cc | 5 |
4 files changed, 33 insertions, 7 deletions
diff --git a/common/router2.cc b/common/router2.cc index 00760c78..26e78eaa 100644 --- a/common/router2.cc +++ b/common/router2.cc @@ -747,7 +747,7 @@ struct Router2 total_wire_use += int(wire.bound_nets.size()); int overuse = int(wire.bound_nets.size()) - 1; if (overuse > 0) { - wire.hist_cong_cost += overuse * hist_cong_weight; + wire.hist_cong_cost = std::min(1e9, wire.hist_cong_cost + overuse * hist_cong_weight); total_overuse += overuse; overused_wires += 1; for (auto &bound : wire.bound_nets) @@ -1082,7 +1082,8 @@ struct Router2 log_info(" iter=%d wires=%d overused=%d overuse=%d archfail=%s\n", iter, total_wire_use, overused_wires, total_overuse, overused_wires > 0 ? "NA" : std::to_string(arch_fail).c_str()); ++iter; - curr_cong_weight *= cfg.curr_cong_mult; + if (curr_cong_weight < 1e9) + curr_cong_weight *= cfg.curr_cong_mult; } while (!failed_nets.empty()); if (cfg.perf_profile) { std::vector<std::pair<int, IdString>> nets_by_runtime; diff --git a/common/timing.cc b/common/timing.cc index 4e84fffe..ae9a95fe 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -177,10 +177,20 @@ struct Timing // the current output port, increment fanin counter for (auto i : input_ports) { DelayInfo comb_delay; + if (cell.second->ports[i].net->driver.cell == nullptr) + continue; bool is_path = ctx->getCellDelay(cell.second.get(), i, o->name, comb_delay); if (is_path) port_fanin[o]++; } + // If there is no fanin, add the port as a false startpoint + if (!port_fanin.count(o) && !net_data.count(o->net)) { + topographical_order.emplace_back(o->net); + TimingData td; + td.false_startpoint = true; + td.max_arrival = 0; + net_data[o->net][ClockEvent{async_clock, RISING_EDGE}] = td; + } } } } diff --git a/common/util.h b/common/util.h index 2ccfe5d2..9512bd40 100644 --- a/common/util.h +++ b/common/util.h @@ -25,6 +25,8 @@ #include <string> #include "nextpnr.h" +#include "log.h" + NEXTPNR_NAMESPACE_BEGIN // Get a value from a map-style container, returning default if value is not @@ -47,8 +49,9 @@ std::string str_or_default(const Container &ct, const KeyType &key, std::string auto found = ct.find(key); if (found == ct.end()) return def; - else + else { return found->second; + } }; template <typename KeyType> @@ -57,8 +60,11 @@ std::string str_or_default(const std::unordered_map<KeyType, Property> &ct, cons auto found = ct.find(key); if (found == ct.end()) return def; - else + else { + if (!found->second.is_string) + log_error("Expecting string value but got integer %d.\n", int(found->second.intval)); return found->second.as_string(); + } }; // Get a value from a map-style container, converting to int, and returning @@ -79,9 +85,13 @@ int int_or_default(const std::unordered_map<KeyType, Property> &ct, const KeyTyp if (found == ct.end()) return def; else { - if (found->second.is_string) - return std::stoi(found->second.as_string()); - else + if (found->second.is_string) { + try { + return std::stoi(found->second.as_string()); + } catch (std::invalid_argument &e) { + log_error("Expecting numeric value but got '%s'.\n", found->second.as_string().c_str()); + } + } else return found->second.as_int64(); } }; diff --git a/ice40/pack.cc b/ice40/pack.cc index 5b13e9ee..17d004b5 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -66,6 +66,11 @@ static void pack_lut_lutffs(Context *ctx) ctx->nets.erase(o->name); if (dff_bel != dff->attrs.end()) packed->attrs[ctx->id("BEL")] = dff_bel->second; + for (const auto &attr : dff->attrs) { + // BEL is dealt with specially + if (attr.first != ctx->id("BEL")) + packed->attrs[attr.first] = attr.second; + } packed_cells.insert(dff->name); if (ctx->verbose) log_info("packed cell %s into %s\n", dff->name.c_str(ctx), packed->name.c_str(ctx)); |