stolen router2
This commit is contained in:
parent
1c9cf8adb1
commit
0cb4f508f7
@ -199,6 +199,28 @@ struct Loc
|
||||
bool operator!=(const Loc &other) const { return (x != other.x) || (y != other.y) || (z != other.z); }
|
||||
};
|
||||
|
||||
struct ArcBounds
|
||||
{
|
||||
int x0 = -1, y0 = -1, x1 = -1, y1 = -1;
|
||||
|
||||
ArcBounds() {}
|
||||
ArcBounds(int x0, int y0, int x1, int y1) : x0(x0), y0(y0), x1(x1), y1(y1){};
|
||||
|
||||
int distance(Loc loc) const
|
||||
{
|
||||
int dist = 0;
|
||||
if (loc.x < x0)
|
||||
dist += x0 - loc.x;
|
||||
if (loc.x > x1)
|
||||
dist += loc.x - x1;
|
||||
if (loc.y < y0)
|
||||
dist += y0 - loc.y;
|
||||
if (loc.y > y1)
|
||||
dist += loc.y - y1;
|
||||
return dist;
|
||||
};
|
||||
};
|
||||
|
||||
struct TimingConstrObjectId
|
||||
{
|
||||
int32_t index = -1;
|
||||
|
1066
common/router2.cc
Normal file
1066
common/router2.cc
Normal file
File diff suppressed because it is too large
Load Diff
26
common/router2.h
Normal file
26
common/router2.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* nextpnr -- Next Generation Place and Route
|
||||
*
|
||||
* Copyright (C) 2019 David Shah <dave@ds0.me>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nextpnr.h"
|
||||
|
||||
NEXTPNR_NAMESPACE_BEGIN
|
||||
|
||||
void router2(Context *ctx);
|
||||
|
||||
NEXTPNR_NAMESPACE_END
|
@ -22,6 +22,7 @@
|
||||
#include "placer1.h"
|
||||
#include "placer_heap.h"
|
||||
#include "router1.h"
|
||||
#include "router2.h"
|
||||
#include "util.h"
|
||||
|
||||
NEXTPNR_NAMESPACE_BEGIN
|
||||
@ -510,6 +511,39 @@ delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const
|
||||
return (dx + dy + 10) * 300;
|
||||
}
|
||||
|
||||
ArcBounds Arch::getRouteBoundingBox(WireId src, WireId dst) const
|
||||
{
|
||||
|
||||
int x0, x1, y0, y1;
|
||||
x0 = x1 = src.location.x;
|
||||
y0 = y1 = src.location.y;
|
||||
auto expand = [&](int x, int y) {
|
||||
x0 = std::min(x0, x);
|
||||
x1 = std::max(x1, x);
|
||||
y0 = std::min(y0, y);
|
||||
y1 = std::max(y1, y);
|
||||
};
|
||||
|
||||
expand(src.location.x-10, src.location.y-10);
|
||||
expand(src.location.x+5, src.location.y+5);
|
||||
expand(dst.location.x-10, dst.location.y-10);
|
||||
expand(dst.location.x+5, dst.location.y+5);
|
||||
if (x0 < 0)
|
||||
x0 = 0;
|
||||
if (y0 < 0)
|
||||
y0 = 0;
|
||||
if (x1 >= device_info->width)
|
||||
x1 = device_info->width - 1;
|
||||
if (y1 >= device_info->height)
|
||||
y1 = device_info->height - 1;
|
||||
|
||||
return {x0, y0, x1, y1};
|
||||
}
|
||||
|
||||
delay_t Arch::getBoundingBoxCost(WireId src, WireId dst, int distance) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Arch::getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const { return false; }
|
||||
|
||||
|
||||
@ -537,6 +571,9 @@ bool Arch::place()
|
||||
}
|
||||
|
||||
bool Arch::route() {
|
||||
log_info("Running router2 for main routing task\n");
|
||||
router2(getCtx());
|
||||
log_info("Running router1 to ensure route is legal\n");
|
||||
bool retVal = router1(getCtx(), Router1Cfg(getCtx()));
|
||||
if (retVal)
|
||||
getCtx()->settings[getCtx()->id("route")] = 1;
|
||||
|
@ -1143,6 +1143,8 @@ struct Arch : BaseCtx
|
||||
|
||||
delay_t estimateDelay(WireId src, WireId dst) const;
|
||||
delay_t predictDelay(const NetInfo *net_info, const PortRef &sink) const;
|
||||
ArcBounds getRouteBoundingBox(WireId src, WireId dst) const;
|
||||
delay_t getBoundingBoxCost(WireId src, WireId dst, int distance) const;
|
||||
delay_t getDelayEpsilon() const { return 20; }
|
||||
delay_t getRipupDelayPenalty() const { return 80; }
|
||||
float getDelayNS(delay_t v) const { return v * 0.001; }
|
||||
|
Loading…
Reference in New Issue
Block a user