aboutsummaryrefslogtreecommitdiffstats
path: root/ice40
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-06-14 12:43:00 +0200
committerClifford Wolf <clifford@clifford.at>2018-06-14 12:43:00 +0200
commit7787ce5fd934b2d794e1fa15b6e8007ed07080e6 (patch)
tree4e913bc1c70148029316d282d37a8d509f3d8c03 /ice40
parentb1cbae1293fecf3ba14a7ce073d26dcfb07177f0 (diff)
downloadnextpnr-7787ce5fd934b2d794e1fa15b6e8007ed07080e6.tar.gz
nextpnr-7787ce5fd934b2d794e1fa15b6e8007ed07080e6.tar.bz2
nextpnr-7787ce5fd934b2d794e1fa15b6e8007ed07080e6.zip
Refactor position/delay estimation API
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'ice40')
-rw-r--r--ice40/chip.cc36
-rw-r--r--ice40/chip.h11
-rw-r--r--ice40/pybindings.cc4
3 files changed, 17 insertions, 34 deletions
diff --git a/ice40/chip.cc b/ice40/chip.cc
index 87428339..b40963bf 100644
--- a/ice40/chip.cc
+++ b/ice40/chip.cc
@@ -275,36 +275,26 @@ BelId Chip::getPackagePinBel(const std::string &pin) const
// -----------------------------------------------------------------------
-PosInfo Chip::getBelPosition(BelId bel) const
+bool Chip::estimatePosition(BelId bel, float &x, float &y) const
{
- PosInfo pos;
assert(bel != BelId());
- pos.x = chip_info.bel_data[bel.index].x;
- pos.y = chip_info.bel_data[bel.index].y;
- return pos;
-}
+ x = chip_info.bel_data[bel.index].x;
+ y = chip_info.bel_data[bel.index].y;
-PosInfo Chip::getWirePosition(WireId wire) const
-{
- PosInfo pos;
- assert(wire != WireId());
- pos.x = chip_info.wire_data[wire.index].x;
- pos.y = chip_info.wire_data[wire.index].y;
- return pos;
+ return chip_info.bel_data[bel.index].type != TYPE_SB_GB;
}
-PosInfo Chip::getPipPosition(PipId pip) const
+float Chip::estimateDelay(WireId src, WireId dst) const
{
- PosInfo pos;
- assert(pip != PipId());
- pos.x = chip_info.pip_data[pip.index].x;
- pos.y = chip_info.pip_data[pip.index].y;
- return pos;
-}
+ assert(src != WireId());
+ float x1 = chip_info.wire_data[src.index].x;
+ float y1 = chip_info.wire_data[src.index].y;
-float Chip::estimateDelay(PosInfo src, PosInfo dst) const
-{
- return fabsf(src.x - dst.x) + fabsf(src.y - dst.y);
+ assert(dst != WireId());
+ float x2 = chip_info.wire_data[dst.index].x;
+ float y2 = chip_info.wire_data[dst.index].y;
+
+ return fabsf(x1 - x2) + fabsf(y1 - y2);
}
// -----------------------------------------------------------------------
diff --git a/ice40/chip.h b/ice40/chip.h
index 6700666f..54e8e368 100644
--- a/ice40/chip.h
+++ b/ice40/chip.h
@@ -42,11 +42,6 @@ struct DelayInfo
}
};
-struct PosInfo
-{
- float x = 0, y = 0;
-};
-
// -----------------------------------------------------------------------
enum BelType
@@ -693,10 +688,8 @@ struct Chip
// -------------------------------------------------
- PosInfo getBelPosition(BelId bel) const;
- PosInfo getWirePosition(WireId wire) const;
- PosInfo getPipPosition(PipId pip) const;
- float estimateDelay(PosInfo src, PosInfo dst) const;
+ bool estimatePosition(BelId bel, float &x, float &y) const;
+ float estimateDelay(WireId src, WireId dst) const;
// -------------------------------------------------
diff --git a/ice40/pybindings.cc b/ice40/pybindings.cc
index 9094fe7c..5ccf9495 100644
--- a/ice40/pybindings.cc
+++ b/ice40/pybindings.cc
@@ -73,8 +73,8 @@ void arch_wrap_python()
.def("getPipsDownhill", &Chip::getPipsDownhill)
.def("getPipsUphill", &Chip::getPipsUphill)
.def("getWireAliases", &Chip::getWireAliases)
- .def("getBelPosition", &Chip::getBelPosition)
- .def("getWirePosition", &Chip::getWirePosition);
+ .def("estimatePosition", &Chip::estimatePosition)
+ .def("estimateDelay", &Chip::estimateDelay);
WRAP_RANGE(Bel);
WRAP_RANGE(BelPin);