From bfa2157ae62a21599cf659fbc93176ecbc09e74b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 28 Nov 2018 17:59:58 +0100 Subject: [PATCH] compile fix for gui and proper size --- CMakeLists.txt | 8 +++++++- xc7/arch.cc | 8 ++++++-- xc7/arch.h | 8 ++++++-- xc7/family.cmake | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4b3c61a..0d6cd312 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,9 +120,10 @@ if (BUILD_PYTHON) # Original source: https://github.com/BVLC/caffe/blob/master/cmake/Dependencies.cmake#L148 set(version ${PYTHONLIBS_VERSION_STRING}) - STRING(REGEX REPLACE "[^0-9]" "" boost_py_version ${version}) + STRING(REGEX REPLACE "[^0-9]" "" boost_py_version ${version}) find_package(Boost QUIET COMPONENTS "python-py${boost_py_version}" ${boost_libs}) set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND}) + set(boost_python_lib "python-py${boost_py_version}") while (NOT "${version}" STREQUAL "" AND NOT Boost_PYTHON_FOUND) STRING(REGEX REPLACE "([0-9.]+).[0-9]+" "\\1" version ${version}) @@ -130,6 +131,7 @@ if (BUILD_PYTHON) STRING(REGEX REPLACE "[^0-9]" "" boost_py_version ${version}) find_package(Boost QUIET COMPONENTS "python-py${boost_py_version}" ${boost_libs}) set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND}) + set(boost_python_lib "python-py${boost_py_version}") STRING(REGEX MATCHALL "([0-9.]+).[0-9]+" has_more_version ${version}) if ("${has_more_version}" STREQUAL "") @@ -139,6 +141,7 @@ if (BUILD_PYTHON) if (NOT Boost_PYTHON_FOUND) find_package(Boost QUIET COMPONENTS python3 ${boost_libs}) + set(boost_python_lib python3) if ("${Boost_LIBRARIES}" MATCHES ".*(python|PYTHON).*" ) set(Boost_PYTHON_FOUND TRUE) endif () @@ -146,6 +149,7 @@ if (BUILD_PYTHON) if (NOT Boost_PYTHON_FOUND) find_package(Boost QUIET COMPONENTS python36 ${boost_libs}) + set(boost_python_lib python36) if ("${Boost_LIBRARIES}" MATCHES ".*(python|PYTHON).*" ) set(Boost_PYTHON_FOUND TRUE) endif () @@ -153,6 +157,7 @@ if (BUILD_PYTHON) if (NOT Boost_PYTHON_FOUND) find_package(Boost QUIET COMPONENTS python37 ${boost_libs}) + set(boost_python_lib python37) if ("${Boost_LIBRARIES}" MATCHES ".*(python|PYTHON).*" ) set(Boost_PYTHON_FOUND TRUE) endif () @@ -161,6 +166,7 @@ if (BUILD_PYTHON) if (NOT Boost_PYTHON_FOUND) STRING(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" gentoo_version ${PYTHONLIBS_VERSION_STRING}) find_package(Boost QUIET COMPONENTS python-${gentoo_version} ${boost_libs}) + set(boost_python_lib python-${gentoo_version}) if ("${Boost_LIBRARIES}" MATCHES ".*(python|PYTHON).*" ) set(Boost_PYTHON_FOUND TRUE) endif () diff --git a/xc7/arch.cc b/xc7/arch.cc index 13c1537a..85933ff0 100644 --- a/xc7/arch.cc +++ b/xc7/arch.cc @@ -289,6 +289,9 @@ TorcInfo::TorcInfo(BaseCtx *ctx, const std::string &inDeviceName, const std::str const auto &tw = arc.getSinkTilewire(); pip_to_dst_wire.emplace_back(tilewire_to_wire(tw)); } + + height = (int)tiles.getRowCount(); + width = (int)tiles.getColCount(); } TorcInfo::TorcInfo(const std::string& inDeviceName, const std::string &inPackageName) : ddb(new DDB(inDeviceName, inPackageName)), sites(ddb->getSites()), tiles(ddb->getTiles()), @@ -332,13 +335,14 @@ Arch::Arch(ArchArgs args) : args(args) nextpnr_binary_oarchive oa(fofs, this); oa << torc_info; } - } #endif + } } else { log_error("Unsupported XC7 chip type.\n"); } - + width = torc_info->width; + height = torc_info->height; /*if (getCtx()->verbose)*/ { log_info("Number of bels: %d\n", torc_info->num_bels); log_info("Number of wires: %d\n", torc_info->num_wires); diff --git a/xc7/arch.h b/xc7/arch.h index b106d9ab..fe89208b 100644 --- a/xc7/arch.h +++ b/xc7/arch.h @@ -322,6 +322,8 @@ struct TorcInfo std::vector pip_to_arc; int num_pips; std::vector pip_to_dst_wire; + int width; + int height; TorcInfo(const std::string &inDeviceName, const std::string &inPackageName); private: @@ -497,6 +499,8 @@ struct Arch : BaseCtx bool fast_part; const ChipInfoPOD *chip_info; const PackageInfoPOD *package_info; + int width; + int height; mutable std::unordered_map wire_by_name; mutable std::unordered_map pip_by_name; @@ -519,8 +523,8 @@ struct Arch : BaseCtx // ------------------------------------------------- - int getGridDimX() const { return 34; } - int getGridDimY() const { return 34; } + int getGridDimX() const { return width; } + int getGridDimY() const { return height; } int getTileBelDimZ(int, int) const { return 8; } int getTilePipDimZ(int, int) const { return 1; } diff --git a/xc7/family.cmake b/xc7/family.cmake index 4a350690..c3eab64a 100644 --- a/xc7/family.cmake +++ b/xc7/family.cmake @@ -1,7 +1,7 @@ include_directories(/opt/torc/src) #include_directories(torc/externals/zlib) -find_package(Boost REQUIRED COMPONENTS serialization iostreams ${boost_libs}) +find_package(Boost REQUIRED COMPONENTS serialization iostreams ${boost_libs} ${boost_python_lib}) target_link_libraries( nextpnr-${family}