diff options
-rw-r--r-- | 3rdparty/QtPropertyBrowser/src/qteditorfactory.cpp | 6 | ||||
-rw-r--r-- | 3rdparty/QtPropertyBrowser/src/qttreepropertybrowser.cpp | 10 | ||||
-rw-r--r-- | 3rdparty/QtPropertyBrowser/src/qtvariantproperty.cpp | 6 | ||||
-rw-r--r-- | 3rdparty/imgui/imgui_internal.h | 3 | ||||
-rw-r--r-- | 3rdparty/json11/json11.cpp | 11 | ||||
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | common/pybindings.cc | 9 | ||||
-rw-r--r-- | common/pywrappers.h | 2 | ||||
-rw-r--r-- | common/router1.cc | 24 | ||||
-rw-r--r-- | ecp5/arch_pybindings.cc | 3 | ||||
-rw-r--r-- | ecp5/bitstream.cc | 4 | ||||
-rw-r--r-- | ecp5/gfx.cc | 4 | ||||
-rw-r--r-- | ecp5/pack.cc | 6 | ||||
-rwxr-xr-x | ecp5/trellis_import.py | 2 | ||||
-rw-r--r-- | frontend/json_frontend.cc | 37 | ||||
-rw-r--r-- | generic/pack.cc | 12 | ||||
-rw-r--r-- | gui/treemodel.cc | 2 | ||||
-rw-r--r-- | json/jsonwrite.cc | 11 |
18 files changed, 77 insertions, 77 deletions
diff --git a/3rdparty/QtPropertyBrowser/src/qteditorfactory.cpp b/3rdparty/QtPropertyBrowser/src/qteditorfactory.cpp index a2ef86c9..7cd130f3 100644 --- a/3rdparty/QtPropertyBrowser/src/qteditorfactory.cpp +++ b/3rdparty/QtPropertyBrowser/src/qteditorfactory.cpp @@ -2207,9 +2207,9 @@ void QtColorEditWidget::buttonClicked() { bool ok = false; QRgb oldRgba = m_color.rgba(); - QRgb newRgba = QColorDialog::getRgba(oldRgba, &ok, this); - if (ok && newRgba != oldRgba) { - setValue(QColor::fromRgba(newRgba)); + QColor newRgba = QColorDialog::getColor(oldRgba, this).rgba(); + if (newRgba.isValid() && newRgba.rgba() != oldRgba) { + setValue(newRgba); emit valueChanged(m_color); } } diff --git a/3rdparty/QtPropertyBrowser/src/qttreepropertybrowser.cpp b/3rdparty/QtPropertyBrowser/src/qttreepropertybrowser.cpp index bdca7dd5..1ed0c983 100644 --- a/3rdparty/QtPropertyBrowser/src/qttreepropertybrowser.cpp +++ b/3rdparty/QtPropertyBrowser/src/qttreepropertybrowser.cpp @@ -132,9 +132,9 @@ public: protected: void mouseMoveEvent(QMouseEvent *event) override; void leaveEvent(QEvent *event) override; - void keyPressEvent(QKeyEvent *event); - void mousePressEvent(QMouseEvent *event); - void drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; + void keyPressEvent(QKeyEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; + void drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; Q_SIGNALS: void hoverPropertyChanged(QtBrowserItem *item); @@ -383,7 +383,7 @@ void QtPropertyEditorDelegate::paint(QPainter *painter, const QStyleOptionViewIt opt.palette.setColor(QPalette::Text, opt.palette.color(QPalette::BrightText)); } else { c = m_editorPrivate->calculatedBackgroundColor(m_editorPrivate->indexToBrowserItem(index)); - if (c.isValid() && (opt.features & QStyleOptionViewItemV2::Alternate)) + if (c.isValid() && (opt.features & QStyleOptionViewItem::Alternate)) c = c.lighter(112); } if (c.isValid()) @@ -609,7 +609,7 @@ void QtTreePropertyBrowserPrivate::propertyInserted(QtBrowserItem *index, QtBrow m_indexToItem[index] = newItem; newItem->setFlags(newItem->flags() | Qt::ItemIsEditable); - m_treeWidget->setItemExpanded(newItem, true); + newItem->setExpanded(true); updateItem(newItem); } diff --git a/3rdparty/QtPropertyBrowser/src/qtvariantproperty.cpp b/3rdparty/QtPropertyBrowser/src/qtvariantproperty.cpp index 03f9688c..12ea87f6 100644 --- a/3rdparty/QtPropertyBrowser/src/qtvariantproperty.cpp +++ b/3rdparty/QtPropertyBrowser/src/qtvariantproperty.cpp @@ -576,7 +576,7 @@ void QtVariantPropertyManagerPrivate::slotValueChanged(QtProperty *property, con void QtVariantPropertyManagerPrivate::slotValueChanged(QtProperty *property, const QKeySequence &val) { QVariant v; - qVariantSetValue(v, val); + v.setValue(val); valueChanged(property, v); } @@ -663,7 +663,7 @@ void QtVariantPropertyManagerPrivate::slotEnumIconsChanged(QtProperty *property, { if (QtVariantProperty *varProp = m_internalToProperty.value(property, 0)) { QVariant v; - qVariantSetValue(v, enumIcons); + v.setValue(enumIcons); emit q_ptr->attributeChanged(varProp, m_enumIconsAttribute, v); } } @@ -1567,7 +1567,7 @@ QVariant QtVariantPropertyManager::attributeValue(const QtProperty *property, co return enumManager->enumNames(internProp); if (attribute == d_ptr->m_enumIconsAttribute) { QVariant v; - qVariantSetValue(v, enumManager->enumIcons(internProp)); + v.setValue(enumManager->enumIcons(internProp)); return v; } return QVariant(); diff --git a/3rdparty/imgui/imgui_internal.h b/3rdparty/imgui/imgui_internal.h index e347e64f..7e06cb63 100644 --- a/3rdparty/imgui/imgui_internal.h +++ b/3rdparty/imgui/imgui_internal.h @@ -27,6 +27,9 @@ #pragma clang diagnostic ignored "-Wunused-function" // for stb_textedit.h #pragma clang diagnostic ignored "-Wmissing-prototypes" // for stb_textedit.h #pragma clang diagnostic ignored "-Wold-style-cast" +#elif defined(__GNUC__) && __GNUC__ >= 8 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wclass-memaccess" #endif //----------------------------------------------------------------------------- diff --git a/3rdparty/json11/json11.cpp b/3rdparty/json11/json11.cpp index 88024e92..faa6cf64 100644 --- a/3rdparty/json11/json11.cpp +++ b/3rdparty/json11/json11.cpp @@ -24,7 +24,8 @@ #include <cmath> #include <cstdlib> #include <cstdio> -#include <limits> +#include <climits> +#include <cerrno> namespace json11 { @@ -589,9 +590,11 @@ struct JsonParser final { return fail("invalid " + esc(str[i]) + " in number"); } - if (str[i] != '.' && str[i] != 'e' && str[i] != 'E' - && (i - start_pos) <= static_cast<size_t>(std::numeric_limits<int>::digits10)) { - return std::atoi(str.c_str() + start_pos); + if (str[i] != '.' && str[i] != 'e' && str[i] != 'E') { + errno = 0; + long val = std::strtol(str.c_str() + start_pos, nullptr, 0); + if (!errno && val >= INT_MIN && val <= INT_MAX) + return int(val); } // Decimal part diff --git a/CMakeLists.txt b/CMakeLists.txt index 8131d4a5..92b5d180 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,7 +171,7 @@ if (BUILD_PYTHON) endwhile () if (NOT Boost_PYTHON_FOUND) - foreach (PyVer 3 36 37 38) + foreach (PyVer 3 36 37 38 39) find_package(Boost QUIET COMPONENTS python${PyVer} ${boost_libs}) if ("${Boost_LIBRARIES}" MATCHES ".*(python|PYTHON).*" ) set(Boost_PYTHON_FOUND TRUE) diff --git a/common/pybindings.cc b/common/pybindings.cc index 3b2a3744..51da00e9 100644 --- a/common/pybindings.cc +++ b/common/pybindings.cc @@ -129,6 +129,15 @@ BOOST_PYTHON_MODULE(MODULE_NAME) .value("PORT_INOUT", PORT_INOUT) .export_values(); + enum_<PlaceStrength>("PlaceStrength") + .value("STRENGTH_NONE", STRENGTH_NONE) + .value("STRENGTH_WEAK", STRENGTH_WEAK) + .value("STRENGTH_STRONG", STRENGTH_STRONG) + .value("STRENGTH_FIXED", STRENGTH_FIXED) + .value("STRENGTH_LOCKED", STRENGTH_LOCKED) + .value("STRENGTH_USER", STRENGTH_USER) + .export_values(); + typedef std::unordered_map<IdString, Property> AttrMap; typedef std::unordered_map<IdString, PortInfo> PortMap; typedef std::unordered_map<IdString, IdString> IdIdMap; diff --git a/common/pywrappers.h b/common/pywrappers.h index 1d970985..d50af4c3 100644 --- a/common/pywrappers.h +++ b/common/pywrappers.h @@ -274,7 +274,7 @@ template <typename Class, typename FuncT, FuncT fn, typename arg1_conv> struct f } }; -// Two parameters, one return +// Two parameters, no return template <typename Class, typename FuncT, FuncT fn, typename arg1_conv, typename arg2_conv> struct fn_wrapper_2a_v { using class_type = typename WrapIfNotContext<Class>::maybe_wrapped_t; diff --git a/common/router1.cc b/common/router1.cc index f97cb89b..ef788fc2 100644 --- a/common/router1.cc +++ b/common/router1.cc @@ -793,14 +793,19 @@ bool router1(Context *ctx, const Router1Cfg &cfg) int last_arcs_with_ripup = 0; int last_arcs_without_ripup = 0; - log_info(" | (re-)routed arcs | delta | remaining\n"); - log_info(" IterCnt | w/ripup wo/ripup | w/r wo/r | arcs\n"); + log_info(" | (re-)routed arcs | delta | remaining| time spent |\n"); + log_info(" IterCnt | w/ripup wo/ripup | w/r wo/r | arcs| batch(sec) total(sec)|\n"); + auto prev_time = rstart; while (!router.arc_queue.empty()) { if (++iter_cnt % 1000 == 0) { - log_info("%10d | %8d %10d | %4d %5d | %9d\n", iter_cnt, router.arcs_with_ripup, + auto curr_time = std::chrono::high_resolution_clock::now(); + log_info("%10d | %8d %10d | %4d %5d | %9d| %10.02f %10.02f|\n", iter_cnt, router.arcs_with_ripup, router.arcs_without_ripup, router.arcs_with_ripup - last_arcs_with_ripup, - router.arcs_without_ripup - last_arcs_without_ripup, int(router.arc_queue.size())); + router.arcs_without_ripup - last_arcs_without_ripup, int(router.arc_queue.size()), + std::chrono::duration<float>(curr_time - prev_time).count(), + std::chrono::duration<float>(curr_time - rstart).count()); + prev_time = curr_time; last_arcs_with_ripup = router.arcs_with_ripup; last_arcs_without_ripup = router.arcs_without_ripup; ctx->yield(); @@ -824,12 +829,13 @@ bool router1(Context *ctx, const Router1Cfg &cfg) return false; } } - - log_info("%10d | %8d %10d | %4d %5d | %9d\n", iter_cnt, router.arcs_with_ripup, router.arcs_without_ripup, - router.arcs_with_ripup - last_arcs_with_ripup, router.arcs_without_ripup - last_arcs_without_ripup, - int(router.arc_queue.size())); - log_info("Routing complete.\n"); auto rend = std::chrono::high_resolution_clock::now(); + log_info("%10d | %8d %10d | %4d %5d | %9d| %10.02f %10.02f|\n", iter_cnt, router.arcs_with_ripup, + router.arcs_without_ripup, router.arcs_with_ripup - last_arcs_with_ripup, + router.arcs_without_ripup - last_arcs_without_ripup, int(router.arc_queue.size()), + std::chrono::duration<float>(rend - prev_time).count(), + std::chrono::duration<float>(rend - rstart).count()); + log_info("Routing complete.\n"); ctx->yield(); log_info("Route time %.02fs\n", std::chrono::duration<float>(rend - rstart).count()); diff --git a/ecp5/arch_pybindings.cc b/ecp5/arch_pybindings.cc index cd5e31c3..951745af 100644 --- a/ecp5/arch_pybindings.cc +++ b/ecp5/arch_pybindings.cc @@ -46,6 +46,9 @@ void arch_wrap_python() .def("place", &Context::place) .def("route", &Context::route); + fn_wrapper_2a<Context, decltype(&Context::isValidBelForCell), &Context::isValidBelForCell, pass_through<bool>, + addr_and_unwrap<CellInfo>, conv_from_str<BelId>>::def_wrap(ctx_cls, "isValidBelForCell"); + typedef std::unordered_map<IdString, std::unique_ptr<CellInfo>> CellMap; typedef std::unordered_map<IdString, std::unique_ptr<NetInfo>> NetMap; typedef std::unordered_map<IdString, IdString> AliasMap; diff --git a/ecp5/bitstream.cc b/ecp5/bitstream.cc index 207ba048..bc8a6c55 100644 --- a/ecp5/bitstream.cc +++ b/ecp5/bitstream.cc @@ -178,7 +178,7 @@ static std::string get_pio_tile(Context *ctx, BelId bel) { static const std::set<std::string> pioabcd_l = {"PICL1", "PICL1_DQS0", "PICL1_DQS3"}; static const std::set<std::string> pioabcd_r = {"PICR1", "PICR1_DQS0", "PICR1_DQS3"}; - static const std::set<std::string> pioa_b = {"PICB0", "EFB0_PICB0", "EFB2_PICB0"}; + static const std::set<std::string> pioa_b = {"PICB0", "EFB0_PICB0", "EFB2_PICB0", "SPICB0"}; static const std::set<std::string> piob_b = {"PICB1", "EFB1_PICB1", "EFB3_PICB1"}; std::string pio_name = ctx->locInfo(bel)->bel_data[bel.index].name.get(); @@ -215,7 +215,7 @@ static std::string get_pic_tile(Context *ctx, BelId bel) static const std::set<std::string> picab_r = {"PICR0", "PICR0_DQS2"}; static const std::set<std::string> piccd_r = {"PICR2", "PICR2_DQS1", "MIB_CIB_LR_A"}; - static const std::set<std::string> pica_b = {"PICB0", "EFB0_PICB0", "EFB2_PICB0"}; + static const std::set<std::string> pica_b = {"PICB0", "EFB0_PICB0", "EFB2_PICB0", "SPICB0"}; static const std::set<std::string> picb_b = {"PICB1", "EFB1_PICB1", "EFB3_PICB1"}; std::string pio_name = ctx->locInfo(bel)->bel_data[bel.index].name.get(); diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index dc6bed21..da96b76d 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -32,14 +32,10 @@ const float slice_pitch = 0.0374 + 0.0068; const float io_cell_v_x1 = 0.76; const float io_cell_v_x2 = 0.95; const float io_cell_v_y1 = 0.05; -const float io_cell_v_y2 = 0.15; -const float io_cell_v_pitch = 0.125; const float io_cell_gap = 0.10; const float io_cell_h_x1 = 0.05; -const float io_cell_h_x2 = 0.14; const float io_cell_h_y1 = 0.05; const float io_cell_h_y2 = 0.24; -const float io_cell_h_pitch = 0.125; const float wire_distance = 0.0017f; const float wire_distance_small = 0.00085f; diff --git a/ecp5/pack.cc b/ecp5/pack.cc index 3867ab3d..f5e8a544 100644 --- a/ecp5/pack.cc +++ b/ecp5/pack.cc @@ -2185,15 +2185,15 @@ class Ecp5Packer if (ci->ports.count(id_LOADN)) replace_port(ci, id_LOADN, iol, id_LOADN); else - tie_zero(ci, id_LOADN); + tie_zero(iol, id_LOADN); if (ci->ports.count(id_MOVE)) replace_port(ci, id_MOVE, iol, id_MOVE); else - tie_zero(ci, id_MOVE); + tie_zero(iol, id_MOVE); if (ci->ports.count(id_DIRECTION)) replace_port(ci, id_DIRECTION, iol, id_DIRECTION); else - tie_zero(ci, id_DIRECTION); + tie_zero(iol, id_DIRECTION); if (ci->ports.count(id_CFLAG)) replace_port(ci, id_CFLAG, iol, id_CFLAG); } diff --git a/ecp5/trellis_import.py b/ecp5/trellis_import.py index c8589b6c..a21c4b3d 100755 --- a/ecp5/trellis_import.py +++ b/ecp5/trellis_import.py @@ -521,7 +521,7 @@ def write_database(dev_name, chip, ddrg, endianness): loc, bel_idx, bank, func, dqs = pin write_loc(loc, "abs_loc") bba.u32(bel_idx, "bel_index") - if func is not None: + if func is not None and func != "WRITEN": bba.s(func, "function_name") else: bba.r(None, "function_name") diff --git a/frontend/json_frontend.cc b/frontend/json_frontend.cc index d2e6248e..136786fc 100644 --- a/frontend/json_frontend.cc +++ b/frontend/json_frontend.cc @@ -46,7 +46,7 @@ struct JsonFrontendImpl Func(mod.first, mod.second); } - template <typename TFunc> void foreach_port(const ModuleDataType &mod, TFunc Func) const + template <typename TFunc> void foreach_port(ModuleDataType &mod, TFunc Func) const { const auto &ports = mod["ports"]; if (ports.is_null()) @@ -55,7 +55,7 @@ struct JsonFrontendImpl Func(port.first, port.second); } - template <typename TFunc> void foreach_cell(const ModuleDataType &mod, TFunc Func) const + template <typename TFunc> void foreach_cell(ModuleDataType &mod, TFunc Func) const { const auto &cells = mod["cells"]; if (cells.is_null()) @@ -64,7 +64,7 @@ struct JsonFrontendImpl Func(cell.first, cell.second); } - template <typename TFunc> void foreach_netname(const ModuleDataType &mod, TFunc Func) const + template <typename TFunc> void foreach_netname(ModuleDataType &mod, TFunc Func) const { const auto &netnames = mod["netnames"]; if (netnames.is_null()) @@ -85,10 +85,7 @@ struct JsonFrontendImpl NPNR_ASSERT_FALSE("invalid json port direction"); } - PortType get_port_dir(const ModulePortDataType &port) const - { - return lookup_portdir(port["direction"].string_value()); - } + PortType get_port_dir(ModulePortDataType &port) const { return lookup_portdir(port["direction"].string_value()); } int get_array_offset(const Json &obj) const { @@ -102,16 +99,20 @@ struct JsonFrontendImpl return upto.is_null() ? false : bool(upto.int_value()); } - const BitVectorDataType &get_port_bits(const ModulePortDataType &port) const { return port["bits"].array_items(); } + BitVectorDataType &get_port_bits(ModulePortDataType &port) const { return port["bits"].array_items(); } - const std::string &get_cell_type(const CellDataType &cell) const { return cell["type"].string_value(); } + const std::string &get_cell_type(CellDataType &cell) const { return cell["type"].string_value(); } Property parse_property(const Json &val) const { - if (val.is_number()) + if (val.is_number()) { + if (val.int_value() != val.number_value()) + log_error("Found an out-of-range integer parameter in the JSON file.\n" + "Please regenerate the input file with an up-to-date version of yosys.\n"); return Property(val.int_value(), 32); - else + } else { return Property::from_string(val.string_value()); + } } template <typename TFunc> void foreach_attr(const Json &obj, TFunc Func) const @@ -144,36 +145,36 @@ struct JsonFrontendImpl } } - template <typename TFunc> void foreach_port_dir(const CellDataType &cell, TFunc Func) const + template <typename TFunc> void foreach_port_dir(CellDataType &cell, TFunc Func) const { for (const auto &pdir : cell["port_directions"].object_items()) Func(pdir.first, lookup_portdir(pdir.second.string_value())); } - template <typename TFunc> void foreach_port_conn(const CellDataType &cell, TFunc Func) const + template <typename TFunc> void foreach_port_conn(CellDataType &cell, TFunc Func) const { for (const auto &pconn : cell["connections"].object_items()) Func(pconn.first, pconn.second.array_items()); } - const BitVectorDataType &get_net_bits(const NetnameDataType &net) const { return net["bits"].array_items(); } + BitVectorDataType &get_net_bits(NetnameDataType &net) const { return net["bits"].array_items(); } - int get_vector_length(const BitVectorDataType &bits) const { return int(bits.size()); } + int get_vector_length(BitVectorDataType &bits) const { return int(bits.size()); } - bool is_vector_bit_constant(const BitVectorDataType &bits, int i) const + bool is_vector_bit_constant(BitVectorDataType &bits, int i) const { NPNR_ASSERT(i < int(bits.size())); return bits[i].is_string(); } - char get_vector_bit_constval(const BitVectorDataType &bits, int i) const + char get_vector_bit_constval(BitVectorDataType &bits, int i) const { auto s = bits.at(i).string_value(); NPNR_ASSERT(s.size() == 1); return s.at(0); } - int get_vector_bit_signal(const BitVectorDataType &bits, int i) const + int get_vector_bit_signal(BitVectorDataType &bits, int i) const { NPNR_ASSERT(bits.at(i).is_number()); return bits.at(i).int_value(); diff --git a/generic/pack.cc b/generic/pack.cc index f3aa9880..43157b6c 100644 --- a/generic/pack.cc +++ b/generic/pack.cc @@ -112,18 +112,6 @@ static void pack_nonlut_ffs(Context *ctx) } } -static bool net_is_constant(const Context *ctx, NetInfo *net, bool &value) -{ - if (net == nullptr) - return false; - if (net->name == ctx->id("$PACKER_GND_NET") || net->name == ctx->id("$PACKER_VCC_NET")) { - value = (net->name == ctx->id("$PACKER_VCC_NET")); - return true; - } else { - return false; - } -} - // Merge a net into a constant net static void set_net_constant(const Context *ctx, NetInfo *orig, NetInfo *constnet, bool constval) { diff --git a/gui/treemodel.cc b/gui/treemodel.cc index b834c682..97cc8883 100644 --- a/gui/treemodel.cc +++ b/gui/treemodel.cc @@ -93,7 +93,7 @@ void IdStringList::updateElements(Context *ctx, std::vector<IdString> elements) } // Sort new children - qSort(children_.begin(), children_.end(), [&](const Item *a, const Item *b) { + std::sort(children_.begin(), children_.end(), [&](const Item *a, const Item *b) { auto parts_a = alphaNumSplit(a->name()); auto parts_b = alphaNumSplit(b->name()); diff --git a/json/jsonwrite.cc b/json/jsonwrite.cc index 477bfca5..d4a62a5a 100644 --- a/json/jsonwrite.cc +++ b/json/jsonwrite.cc @@ -45,15 +45,6 @@ std::string get_string(std::string str) std::string get_name(IdString name, Context *ctx) { return get_string(name.c_str(ctx)); } -void write_parameter_value(std::ostream &f, const Property &value) -{ - if (value.size() == 32 && value.is_fully_def()) { - f << stringf("%d", value.as_int64()); - } else { - f << get_string(value.to_string()); - } -} - void write_parameters(std::ostream &f, Context *ctx, const std::unordered_map<IdString, Property> ¶meters, bool for_module = false) { @@ -61,7 +52,7 @@ void write_parameters(std::ostream &f, Context *ctx, const std::unordered_map<Id for (auto ¶m : parameters) { f << stringf("%s\n", first ? "" : ","); f << stringf(" %s%s: ", for_module ? "" : " ", get_name(param.first, ctx).c_str()); - write_parameter_value(f, param.second); + f << get_string(param.second.to_string()); first = false; } } |