From 4d7f18dd98a7ef9540a279a8e27cb9dbef355af7 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 13 Jun 2018 12:37:23 +0200 Subject: Redesign PosInfo API Signed-off-by: Clifford Wolf --- dummy/chip.cc | 37 +++++++++++++++++++++++++++++++++++++ dummy/chip.h | 12 +++++++++--- 2 files changed, 46 insertions(+), 3 deletions(-) (limited to 'dummy') diff --git a/dummy/chip.cc b/dummy/chip.cc index ae962508..bab65ae4 100644 --- a/dummy/chip.cc +++ b/dummy/chip.cc @@ -17,6 +17,7 @@ * */ +#include #include "nextpnr.h" NEXTPNR_NAMESPACE_BEGIN @@ -138,6 +139,42 @@ const std::vector &Chip::getWireAliases(WireId wire) const return ret; } +// --------------------------------------------------------------- + +PosInfo Chip::getBelPosition(BelId bel) const +{ + PosInfo pos; + assert(bel != BelId()); + // pos.x = ...; + // pos.y = ...; + return pos; +} + +PosInfo Chip::getWirePosition(WireId wire) const +{ + PosInfo pos; + assert(wire != WireId()); + // pos.x = ...; + // pos.y = ...; + return pos; +} + +PosInfo Chip::getPipPosition(PipId pip) const +{ + PosInfo pos; + assert(pip != PipId()); + // pos.x = ...; + // pos.y = ...; + return pos; +} + +float Chip::estimateDelay(PosInfo src, PosInfo dst) const +{ + return fabsf(src.x - dst.x) + fabsf(src.x - dst.x); +} + +// --------------------------------------------------------------- + std::vector Chip::getBelGraphics(BelId bel) const { static std::vector ret; diff --git a/dummy/chip.h b/dummy/chip.h index e5a6dd56..bc70fa5d 100644 --- a/dummy/chip.h +++ b/dummy/chip.h @@ -42,6 +42,11 @@ struct DelayInfo } }; +struct PosInfo +{ + float x = 0, y = 0; +}; + typedef IdString BelType; typedef IdString PortPin; @@ -108,9 +113,10 @@ struct Chip const std::vector &getPipsUphill(WireId wire) const; const std::vector &getWireAliases(WireId wire) const; - void getBelPosition(BelId bel, float &x, float &y) const; - void getWirePosition(WireId wire, float &x, float &y) const; - void getPipPosition(PipId pip, float &x, float &y) const; + PosInfo getBelPosition(BelId bel) const; + PosInfo getWirePosition(WireId wire) const; + PosInfo getPipPosition(PipId pip) const; + float estimateDelay(PosInfo src, PosInfo dst) const; std::vector getBelGraphics(BelId bel) const; std::vector getWireGraphics(WireId wire) const; -- cgit v1.2.3