aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5
diff options
context:
space:
mode:
authorMiodrag Milanović <mmicko@gmail.com>2019-02-12 18:53:20 +0100
committerGitHub <noreply@github.com>2019-02-12 18:53:20 +0100
commitc52202233a3f1b06d68314dccc7cc12c8fdfe5f2 (patch)
tree5930a48f9052d020d1b1eacd4cfebcc266737ffe /ecp5
parent8b0af0e48d22779b5f2e047541e9e037375cb4cd (diff)
parentd24d85a6e4f82845cab51252308a2904db37c302 (diff)
downloadnextpnr-c52202233a3f1b06d68314dccc7cc12c8fdfe5f2.tar.gz
nextpnr-c52202233a3f1b06d68314dccc7cc12c8fdfe5f2.tar.bz2
nextpnr-c52202233a3f1b06d68314dccc7cc12c8fdfe5f2.zip
Merge branch 'master' into mmaped_chipdb
Diffstat (limited to 'ecp5')
-rw-r--r--ecp5/arch.cc23
-rw-r--r--ecp5/family.cmake15
2 files changed, 33 insertions, 5 deletions
diff --git a/ecp5/arch.cc b/ecp5/arch.cc
index 75949b2f..23cdea3b 100644
--- a/ecp5/arch.cc
+++ b/ecp5/arch.cc
@@ -427,7 +427,28 @@ BelId Arch::getBelByLocation(Loc loc) const
delay_t Arch::estimateDelay(WireId src, WireId dst) const
{
- return (240 - 20 * args.speed) * (abs(src.location.x - dst.location.x) + abs(src.location.y - dst.location.y));
+ auto est_location = [&](WireId w) -> std::pair<int16_t, int16_t> {
+ if (w.location.x == 0 && w.location.y == 0) {
+ // Global wires
+ const auto &wire = locInfo(w)->wire_data[w.index];
+ // Use location of first downhill bel or pip, if available
+ if (wire.num_bel_pins > 0) {
+ return std::make_pair(wire.bel_pins[0].rel_bel_loc.x, wire.bel_pins[0].rel_bel_loc.y);
+ } else if (wire.num_downhill > 0) {
+ return std::make_pair(wire.pips_downhill[0].rel_loc.x, wire.pips_downhill[0].rel_loc.y);
+ } else if (wire.num_uphill > 0) {
+ return std::make_pair(wire.pips_uphill[0].rel_loc.x, wire.pips_uphill[0].rel_loc.y);
+ } else {
+ return std::make_pair<int16_t, int16_t>(0, 0);
+ }
+ } else {
+ return std::make_pair(w.location.x, w.location.y);
+ }
+ };
+
+ auto src_loc = est_location(src), dst_loc = est_location(dst);
+
+ return (240 - 20 * args.speed) * (abs(src_loc.first - dst_loc.first) + abs(src_loc.second - dst_loc.second));
}
delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const
diff --git a/ecp5/family.cmake b/ecp5/family.cmake
index 06dc6761..799851b2 100644
--- a/ecp5/family.cmake
+++ b/ecp5/family.cmake
@@ -6,12 +6,19 @@ if (NOT EXTERNAL_CHIPDB)
set(TRELLIS_ROOT "/usr/local/share/trellis")
endif()
- file(GLOB found_pytrellis ${TRELLIS_ROOT}/libtrellis/pytrellis.*)
+ file(GLOB found_pytrellis ${TRELLIS_ROOT}/libtrellis/pytrellis.*
+ /usr/lib/pytrellis.*
+ /usr/lib64/pytrellis.*
+ /usr/lib/trellis/pytrellis.*
+ /usr/lib64/trellis/pytrellis.*)
if ("${found_pytrellis}" STREQUAL "")
- message(FATAL_ERROR "failed to find pytrellis library in ${TRELLIS_ROOT}/libtrellis/")
+ message(FATAL_ERROR "failed to locate pytrellis library!")
endif()
+ list(GET found_pytrellis 0 PYTRELLIS_LIB)
+ get_filename_component(PYTRELLIS_LIBDIR ${PYTRELLIS_LIB} DIRECTORY)
+
set(DB_PY ${CMAKE_CURRENT_SOURCE_DIR}/ecp5/trellis_import.py)
file(MAKE_DIRECTORY ecp5/chipdbs/)
@@ -20,9 +27,9 @@ if (NOT EXTERNAL_CHIPDB)
target_include_directories(ecp5_chipdb PRIVATE ${family}/)
if (CMAKE_HOST_WIN32)
- set(ENV_CMD ${CMAKE_COMMAND} -E env "PYTHONPATH=\"${TRELLIS_ROOT}/libtrellis\;${TRELLIS_ROOT}/util/common\;${TRELLIS_ROOT}/timing/util\"")
+ set(ENV_CMD ${CMAKE_COMMAND} -E env "PYTHONPATH=\"${PYTRELLIS_LIBDIR}\;${TRELLIS_ROOT}/util/common\;${TRELLIS_ROOT}/timing/util\"")
else()
- set(ENV_CMD ${CMAKE_COMMAND} -E env "PYTHONPATH=${TRELLIS_ROOT}/libtrellis:${TRELLIS_ROOT}/util/common:${TRELLIS_ROOT}/timing/util")
+ set(ENV_CMD ${CMAKE_COMMAND} -E env "PYTHONPATH=${PYTRELLIS_LIBDIR}\:${TRELLIS_ROOT}/util/common:${TRELLIS_ROOT}/timing/util")
endif()
if (MSVC)