Updates from clangformat
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
04db674b35
commit
a1681560a3
21
common/log.h
21
common/log.h
@ -60,41 +60,34 @@ extern void (*log_error_atexit)();
|
|||||||
void logv(const char *format, va_list ap);
|
void logv(const char *format, va_list ap);
|
||||||
void logv_warning(const char *format, va_list ap);
|
void logv_warning(const char *format, va_list ap);
|
||||||
void logv_warning_noprefix(const char *format, va_list ap);
|
void logv_warning_noprefix(const char *format, va_list ap);
|
||||||
NXP_NORETURN void logv_error(const char *format, va_list ap)
|
NXP_NORETURN void logv_error(const char *format, va_list ap) NXP_ATTRIBUTE(noreturn);
|
||||||
NXP_ATTRIBUTE(noreturn);
|
|
||||||
|
|
||||||
extern std::ostream clog;
|
extern std::ostream clog;
|
||||||
void log(const char *format, ...) NXP_ATTRIBUTE(format(printf, 1, 2));
|
void log(const char *format, ...) NXP_ATTRIBUTE(format(printf, 1, 2));
|
||||||
void log_header(const char *format, ...) NXP_ATTRIBUTE(format(printf, 1, 2));
|
void log_header(const char *format, ...) NXP_ATTRIBUTE(format(printf, 1, 2));
|
||||||
void log_info(const char *format, ...) NXP_ATTRIBUTE(format(printf, 1, 2));
|
void log_info(const char *format, ...) NXP_ATTRIBUTE(format(printf, 1, 2));
|
||||||
void log_warning(const char *format, ...) NXP_ATTRIBUTE(format(printf, 1, 2));
|
void log_warning(const char *format, ...) NXP_ATTRIBUTE(format(printf, 1, 2));
|
||||||
void log_warning_noprefix(const char *format, ...)
|
void log_warning_noprefix(const char *format, ...) NXP_ATTRIBUTE(format(printf, 1, 2));
|
||||||
NXP_ATTRIBUTE(format(printf, 1, 2));
|
NXP_NORETURN void log_error(const char *format, ...) NXP_ATTRIBUTE(format(printf, 1, 2), noreturn);
|
||||||
NXP_NORETURN void log_error(const char *format, ...)
|
NXP_NORETURN void log_cmd_error(const char *format, ...) NXP_ATTRIBUTE(format(printf, 1, 2), noreturn);
|
||||||
NXP_ATTRIBUTE(format(printf, 1, 2), noreturn);
|
|
||||||
NXP_NORETURN void log_cmd_error(const char *format, ...)
|
|
||||||
NXP_ATTRIBUTE(format(printf, 1, 2), noreturn);
|
|
||||||
|
|
||||||
void log_break();
|
void log_break();
|
||||||
void log_flush();
|
void log_flush();
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
static inline void log_assert_worker(bool cond, const char *expr,
|
static inline void log_assert_worker(bool cond, const char *expr, const char *file, int line)
|
||||||
const char *file, int line)
|
|
||||||
{
|
{
|
||||||
if (!cond)
|
if (!cond)
|
||||||
log_error("Assert `%s' failed in %s:%d.\n", expr, file, line);
|
log_error("Assert `%s' failed in %s:%d.\n", expr, file, line);
|
||||||
}
|
}
|
||||||
#define log_assert(_assert_expr_) \
|
#define log_assert(_assert_expr_) \
|
||||||
YOSYS_NAMESPACE_PREFIX log_assert_worker(_assert_expr_, #_assert_expr_, \
|
YOSYS_NAMESPACE_PREFIX log_assert_worker(_assert_expr_, #_assert_expr_, __FILE__, __LINE__)
|
||||||
__FILE__, __LINE__)
|
|
||||||
#else
|
#else
|
||||||
#define log_assert(_assert_expr_)
|
#define log_assert(_assert_expr_)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define log_abort() log_error("Abort in %s:%d.\n", __FILE__, __LINE__)
|
#define log_abort() log_error("Abort in %s:%d.\n", __FILE__, __LINE__)
|
||||||
#define log_ping() \
|
#define log_ping() log("-- %s:%d %s --\n", __FILE__, __LINE__, __PRETTY_FUNCTION__)
|
||||||
log("-- %s:%d %s --\n", __FILE__, __LINE__, __PRETTY_FUNCTION__)
|
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
|
@ -35,15 +35,9 @@ void IdString::set(const BaseCtx *ctx, const std::string &s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string &IdString::str(const BaseCtx *ctx) const
|
const std::string &IdString::str(const BaseCtx *ctx) const { return *ctx->idstring_idx_to_str->at(index); }
|
||||||
{
|
|
||||||
return *ctx->idstring_idx_to_str->at(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *IdString::c_str(const BaseCtx *ctx) const
|
const char *IdString::c_str(const BaseCtx *ctx) const { return str(ctx).c_str(); }
|
||||||
{
|
|
||||||
return str(ctx).c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IdString::initialize_add(const BaseCtx *ctx, const char *s, int idx)
|
void IdString::initialize_add(const BaseCtx *ctx, const char *s, int idx)
|
||||||
{
|
{
|
||||||
@ -121,8 +115,7 @@ uint32_t Context::checksum() const
|
|||||||
port_x = xorshift32(port_x + xorshift32(p.first.index));
|
port_x = xorshift32(port_x + xorshift32(p.first.index));
|
||||||
port_x = xorshift32(port_x + xorshift32(p.second.name.index));
|
port_x = xorshift32(port_x + xorshift32(p.second.name.index));
|
||||||
if (p.second.net)
|
if (p.second.net)
|
||||||
port_x = xorshift32(port_x +
|
port_x = xorshift32(port_x + xorshift32(p.second.net->name.index));
|
||||||
xorshift32(p.second.net->name.index));
|
|
||||||
port_x = xorshift32(port_x + xorshift32(p.second.type));
|
port_x = xorshift32(port_x + xorshift32(p.second.type));
|
||||||
port_x_sum += port_x;
|
port_x_sum += port_x;
|
||||||
}
|
}
|
||||||
|
@ -67,15 +67,9 @@ struct IdString
|
|||||||
|
|
||||||
bool operator<(const IdString &other) const { return index < other.index; }
|
bool operator<(const IdString &other) const { return index < other.index; }
|
||||||
|
|
||||||
bool operator==(const IdString &other) const
|
bool operator==(const IdString &other) const { return index == other.index; }
|
||||||
{
|
|
||||||
return index == other.index;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const IdString &other) const
|
bool operator!=(const IdString &other) const { return index != other.index; }
|
||||||
{
|
|
||||||
return index != other.index;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool empty() const { return index == 0; }
|
bool empty() const { return index == 0; }
|
||||||
|
|
||||||
@ -93,8 +87,7 @@ NEXTPNR_NAMESPACE_END
|
|||||||
namespace std {
|
namespace std {
|
||||||
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX IdString>
|
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX IdString>
|
||||||
{
|
{
|
||||||
std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX IdString &obj) const
|
std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX IdString &obj) const noexcept
|
||||||
noexcept
|
|
||||||
{
|
{
|
||||||
return std::hash<int>()(obj.index);
|
return std::hash<int>()(obj.index);
|
||||||
}
|
}
|
||||||
|
188
common/route.cc
188
common/route.cc
@ -29,12 +29,10 @@ USING_NEXTPNR_NAMESPACE
|
|||||||
|
|
||||||
struct hash_id_wire
|
struct hash_id_wire
|
||||||
{
|
{
|
||||||
std::size_t operator()(const std::pair<IdString, WireId> &arg) const
|
std::size_t operator()(const std::pair<IdString, WireId> &arg) const noexcept
|
||||||
noexcept
|
|
||||||
{
|
{
|
||||||
std::size_t seed = std::hash<IdString>()(arg.first);
|
std::size_t seed = std::hash<IdString>()(arg.first);
|
||||||
seed ^= std::hash<WireId>()(arg.second) + 0x9e3779b9 + (seed << 6) +
|
seed ^= std::hash<WireId>()(arg.second) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||||
(seed >> 2);
|
|
||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -44,8 +42,7 @@ struct hash_id_pip
|
|||||||
std::size_t operator()(const std::pair<IdString, PipId> &arg) const noexcept
|
std::size_t operator()(const std::pair<IdString, PipId> &arg) const noexcept
|
||||||
{
|
{
|
||||||
std::size_t seed = std::hash<IdString>()(arg.first);
|
std::size_t seed = std::hash<IdString>()(arg.first);
|
||||||
seed ^= std::hash<PipId>()(arg.second) + 0x9e3779b9 + (seed << 6) +
|
seed ^= std::hash<PipId>()(arg.second) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||||
(seed >> 2);
|
|
||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -60,8 +57,7 @@ struct QueuedWire
|
|||||||
|
|
||||||
struct Greater
|
struct Greater
|
||||||
{
|
{
|
||||||
bool operator()(const QueuedWire &lhs, const QueuedWire &rhs) const
|
bool operator()(const QueuedWire &lhs, const QueuedWire &rhs) const noexcept
|
||||||
noexcept
|
|
||||||
{
|
{
|
||||||
delay_t l = lhs.delay + lhs.togo, r = rhs.delay + rhs.togo;
|
delay_t l = lhs.delay + lhs.togo, r = rhs.delay + rhs.togo;
|
||||||
return l == r ? lhs.randtag > rhs.randtag : l > r;
|
return l == r ? lhs.randtag > rhs.randtag : l > r;
|
||||||
@ -71,8 +67,7 @@ struct QueuedWire
|
|||||||
|
|
||||||
struct RipupScoreboard
|
struct RipupScoreboard
|
||||||
{
|
{
|
||||||
std::unordered_map<std::pair<IdString, WireId>, int, hash_id_wire>
|
std::unordered_map<std::pair<IdString, WireId>, int, hash_id_wire> wireScores;
|
||||||
wireScores;
|
|
||||||
std::unordered_map<std::pair<IdString, PipId>, int, hash_id_pip> pipScores;
|
std::unordered_map<std::pair<IdString, PipId>, int, hash_id_pip> pipScores;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -117,12 +112,9 @@ struct Router
|
|||||||
delay_t maxDelay = 0.0;
|
delay_t maxDelay = 0.0;
|
||||||
WireId failedDest;
|
WireId failedDest;
|
||||||
|
|
||||||
void route(const std::unordered_map<WireId, delay_t> &src_wires,
|
void route(const std::unordered_map<WireId, delay_t> &src_wires, WireId dst_wire)
|
||||||
WireId dst_wire)
|
|
||||||
{
|
{
|
||||||
std::priority_queue<QueuedWire, std::vector<QueuedWire>,
|
std::priority_queue<QueuedWire, std::vector<QueuedWire>, QueuedWire::Greater> queue;
|
||||||
QueuedWire::Greater>
|
|
||||||
queue;
|
|
||||||
|
|
||||||
visited.clear();
|
visited.clear();
|
||||||
|
|
||||||
@ -141,8 +133,7 @@ struct Router
|
|||||||
int thisVisitCnt = 0;
|
int thisVisitCnt = 0;
|
||||||
int thisVisitCntLimit = 0;
|
int thisVisitCntLimit = 0;
|
||||||
|
|
||||||
while (!queue.empty() &&
|
while (!queue.empty() && (thisVisitCntLimit == 0 || thisVisitCnt < thisVisitCntLimit)) {
|
||||||
(thisVisitCntLimit == 0 || thisVisitCnt < thisVisitCntLimit)) {
|
|
||||||
QueuedWire qw = queue.top();
|
QueuedWire qw = queue.top();
|
||||||
queue.pop();
|
queue.pop();
|
||||||
|
|
||||||
@ -150,8 +141,7 @@ struct Router
|
|||||||
thisVisitCntLimit = (thisVisitCnt * 3) / 2;
|
thisVisitCntLimit = (thisVisitCnt * 3) / 2;
|
||||||
|
|
||||||
for (auto pip : ctx->getPipsDownhill(qw.wire)) {
|
for (auto pip : ctx->getPipsDownhill(qw.wire)) {
|
||||||
delay_t next_delay =
|
delay_t next_delay = qw.delay + ctx->getPipDelay(pip).avgDelay();
|
||||||
qw.delay + ctx->getPipDelay(pip).avgDelay();
|
|
||||||
WireId next_wire = ctx->getPipDstWire(pip);
|
WireId next_wire = ctx->getPipDstWire(pip);
|
||||||
bool foundRipupNet = false;
|
bool foundRipupNet = false;
|
||||||
thisVisitCnt++;
|
thisVisitCnt++;
|
||||||
@ -162,8 +152,7 @@ struct Router
|
|||||||
IdString ripupWireNet = ctx->getConflictingWireNet(next_wire);
|
IdString ripupWireNet = ctx->getConflictingWireNet(next_wire);
|
||||||
if (ripupWireNet == net_name || ripupWireNet == IdString())
|
if (ripupWireNet == net_name || ripupWireNet == IdString())
|
||||||
continue;
|
continue;
|
||||||
auto it = scores.wireScores.find(
|
auto it = scores.wireScores.find(std::make_pair(ripupWireNet, next_wire));
|
||||||
std::make_pair(ripupWireNet, next_wire));
|
|
||||||
if (it != scores.wireScores.end())
|
if (it != scores.wireScores.end())
|
||||||
next_delay += it->second * ripup_penalty;
|
next_delay += it->second * ripup_penalty;
|
||||||
foundRipupNet = true;
|
foundRipupNet = true;
|
||||||
@ -175,8 +164,7 @@ struct Router
|
|||||||
IdString ripupPipNet = ctx->getConflictingPipNet(pip);
|
IdString ripupPipNet = ctx->getConflictingPipNet(pip);
|
||||||
if (ripupPipNet == net_name || ripupPipNet == IdString())
|
if (ripupPipNet == net_name || ripupPipNet == IdString())
|
||||||
continue;
|
continue;
|
||||||
auto it = scores.pipScores.find(
|
auto it = scores.pipScores.find(std::make_pair(ripupPipNet, pip));
|
||||||
std::make_pair(ripupPipNet, pip));
|
|
||||||
if (it != scores.pipScores.end())
|
if (it != scores.pipScores.end())
|
||||||
next_delay += it->second * ripup_penalty;
|
next_delay += it->second * ripup_penalty;
|
||||||
foundRipupNet = true;
|
foundRipupNet = true;
|
||||||
@ -188,8 +176,7 @@ struct Router
|
|||||||
assert(next_delay >= 0);
|
assert(next_delay >= 0);
|
||||||
|
|
||||||
if (visited.count(next_wire)) {
|
if (visited.count(next_wire)) {
|
||||||
if (visited.at(next_wire).delay <=
|
if (visited.at(next_wire).delay <= next_delay + ctx->getDelayEpsilon())
|
||||||
next_delay + ctx->getDelayEpsilon())
|
|
||||||
continue;
|
continue;
|
||||||
#if 0 // FIXME
|
#if 0 // FIXME
|
||||||
if (ctx->debug)
|
if (ctx->debug)
|
||||||
@ -220,10 +207,9 @@ struct Router
|
|||||||
visitCnt += thisVisitCnt;
|
visitCnt += thisVisitCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Router(Context *ctx, RipupScoreboard &scores, WireId src_wire,
|
Router(Context *ctx, RipupScoreboard &scores, WireId src_wire, WireId dst_wire, bool ripup = false,
|
||||||
WireId dst_wire, bool ripup = false, delay_t ripup_penalty = 0)
|
delay_t ripup_penalty = 0)
|
||||||
: ctx(ctx), scores(scores), ripup(ripup),
|
: ctx(ctx), scores(scores), ripup(ripup), ripup_penalty(ripup_penalty)
|
||||||
ripup_penalty(ripup_penalty)
|
|
||||||
{
|
{
|
||||||
std::unordered_map<WireId, delay_t> src_wires;
|
std::unordered_map<WireId, delay_t> src_wires;
|
||||||
src_wires[src_wire] = 0;
|
src_wires[src_wire] = 0;
|
||||||
@ -236,8 +222,7 @@ struct Router
|
|||||||
WireId cursor = dst_wire;
|
WireId cursor = dst_wire;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
log(" %8.3f %s\n", ctx->getDelayNS(visited[cursor].delay),
|
log(" %8.3f %s\n", ctx->getDelayNS(visited[cursor].delay), ctx->getWireName(cursor).c_str(ctx));
|
||||||
ctx->getWireName(cursor).c_str(ctx));
|
|
||||||
|
|
||||||
if (cursor == src_wire)
|
if (cursor == src_wire)
|
||||||
break;
|
break;
|
||||||
@ -247,10 +232,8 @@ struct Router
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Router(Context *ctx, RipupScoreboard &scores, IdString net_name,
|
Router(Context *ctx, RipupScoreboard &scores, IdString net_name, bool ripup = false, delay_t ripup_penalty = 0)
|
||||||
bool ripup = false, delay_t ripup_penalty = 0)
|
: ctx(ctx), scores(scores), net_name(net_name), ripup(ripup), ripup_penalty(ripup_penalty)
|
||||||
: ctx(ctx), scores(scores), net_name(net_name), ripup(ripup),
|
|
||||||
ripup_penalty(ripup_penalty)
|
|
||||||
{
|
{
|
||||||
auto net_info = ctx->nets.at(net_name);
|
auto net_info = ctx->nets.at(net_name);
|
||||||
|
|
||||||
@ -258,14 +241,12 @@ struct Router
|
|||||||
log("Routing net %s.\n", net_name.c_str(ctx));
|
log("Routing net %s.\n", net_name.c_str(ctx));
|
||||||
|
|
||||||
if (ctx->debug)
|
if (ctx->debug)
|
||||||
log(" Source: %s.%s.\n", net_info->driver.cell->name.c_str(ctx),
|
log(" Source: %s.%s.\n", net_info->driver.cell->name.c_str(ctx), net_info->driver.port.c_str(ctx));
|
||||||
net_info->driver.port.c_str(ctx));
|
|
||||||
|
|
||||||
auto src_bel = net_info->driver.cell->bel;
|
auto src_bel = net_info->driver.cell->bel;
|
||||||
|
|
||||||
if (src_bel == BelId())
|
if (src_bel == BelId())
|
||||||
log_error("Source cell %s (%s) is not mapped to a bel.\n",
|
log_error("Source cell %s (%s) is not mapped to a bel.\n", net_info->driver.cell->name.c_str(ctx),
|
||||||
net_info->driver.cell->name.c_str(ctx),
|
|
||||||
net_info->driver.cell->type.c_str(ctx));
|
net_info->driver.cell->type.c_str(ctx));
|
||||||
|
|
||||||
if (ctx->debug)
|
if (ctx->debug)
|
||||||
@ -277,14 +258,12 @@ struct Router
|
|||||||
if (driver_port_it != net_info->driver.cell->pins.end())
|
if (driver_port_it != net_info->driver.cell->pins.end())
|
||||||
driver_port = driver_port_it->second;
|
driver_port = driver_port_it->second;
|
||||||
|
|
||||||
auto src_wire =
|
auto src_wire = ctx->getWireBelPin(src_bel, ctx->portPinFromId(driver_port));
|
||||||
ctx->getWireBelPin(src_bel, ctx->portPinFromId(driver_port));
|
|
||||||
|
|
||||||
if (src_wire == WireId())
|
if (src_wire == WireId())
|
||||||
log_error("No wire found for port %s (pin %s) on source cell %s "
|
log_error("No wire found for port %s (pin %s) on source cell %s "
|
||||||
"(bel %s).\n",
|
"(bel %s).\n",
|
||||||
net_info->driver.port.c_str(ctx), driver_port.c_str(ctx),
|
net_info->driver.port.c_str(ctx), driver_port.c_str(ctx), net_info->driver.cell->name.c_str(ctx),
|
||||||
net_info->driver.cell->name.c_str(ctx),
|
|
||||||
ctx->getBelName(src_bel).c_str(ctx));
|
ctx->getBelName(src_bel).c_str(ctx));
|
||||||
|
|
||||||
if (ctx->debug)
|
if (ctx->debug)
|
||||||
@ -299,19 +278,16 @@ struct Router
|
|||||||
|
|
||||||
for (auto &user_it : users_array) {
|
for (auto &user_it : users_array) {
|
||||||
if (ctx->debug)
|
if (ctx->debug)
|
||||||
log(" Route to: %s.%s.\n", user_it.cell->name.c_str(ctx),
|
log(" Route to: %s.%s.\n", user_it.cell->name.c_str(ctx), user_it.port.c_str(ctx));
|
||||||
user_it.port.c_str(ctx));
|
|
||||||
|
|
||||||
auto dst_bel = user_it.cell->bel;
|
auto dst_bel = user_it.cell->bel;
|
||||||
|
|
||||||
if (dst_bel == BelId())
|
if (dst_bel == BelId())
|
||||||
log_error("Destination cell %s (%s) is not mapped to a bel.\n",
|
log_error("Destination cell %s (%s) is not mapped to a bel.\n", user_it.cell->name.c_str(ctx),
|
||||||
user_it.cell->name.c_str(ctx),
|
|
||||||
user_it.cell->type.c_str(ctx));
|
user_it.cell->type.c_str(ctx));
|
||||||
|
|
||||||
if (ctx->debug)
|
if (ctx->debug)
|
||||||
log(" Destination bel: %s\n",
|
log(" Destination bel: %s\n", ctx->getBelName(dst_bel).c_str(ctx));
|
||||||
ctx->getBelName(dst_bel).c_str(ctx));
|
|
||||||
|
|
||||||
IdString user_port = user_it.port;
|
IdString user_port = user_it.port;
|
||||||
|
|
||||||
@ -320,33 +296,27 @@ struct Router
|
|||||||
if (user_port_it != user_it.cell->pins.end())
|
if (user_port_it != user_it.cell->pins.end())
|
||||||
user_port = user_port_it->second;
|
user_port = user_port_it->second;
|
||||||
|
|
||||||
auto dst_wire =
|
auto dst_wire = ctx->getWireBelPin(dst_bel, ctx->portPinFromId(user_port));
|
||||||
ctx->getWireBelPin(dst_bel, ctx->portPinFromId(user_port));
|
|
||||||
|
|
||||||
if (dst_wire == WireId())
|
if (dst_wire == WireId())
|
||||||
log_error("No wire found for port %s (pin %s) on destination "
|
log_error("No wire found for port %s (pin %s) on destination "
|
||||||
"cell %s (bel %s).\n",
|
"cell %s (bel %s).\n",
|
||||||
user_it.port.c_str(ctx), user_port.c_str(ctx),
|
user_it.port.c_str(ctx), user_port.c_str(ctx), user_it.cell->name.c_str(ctx),
|
||||||
user_it.cell->name.c_str(ctx),
|
|
||||||
ctx->getBelName(dst_bel).c_str(ctx));
|
ctx->getBelName(dst_bel).c_str(ctx));
|
||||||
|
|
||||||
if (ctx->debug) {
|
if (ctx->debug) {
|
||||||
log(" Destination wire: %s\n",
|
log(" Destination wire: %s\n", ctx->getWireName(dst_wire).c_str(ctx));
|
||||||
ctx->getWireName(dst_wire).c_str(ctx));
|
log(" Path delay estimate: %.2f\n", float(ctx->estimateDelay(src_wire, dst_wire)));
|
||||||
log(" Path delay estimate: %.2f\n",
|
|
||||||
float(ctx->estimateDelay(src_wire, dst_wire)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
route(src_wires, dst_wire);
|
route(src_wires, dst_wire);
|
||||||
|
|
||||||
if (visited.count(dst_wire) == 0) {
|
if (visited.count(dst_wire) == 0) {
|
||||||
if (ctx->debug)
|
if (ctx->debug)
|
||||||
log("Failed to route %s -> %s.\n",
|
log("Failed to route %s -> %s.\n", ctx->getWireName(src_wire).c_str(ctx),
|
||||||
ctx->getWireName(src_wire).c_str(ctx),
|
|
||||||
ctx->getWireName(dst_wire).c_str(ctx));
|
ctx->getWireName(dst_wire).c_str(ctx));
|
||||||
else if (ripup)
|
else if (ripup)
|
||||||
log_info("Failed to route %s -> %s.\n",
|
log_info("Failed to route %s -> %s.\n", ctx->getWireName(src_wire).c_str(ctx),
|
||||||
ctx->getWireName(src_wire).c_str(ctx),
|
|
||||||
ctx->getWireName(dst_wire).c_str(ctx));
|
ctx->getWireName(dst_wire).c_str(ctx));
|
||||||
ripup_net(ctx, net_name);
|
ripup_net(ctx, net_name);
|
||||||
failedDest = dst_wire;
|
failedDest = dst_wire;
|
||||||
@ -354,8 +324,7 @@ struct Router
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->debug)
|
if (ctx->debug)
|
||||||
log(" Final path delay: %.3f\n",
|
log(" Final path delay: %.3f\n", ctx->getDelayNS(visited[dst_wire].delay));
|
||||||
ctx->getDelayNS(visited[dst_wire].delay));
|
|
||||||
maxDelay = fmaxf(maxDelay, visited[dst_wire].delay);
|
maxDelay = fmaxf(maxDelay, visited[dst_wire].delay);
|
||||||
|
|
||||||
if (ctx->debug)
|
if (ctx->debug)
|
||||||
@ -365,16 +334,13 @@ struct Router
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (ctx->debug)
|
if (ctx->debug)
|
||||||
log(" %8.3f %s\n",
|
log(" %8.3f %s\n", ctx->getDelayNS(visited[cursor].delay), ctx->getWireName(cursor).c_str(ctx));
|
||||||
ctx->getDelayNS(visited[cursor].delay),
|
|
||||||
ctx->getWireName(cursor).c_str(ctx));
|
|
||||||
|
|
||||||
if (src_wires.count(cursor))
|
if (src_wires.count(cursor))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
IdString conflicting_wire_net = ctx->getConflictingWireNet(cursor);
|
IdString conflicting_wire_net = ctx->getConflictingWireNet(cursor);
|
||||||
IdString conflicting_pip_net =
|
IdString conflicting_pip_net = ctx->getConflictingPipNet(visited[cursor].pip);
|
||||||
ctx->getConflictingPipNet(visited[cursor].pip);
|
|
||||||
|
|
||||||
if (conflicting_wire_net != IdString()) {
|
if (conflicting_wire_net != IdString()) {
|
||||||
assert(ripup);
|
assert(ripup);
|
||||||
@ -382,8 +348,7 @@ struct Router
|
|||||||
ripup_net(ctx, conflicting_wire_net);
|
ripup_net(ctx, conflicting_wire_net);
|
||||||
rippedNets.insert(conflicting_wire_net);
|
rippedNets.insert(conflicting_wire_net);
|
||||||
scores.wireScores[std::make_pair(net_name, cursor)]++;
|
scores.wireScores[std::make_pair(net_name, cursor)]++;
|
||||||
scores.wireScores[std::make_pair(conflicting_wire_net,
|
scores.wireScores[std::make_pair(conflicting_wire_net, cursor)]++;
|
||||||
cursor)]++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conflicting_pip_net != IdString()) {
|
if (conflicting_pip_net != IdString()) {
|
||||||
@ -393,10 +358,8 @@ struct Router
|
|||||||
ripup_net(ctx, conflicting_pip_net);
|
ripup_net(ctx, conflicting_pip_net);
|
||||||
rippedNets.insert(conflicting_pip_net);
|
rippedNets.insert(conflicting_pip_net);
|
||||||
}
|
}
|
||||||
scores.pipScores[std::make_pair(net_name,
|
scores.pipScores[std::make_pair(net_name, visited[cursor].pip)]++;
|
||||||
visited[cursor].pip)]++;
|
scores.pipScores[std::make_pair(conflicting_pip_net, visited[cursor].pip)]++;
|
||||||
scores.pipScores[std::make_pair(conflicting_pip_net,
|
|
||||||
visited[cursor].pip)]++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->bindPip(visited[cursor].pip, net_name, STRENGTH_WEAK);
|
ctx->bindPip(visited[cursor].pip, net_name, STRENGTH_WEAK);
|
||||||
@ -443,8 +406,7 @@ bool route_design(Context *ctx)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_info("found %d unrouted nets. starting routing procedure.\n",
|
log_info("found %d unrouted nets. starting routing procedure.\n", int(netsQueue.size()));
|
||||||
int(netsQueue.size()));
|
|
||||||
|
|
||||||
delay_t estimatedTotalDelay = 0.0;
|
delay_t estimatedTotalDelay = 0.0;
|
||||||
int estimatedTotalDelayCnt = 0;
|
int estimatedTotalDelayCnt = 0;
|
||||||
@ -463,8 +425,7 @@ bool route_design(Context *ctx)
|
|||||||
if (driver_port_it != net_info->driver.cell->pins.end())
|
if (driver_port_it != net_info->driver.cell->pins.end())
|
||||||
driver_port = driver_port_it->second;
|
driver_port = driver_port_it->second;
|
||||||
|
|
||||||
auto src_wire = ctx->getWireBelPin(src_bel,
|
auto src_wire = ctx->getWireBelPin(src_bel, ctx->portPinFromId(driver_port));
|
||||||
ctx->portPinFromId(driver_port));
|
|
||||||
|
|
||||||
if (src_wire == WireId())
|
if (src_wire == WireId())
|
||||||
continue;
|
continue;
|
||||||
@ -482,8 +443,7 @@ bool route_design(Context *ctx)
|
|||||||
if (user_port_it != user_it.cell->pins.end())
|
if (user_port_it != user_it.cell->pins.end())
|
||||||
user_port = user_port_it->second;
|
user_port = user_port_it->second;
|
||||||
|
|
||||||
auto dst_wire = ctx->getWireBelPin(
|
auto dst_wire = ctx->getWireBelPin(dst_bel, ctx->portPinFromId(user_port));
|
||||||
dst_bel, ctx->portPinFromId(user_port));
|
|
||||||
|
|
||||||
if (dst_wire == WireId())
|
if (dst_wire == WireId())
|
||||||
continue;
|
continue;
|
||||||
@ -493,8 +453,7 @@ bool route_design(Context *ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log_info("estimated total wire delay: %.2f (avg %.2f)\n",
|
log_info("estimated total wire delay: %.2f (avg %.2f)\n", float(estimatedTotalDelay),
|
||||||
float(estimatedTotalDelay),
|
|
||||||
float(estimatedTotalDelay) / estimatedTotalDelayCnt);
|
float(estimatedTotalDelay) / estimatedTotalDelayCnt);
|
||||||
|
|
||||||
int iterCnt = 0;
|
int iterCnt = 0;
|
||||||
@ -513,14 +472,12 @@ bool route_design(Context *ctx)
|
|||||||
if (ctx->verbose)
|
if (ctx->verbose)
|
||||||
log_info("-- %d --\n", iterCnt);
|
log_info("-- %d --\n", iterCnt);
|
||||||
|
|
||||||
int visitCnt = 0, revisitCnt = 0, overtimeRevisitCnt = 0,
|
int visitCnt = 0, revisitCnt = 0, overtimeRevisitCnt = 0, netCnt = 0;
|
||||||
netCnt = 0;
|
|
||||||
|
|
||||||
std::unordered_set<IdString> ripupQueue;
|
std::unordered_set<IdString> ripupQueue;
|
||||||
|
|
||||||
if (ctx->verbose || iterCnt == 1)
|
if (ctx->verbose || iterCnt == 1)
|
||||||
log_info("routing queue contains %d nets.\n",
|
log_info("routing queue contains %d nets.\n", int(netsQueue.size()));
|
||||||
int(netsQueue.size()));
|
|
||||||
|
|
||||||
bool printNets = ctx->verbose && (netsQueue.size() < 10);
|
bool printNets = ctx->verbose && (netsQueue.size() < 10);
|
||||||
|
|
||||||
@ -530,8 +487,7 @@ bool route_design(Context *ctx)
|
|||||||
|
|
||||||
for (auto net_name : netsArray) {
|
for (auto net_name : netsArray) {
|
||||||
if (printNets)
|
if (printNets)
|
||||||
log_info(" routing net %s. (%d users)\n",
|
log_info(" routing net %s. (%d users)\n", net_name.c_str(ctx),
|
||||||
net_name.c_str(ctx),
|
|
||||||
int(ctx->nets.at(net_name)->users.size()));
|
int(ctx->nets.at(net_name)->users.size()));
|
||||||
|
|
||||||
Router router(ctx, scores, net_name, false);
|
Router router(ctx, scores, net_name, false);
|
||||||
@ -543,30 +499,25 @@ bool route_design(Context *ctx)
|
|||||||
|
|
||||||
if (!router.routedOkay) {
|
if (!router.routedOkay) {
|
||||||
if (printNets)
|
if (printNets)
|
||||||
log_info(
|
log_info(" failed to route to %s.\n", ctx->getWireName(router.failedDest).c_str(ctx));
|
||||||
" failed to route to %s.\n",
|
|
||||||
ctx->getWireName(router.failedDest).c_str(ctx));
|
|
||||||
ripupQueue.insert(net_name);
|
ripupQueue.insert(net_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ctx->verbose || iterCnt == 1) && !printNets &&
|
if ((ctx->verbose || iterCnt == 1) && !printNets && (netCnt % 100 == 0))
|
||||||
(netCnt % 100 == 0))
|
log_info(" processed %d nets. (%d routed, %d failed)\n", netCnt, netCnt - int(ripupQueue.size()),
|
||||||
log_info(" processed %d nets. (%d routed, %d failed)\n",
|
|
||||||
netCnt, netCnt - int(ripupQueue.size()),
|
|
||||||
int(ripupQueue.size()));
|
int(ripupQueue.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
int normalRouteCnt = netCnt - int(ripupQueue.size());
|
int normalRouteCnt = netCnt - int(ripupQueue.size());
|
||||||
|
|
||||||
if ((ctx->verbose || iterCnt == 1) && (netCnt % 100 != 0))
|
if ((ctx->verbose || iterCnt == 1) && (netCnt % 100 != 0))
|
||||||
log_info(" processed %d nets. (%d routed, %d failed)\n",
|
log_info(" processed %d nets. (%d routed, %d failed)\n", netCnt, normalRouteCnt,
|
||||||
netCnt, normalRouteCnt, int(ripupQueue.size()));
|
int(ripupQueue.size()));
|
||||||
|
|
||||||
if (ctx->verbose)
|
if (ctx->verbose)
|
||||||
log_info(" visited %d PIPs (%.2f%% revisits, %.2f%% overtime "
|
log_info(" visited %d PIPs (%.2f%% revisits, %.2f%% overtime "
|
||||||
"revisits).\n",
|
"revisits).\n",
|
||||||
visitCnt, (100.0 * revisitCnt) / visitCnt,
|
visitCnt, (100.0 * revisitCnt) / visitCnt, (100.0 * overtimeRevisitCnt) / visitCnt);
|
||||||
(100.0 * overtimeRevisitCnt) / visitCnt);
|
|
||||||
|
|
||||||
if (!ripupQueue.empty()) {
|
if (!ripupQueue.empty()) {
|
||||||
if (ctx->verbose || iterCnt == 1)
|
if (ctx->verbose || iterCnt == 1)
|
||||||
@ -582,14 +533,12 @@ bool route_design(Context *ctx)
|
|||||||
netCnt = 0;
|
netCnt = 0;
|
||||||
int ripCnt = 0;
|
int ripCnt = 0;
|
||||||
|
|
||||||
std::vector<IdString> ripupArray(ripupQueue.begin(),
|
std::vector<IdString> ripupArray(ripupQueue.begin(), ripupQueue.end());
|
||||||
ripupQueue.end());
|
|
||||||
ctx->sorted_shuffle(ripupArray);
|
ctx->sorted_shuffle(ripupArray);
|
||||||
|
|
||||||
for (auto net_name : ripupArray) {
|
for (auto net_name : ripupArray) {
|
||||||
if (printNets)
|
if (printNets)
|
||||||
log_info(" routing net %s. (%d users)\n",
|
log_info(" routing net %s. (%d users)\n", net_name.c_str(ctx),
|
||||||
net_name.c_str(ctx),
|
|
||||||
int(ctx->nets.at(net_name)->users.size()));
|
int(ctx->nets.at(net_name)->users.size()));
|
||||||
|
|
||||||
Router router(ctx, scores, net_name, true, ripup_penalty);
|
Router router(ctx, scores, net_name, true, ripup_penalty);
|
||||||
@ -600,42 +549,34 @@ bool route_design(Context *ctx)
|
|||||||
overtimeRevisitCnt += router.overtimeRevisitCnt;
|
overtimeRevisitCnt += router.overtimeRevisitCnt;
|
||||||
|
|
||||||
if (!router.routedOkay)
|
if (!router.routedOkay)
|
||||||
log_error("Net %s is impossible to route.\n",
|
log_error("Net %s is impossible to route.\n", net_name.c_str(ctx));
|
||||||
net_name.c_str(ctx));
|
|
||||||
|
|
||||||
for (auto it : router.rippedNets)
|
for (auto it : router.rippedNets)
|
||||||
netsQueue.insert(it);
|
netsQueue.insert(it);
|
||||||
|
|
||||||
if (printNets) {
|
if (printNets) {
|
||||||
if (router.rippedNets.size() < 10) {
|
if (router.rippedNets.size() < 10) {
|
||||||
log_info(" ripped up %d other nets:\n",
|
log_info(" ripped up %d other nets:\n", int(router.rippedNets.size()));
|
||||||
int(router.rippedNets.size()));
|
|
||||||
for (auto n : router.rippedNets)
|
for (auto n : router.rippedNets)
|
||||||
log_info(" %s (%d users)\n", n.c_str(ctx),
|
log_info(" %s (%d users)\n", n.c_str(ctx), int(ctx->nets.at(n)->users.size()));
|
||||||
int(ctx->nets.at(n)->users.size()));
|
|
||||||
} else {
|
} else {
|
||||||
log_info(" ripped up %d other nets.\n",
|
log_info(" ripped up %d other nets.\n", int(router.rippedNets.size()));
|
||||||
int(router.rippedNets.size()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ripCnt += router.rippedNets.size();
|
ripCnt += router.rippedNets.size();
|
||||||
|
|
||||||
if ((ctx->verbose || iterCnt == 1) && !printNets &&
|
if ((ctx->verbose || iterCnt == 1) && !printNets && (netCnt % 100 == 0))
|
||||||
(netCnt % 100 == 0))
|
log_info(" routed %d nets, ripped %d nets.\n", netCnt, ripCnt);
|
||||||
log_info(" routed %d nets, ripped %d nets.\n", netCnt,
|
|
||||||
ripCnt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ctx->verbose || iterCnt == 1) && (netCnt % 100 != 0))
|
if ((ctx->verbose || iterCnt == 1) && (netCnt % 100 != 0))
|
||||||
log_info(" routed %d nets, ripped %d nets.\n", netCnt,
|
log_info(" routed %d nets, ripped %d nets.\n", netCnt, ripCnt);
|
||||||
ripCnt);
|
|
||||||
|
|
||||||
if (ctx->verbose)
|
if (ctx->verbose)
|
||||||
log_info(" visited %d PIPs (%.2f%% revisits, %.2f%% "
|
log_info(" visited %d PIPs (%.2f%% revisits, %.2f%% "
|
||||||
"overtime revisits).\n",
|
"overtime revisits).\n",
|
||||||
visitCnt, (100.0 * revisitCnt) / visitCnt,
|
visitCnt, (100.0 * revisitCnt) / visitCnt, (100.0 * overtimeRevisitCnt) / visitCnt);
|
||||||
(100.0 * overtimeRevisitCnt) / visitCnt);
|
|
||||||
|
|
||||||
if (ctx->verbose && !netsQueue.empty())
|
if (ctx->verbose && !netsQueue.empty())
|
||||||
log_info(" ripped up %d previously routed nets. continue "
|
log_info(" ripped up %d previously routed nets. continue "
|
||||||
@ -644,8 +585,7 @@ bool route_design(Context *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ctx->verbose)
|
if (!ctx->verbose)
|
||||||
log_info(
|
log_info("iteration %d: routed %d nets without ripup, routed %d "
|
||||||
"iteration %d: routed %d nets without ripup, routed %d "
|
|
||||||
"nets with ripup.\n",
|
"nets with ripup.\n",
|
||||||
iterCnt, normalRouteCnt, int(ripupQueue.size()));
|
iterCnt, normalRouteCnt, int(ripupQueue.size()));
|
||||||
|
|
||||||
@ -653,8 +593,7 @@ bool route_design(Context *ctx)
|
|||||||
totalRevisitCnt += revisitCnt;
|
totalRevisitCnt += revisitCnt;
|
||||||
totalOvertimeRevisitCnt += overtimeRevisitCnt;
|
totalOvertimeRevisitCnt += overtimeRevisitCnt;
|
||||||
|
|
||||||
if (iterCnt == 8 || iterCnt == 16 || iterCnt == 32 ||
|
if (iterCnt == 8 || iterCnt == 16 || iterCnt == 32 || iterCnt == 64 || iterCnt == 128)
|
||||||
iterCnt == 64 || iterCnt == 128)
|
|
||||||
ripup_penalty += ctx->getRipupDelayPenalty();
|
ripup_penalty += ctx->getRipupDelayPenalty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,8 +617,7 @@ bool route_design(Context *ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_actual_route_delay(Context *ctx, WireId src_wire, WireId dst_wire,
|
bool get_actual_route_delay(Context *ctx, WireId src_wire, WireId dst_wire, delay_t &delay)
|
||||||
delay_t &delay)
|
|
||||||
{
|
{
|
||||||
RipupScoreboard scores;
|
RipupScoreboard scores;
|
||||||
Router router(ctx, scores, src_wire, dst_wire);
|
Router router(ctx, scores, src_wire, dst_wire);
|
||||||
|
@ -25,8 +25,7 @@
|
|||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
extern bool route_design(Context *ctx);
|
extern bool route_design(Context *ctx);
|
||||||
extern bool get_actual_route_delay(Context *ctx, WireId src_wire,
|
extern bool get_actual_route_delay(Context *ctx, WireId src_wire, WireId dst_wire, delay_t &delay);
|
||||||
WireId dst_wire, delay_t &delay);
|
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
|
@ -181,20 +181,13 @@ std::vector<GraphicElement> Arch::getPipGraphics(PipId pip) const
|
|||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
|
||||||
bool Arch::getCellDelay(const CellInfo *cell, IdString fromPort,
|
bool Arch::getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, delay_t &delay) const
|
||||||
IdString toPort, delay_t &delay) const
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IdString Arch::getPortClock(const CellInfo *cell, IdString port) const
|
IdString Arch::getPortClock(const CellInfo *cell, IdString port) const { return IdString(); }
|
||||||
{
|
|
||||||
return IdString();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Arch::isClockPort(const CellInfo *cell, IdString port) const
|
bool Arch::isClockPort(const CellInfo *cell, IdString port) const { return false; }
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -144,8 +144,7 @@ struct Arch : BaseCtx
|
|||||||
std::unordered_set<WireId> wireGraphicsReload;
|
std::unordered_set<WireId> wireGraphicsReload;
|
||||||
std::unordered_set<PipId> pipGraphicsReload;
|
std::unordered_set<PipId> pipGraphicsReload;
|
||||||
|
|
||||||
bool getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort,
|
bool getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, delay_t &delay) const;
|
||||||
delay_t &delay) const;
|
|
||||||
IdString getPortClock(const CellInfo *cell, IdString port) const;
|
IdString getPortClock(const CellInfo *cell, IdString port) const;
|
||||||
bool isClockPort(const CellInfo *cell, IdString port) const;
|
bool isClockPort(const CellInfo *cell, IdString port) const;
|
||||||
};
|
};
|
||||||
|
@ -122,33 +122,25 @@ PortPin Arch::portPinFromId(IdString type) const
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
static const ChipInfoPOD *get_chip_info(const RelPtr<ChipInfoPOD> *ptr)
|
static const ChipInfoPOD *get_chip_info(const RelPtr<ChipInfoPOD> *ptr) { return ptr->get(); }
|
||||||
{
|
|
||||||
return ptr->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
Arch::Arch(ArchArgs args) : args(args)
|
Arch::Arch(ArchArgs args) : args(args)
|
||||||
{
|
{
|
||||||
#ifdef ICE40_HX1K_ONLY
|
#ifdef ICE40_HX1K_ONLY
|
||||||
if (args.type == ArchArgs::HX1K) {
|
if (args.type == ArchArgs::HX1K) {
|
||||||
chip_info = get_chip_info(
|
chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_1k));
|
||||||
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_1k));
|
|
||||||
} else {
|
} else {
|
||||||
log_error("Unsupported iCE40 chip type.\n");
|
log_error("Unsupported iCE40 chip type.\n");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (args.type == ArchArgs::LP384) {
|
if (args.type == ArchArgs::LP384) {
|
||||||
chip_info = get_chip_info(
|
chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_384));
|
||||||
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_384));
|
|
||||||
} else if (args.type == ArchArgs::LP1K || args.type == ArchArgs::HX1K) {
|
} else if (args.type == ArchArgs::LP1K || args.type == ArchArgs::HX1K) {
|
||||||
chip_info = get_chip_info(
|
chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_1k));
|
||||||
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_1k));
|
|
||||||
} else if (args.type == ArchArgs::UP5K) {
|
} else if (args.type == ArchArgs::UP5K) {
|
||||||
chip_info = get_chip_info(
|
chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_5k));
|
||||||
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_5k));
|
|
||||||
} else if (args.type == ArchArgs::LP8K || args.type == ArchArgs::HX8K) {
|
} else if (args.type == ArchArgs::LP8K || args.type == ArchArgs::HX8K) {
|
||||||
chip_info = get_chip_info(
|
chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_8k));
|
||||||
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_8k));
|
|
||||||
} else {
|
} else {
|
||||||
log_error("Unsupported iCE40 chip type.\n");
|
log_error("Unsupported iCE40 chip type.\n");
|
||||||
}
|
}
|
||||||
@ -228,13 +220,11 @@ BelRange Arch::getBelsAtSameTile(BelId bel) const
|
|||||||
int x = chip_info->bel_data[bel.index].x;
|
int x = chip_info->bel_data[bel.index].x;
|
||||||
int y = chip_info->bel_data[bel.index].y;
|
int y = chip_info->bel_data[bel.index].y;
|
||||||
int start = bel.index, end = bel.index;
|
int start = bel.index, end = bel.index;
|
||||||
while (start >= 0 && chip_info->bel_data[start].x == x &&
|
while (start >= 0 && chip_info->bel_data[start].x == x && chip_info->bel_data[start].y == y)
|
||||||
chip_info->bel_data[start].y == y)
|
|
||||||
start--;
|
start--;
|
||||||
start++;
|
start++;
|
||||||
br.b.cursor = start;
|
br.b.cursor = start;
|
||||||
while (end < chip_info->num_bels && chip_info->bel_data[end].x == x &&
|
while (end < chip_info->num_bels && chip_info->bel_data[end].x == x && chip_info->bel_data[end].y == y)
|
||||||
chip_info->bel_data[end].y == y)
|
|
||||||
end++;
|
end++;
|
||||||
br.e.cursor = end;
|
br.e.cursor = end;
|
||||||
return br;
|
return br;
|
||||||
@ -247,8 +237,7 @@ WireId Arch::getWireBelPin(BelId bel, PortPin pin) const
|
|||||||
assert(bel != BelId());
|
assert(bel != BelId());
|
||||||
|
|
||||||
int num_bel_wires = chip_info->bel_data[bel.index].num_bel_wires;
|
int num_bel_wires = chip_info->bel_data[bel.index].num_bel_wires;
|
||||||
const BelWirePOD *bel_wires =
|
const BelWirePOD *bel_wires = chip_info->bel_data[bel.index].bel_wires.get();
|
||||||
chip_info->bel_data[bel.index].bel_wires.get();
|
|
||||||
|
|
||||||
for (int i = 0; i < num_bel_wires; i++)
|
for (int i = 0; i < num_bel_wires; i++)
|
||||||
if (bel_wires[i].port == pin) {
|
if (bel_wires[i].port == pin) {
|
||||||
@ -305,16 +294,13 @@ IdString Arch::getPipName(PipId pip) const
|
|||||||
int x = chip_info->pip_data[pip.index].x;
|
int x = chip_info->pip_data[pip.index].x;
|
||||||
int y = chip_info->pip_data[pip.index].y;
|
int y = chip_info->pip_data[pip.index].y;
|
||||||
|
|
||||||
std::string src_name =
|
std::string src_name = chip_info->wire_data[chip_info->pip_data[pip.index].src].name.get();
|
||||||
chip_info->wire_data[chip_info->pip_data[pip.index].src].name.get();
|
|
||||||
std::replace(src_name.begin(), src_name.end(), '/', '.');
|
std::replace(src_name.begin(), src_name.end(), '/', '.');
|
||||||
|
|
||||||
std::string dst_name =
|
std::string dst_name = chip_info->wire_data[chip_info->pip_data[pip.index].dst].name.get();
|
||||||
chip_info->wire_data[chip_info->pip_data[pip.index].dst].name.get();
|
|
||||||
std::replace(dst_name.begin(), dst_name.end(), '/', '.');
|
std::replace(dst_name.begin(), dst_name.end(), '/', '.');
|
||||||
|
|
||||||
return id("X" + std::to_string(x) + "/Y" + std::to_string(y) + "/" +
|
return id("X" + std::to_string(x) + "/Y" + std::to_string(y) + "/" + src_name + ".->." + dst_name);
|
||||||
src_name + ".->." + dst_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
@ -401,17 +387,14 @@ std::vector<GraphicElement> Arch::getBelGraphics(BelId bel) const
|
|||||||
el.type = GraphicElement::G_BOX;
|
el.type = GraphicElement::G_BOX;
|
||||||
el.x1 = chip_info->bel_data[bel.index].x + 0.1;
|
el.x1 = chip_info->bel_data[bel.index].x + 0.1;
|
||||||
el.x2 = chip_info->bel_data[bel.index].x + 0.9;
|
el.x2 = chip_info->bel_data[bel.index].x + 0.9;
|
||||||
el.y1 = chip_info->bel_data[bel.index].y + 0.10 +
|
el.y1 = chip_info->bel_data[bel.index].y + 0.10 + (chip_info->bel_data[bel.index].z) * (0.8 / 8);
|
||||||
(chip_info->bel_data[bel.index].z) * (0.8 / 8);
|
el.y2 = chip_info->bel_data[bel.index].y + 0.18 + (chip_info->bel_data[bel.index].z) * (0.8 / 8);
|
||||||
el.y2 = chip_info->bel_data[bel.index].y + 0.18 +
|
|
||||||
(chip_info->bel_data[bel.index].z) * (0.8 / 8);
|
|
||||||
el.z = 0;
|
el.z = 0;
|
||||||
ret.push_back(el);
|
ret.push_back(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bel_type == TYPE_SB_IO) {
|
if (bel_type == TYPE_SB_IO) {
|
||||||
if (chip_info->bel_data[bel.index].x == 0 ||
|
if (chip_info->bel_data[bel.index].x == 0 || chip_info->bel_data[bel.index].x == chip_info->width - 1) {
|
||||||
chip_info->bel_data[bel.index].x == chip_info->width - 1) {
|
|
||||||
GraphicElement el;
|
GraphicElement el;
|
||||||
el.type = GraphicElement::G_BOX;
|
el.type = GraphicElement::G_BOX;
|
||||||
el.x1 = chip_info->bel_data[bel.index].x + 0.1;
|
el.x1 = chip_info->bel_data[bel.index].x + 0.1;
|
||||||
@ -472,12 +455,10 @@ std::vector<GraphicElement> Arch::getPipGraphics(PipId pip) const
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
bool Arch::getCellDelay(const CellInfo *cell, IdString fromPort,
|
bool Arch::getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, delay_t &delay) const
|
||||||
IdString toPort, delay_t &delay) const
|
|
||||||
{
|
{
|
||||||
if (cell->type == id("ICESTORM_LC")) {
|
if (cell->type == id("ICESTORM_LC")) {
|
||||||
if (fromPort == id("I0") || fromPort == id("I1") ||
|
if (fromPort == id("I0") || fromPort == id("I1") || fromPort == id("I2") || fromPort == id("I3")) {
|
||||||
fromPort == id("I2") || fromPort == id("I3")) {
|
|
||||||
if (toPort == id("O") || toPort == id("LO")) {
|
if (toPort == id("O") || toPort == id("LO")) {
|
||||||
delay = 450;
|
delay = 450;
|
||||||
return true;
|
return true;
|
||||||
@ -489,8 +470,7 @@ bool Arch::getCellDelay(const CellInfo *cell, IdString fromPort,
|
|||||||
|
|
||||||
IdString Arch::getPortClock(const CellInfo *cell, IdString port) const
|
IdString Arch::getPortClock(const CellInfo *cell, IdString port) const
|
||||||
{
|
{
|
||||||
if (cell->type == id("ICESTORM_LC") &&
|
if (cell->type == id("ICESTORM_LC") && bool_or_default(cell->params, id("DFF_ENABLE"))) {
|
||||||
bool_or_default(cell->params, id("DFF_ENABLE"))) {
|
|
||||||
if (port != id("LO") && port != id("CIN") && port != id("COUT"))
|
if (port != id("LO") && port != id("CIN") && port != id("COUT"))
|
||||||
return id("CLK");
|
return id("CLK");
|
||||||
}
|
}
|
||||||
|
78
ice40/arch.h
78
ice40/arch.h
@ -98,11 +98,7 @@ template <typename T> struct RelPtr
|
|||||||
// reinterpret_cast<const char*>(this);
|
// reinterpret_cast<const char*>(this);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
const T *get() const
|
const T *get() const { return reinterpret_cast<const T *>(reinterpret_cast<const char *>(this) + offset); }
|
||||||
{
|
|
||||||
return reinterpret_cast<const T *>(
|
|
||||||
reinterpret_cast<const char *>(this) + offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
const T &operator[](size_t index) const { return get()[index]; }
|
const T &operator[](size_t index) const { return get()[index]; }
|
||||||
|
|
||||||
@ -283,17 +279,12 @@ NEXTPNR_NAMESPACE_END
|
|||||||
namespace std {
|
namespace std {
|
||||||
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX BelId>
|
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX BelId>
|
||||||
{
|
{
|
||||||
std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX BelId &bel) const
|
std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX BelId &bel) const noexcept { return hash<int>()(bel.index); }
|
||||||
noexcept
|
|
||||||
{
|
|
||||||
return hash<int>()(bel.index);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX WireId>
|
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX WireId>
|
||||||
{
|
{
|
||||||
std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX WireId &wire) const
|
std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX WireId &wire) const noexcept
|
||||||
noexcept
|
|
||||||
{
|
{
|
||||||
return hash<int>()(wire.index);
|
return hash<int>()(wire.index);
|
||||||
}
|
}
|
||||||
@ -301,11 +292,7 @@ template <> struct hash<NEXTPNR_NAMESPACE_PREFIX WireId>
|
|||||||
|
|
||||||
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX PipId>
|
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX PipId>
|
||||||
{
|
{
|
||||||
std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX PipId &pip) const
|
std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX PipId &pip) const noexcept { return hash<int>()(pip.index); }
|
||||||
noexcept
|
|
||||||
{
|
|
||||||
return hash<int>()(pip.index);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX BelType> : hash<int>
|
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX BelType> : hash<int>
|
||||||
@ -337,15 +324,9 @@ struct BelIterator
|
|||||||
return prior;
|
return prior;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const BelIterator &other) const
|
bool operator!=(const BelIterator &other) const { return cursor != other.cursor; }
|
||||||
{
|
|
||||||
return cursor != other.cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const BelIterator &other) const
|
bool operator==(const BelIterator &other) const { return cursor == other.cursor; }
|
||||||
{
|
|
||||||
return cursor == other.cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
BelId operator*() const
|
BelId operator*() const
|
||||||
{
|
{
|
||||||
@ -369,10 +350,7 @@ struct BelPinIterator
|
|||||||
const BelPortPOD *ptr = nullptr;
|
const BelPortPOD *ptr = nullptr;
|
||||||
|
|
||||||
void operator++() { ptr++; }
|
void operator++() { ptr++; }
|
||||||
bool operator!=(const BelPinIterator &other) const
|
bool operator!=(const BelPinIterator &other) const { return ptr != other.ptr; }
|
||||||
{
|
|
||||||
return ptr != other.ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
BelPin operator*() const
|
BelPin operator*() const
|
||||||
{
|
{
|
||||||
@ -397,10 +375,7 @@ struct WireIterator
|
|||||||
int cursor = -1;
|
int cursor = -1;
|
||||||
|
|
||||||
void operator++() { cursor++; }
|
void operator++() { cursor++; }
|
||||||
bool operator!=(const WireIterator &other) const
|
bool operator!=(const WireIterator &other) const { return cursor != other.cursor; }
|
||||||
{
|
|
||||||
return cursor != other.cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
WireId operator*() const
|
WireId operator*() const
|
||||||
{
|
{
|
||||||
@ -424,10 +399,7 @@ struct AllPipIterator
|
|||||||
int cursor = -1;
|
int cursor = -1;
|
||||||
|
|
||||||
void operator++() { cursor++; }
|
void operator++() { cursor++; }
|
||||||
bool operator!=(const AllPipIterator &other) const
|
bool operator!=(const AllPipIterator &other) const { return cursor != other.cursor; }
|
||||||
{
|
|
||||||
return cursor != other.cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
PipId operator*() const
|
PipId operator*() const
|
||||||
{
|
{
|
||||||
@ -451,10 +423,7 @@ struct PipIterator
|
|||||||
const int *cursor = nullptr;
|
const int *cursor = nullptr;
|
||||||
|
|
||||||
void operator++() { cursor++; }
|
void operator++() { cursor++; }
|
||||||
bool operator!=(const PipIterator &other) const
|
bool operator!=(const PipIterator &other) const { return cursor != other.cursor; }
|
||||||
{
|
|
||||||
return cursor != other.cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
PipId operator*() const
|
PipId operator*() const
|
||||||
{
|
{
|
||||||
@ -607,8 +576,7 @@ struct Arch : BaseCtx
|
|||||||
assert(wire != WireId());
|
assert(wire != WireId());
|
||||||
|
|
||||||
if (chip_info->wire_data[wire.index].bel_uphill.bel_index >= 0) {
|
if (chip_info->wire_data[wire.index].bel_uphill.bel_index >= 0) {
|
||||||
ret.bel.index =
|
ret.bel.index = chip_info->wire_data[wire.index].bel_uphill.bel_index;
|
||||||
chip_info->wire_data[wire.index].bel_uphill.bel_index;
|
|
||||||
ret.pin = chip_info->wire_data[wire.index].bel_uphill.port;
|
ret.pin = chip_info->wire_data[wire.index].bel_uphill.port;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,8 +588,7 @@ struct Arch : BaseCtx
|
|||||||
BelPinRange range;
|
BelPinRange range;
|
||||||
assert(wire != WireId());
|
assert(wire != WireId());
|
||||||
range.b.ptr = chip_info->wire_data[wire.index].bels_downhill.get();
|
range.b.ptr = chip_info->wire_data[wire.index].bels_downhill.get();
|
||||||
range.e.ptr = range.b.ptr +
|
range.e.ptr = range.b.ptr + chip_info->wire_data[wire.index].num_bels_downhill;
|
||||||
chip_info->wire_data[wire.index].num_bels_downhill;
|
|
||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -691,8 +658,7 @@ struct Arch : BaseCtx
|
|||||||
{
|
{
|
||||||
assert(pip != PipId());
|
assert(pip != PipId());
|
||||||
assert(pip_to_net[pip.index] == IdString());
|
assert(pip_to_net[pip.index] == IdString());
|
||||||
assert(switches_locked[chip_info->pip_data[pip.index].switch_index] ==
|
assert(switches_locked[chip_info->pip_data[pip.index].switch_index] == IdString());
|
||||||
IdString());
|
|
||||||
|
|
||||||
pip_to_net[pip.index] = net;
|
pip_to_net[pip.index] = net;
|
||||||
switches_locked[chip_info->pip_data[pip.index].switch_index] = net;
|
switches_locked[chip_info->pip_data[pip.index].switch_index] = net;
|
||||||
@ -709,8 +675,7 @@ struct Arch : BaseCtx
|
|||||||
{
|
{
|
||||||
assert(pip != PipId());
|
assert(pip != PipId());
|
||||||
assert(pip_to_net[pip.index] != IdString());
|
assert(pip_to_net[pip.index] != IdString());
|
||||||
assert(switches_locked[chip_info->pip_data[pip.index].switch_index] !=
|
assert(switches_locked[chip_info->pip_data[pip.index].switch_index] != IdString());
|
||||||
IdString());
|
|
||||||
|
|
||||||
WireId dst;
|
WireId dst;
|
||||||
dst.index = chip_info->pip_data[pip.index].dst;
|
dst.index = chip_info->pip_data[pip.index].dst;
|
||||||
@ -719,15 +684,13 @@ struct Arch : BaseCtx
|
|||||||
nets[pip_to_net[pip.index]]->wires.erase(dst);
|
nets[pip_to_net[pip.index]]->wires.erase(dst);
|
||||||
|
|
||||||
pip_to_net[pip.index] = IdString();
|
pip_to_net[pip.index] = IdString();
|
||||||
switches_locked[chip_info->pip_data[pip.index].switch_index] =
|
switches_locked[chip_info->pip_data[pip.index].switch_index] = IdString();
|
||||||
IdString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checkPipAvail(PipId pip) const
|
bool checkPipAvail(PipId pip) const
|
||||||
{
|
{
|
||||||
assert(pip != PipId());
|
assert(pip != PipId());
|
||||||
return switches_locked[chip_info->pip_data[pip.index].switch_index] ==
|
return switches_locked[chip_info->pip_data[pip.index].switch_index] == IdString();
|
||||||
IdString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IdString getBoundPipNet(PipId pip) const
|
IdString getBoundPipNet(PipId pip) const
|
||||||
@ -779,8 +742,7 @@ struct Arch : BaseCtx
|
|||||||
PipRange range;
|
PipRange range;
|
||||||
assert(wire != WireId());
|
assert(wire != WireId());
|
||||||
range.b.cursor = chip_info->wire_data[wire.index].pips_downhill.get();
|
range.b.cursor = chip_info->wire_data[wire.index].pips_downhill.get();
|
||||||
range.e.cursor =
|
range.e.cursor = range.b.cursor + chip_info->wire_data[wire.index].num_downhill;
|
||||||
range.b.cursor + chip_info->wire_data[wire.index].num_downhill;
|
|
||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -789,8 +751,7 @@ struct Arch : BaseCtx
|
|||||||
PipRange range;
|
PipRange range;
|
||||||
assert(wire != WireId());
|
assert(wire != WireId());
|
||||||
range.b.cursor = chip_info->wire_data[wire.index].pips_uphill.get();
|
range.b.cursor = chip_info->wire_data[wire.index].pips_uphill.get();
|
||||||
range.e.cursor =
|
range.e.cursor = range.b.cursor + chip_info->wire_data[wire.index].num_uphill;
|
||||||
range.b.cursor + chip_info->wire_data[wire.index].num_uphill;
|
|
||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -832,8 +793,7 @@ struct Arch : BaseCtx
|
|||||||
|
|
||||||
// Get the delay through a cell from one port to another, returning false
|
// Get the delay through a cell from one port to another, returning false
|
||||||
// if no path exists
|
// if no path exists
|
||||||
bool getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort,
|
bool getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, delay_t &delay) const;
|
||||||
delay_t &delay) const;
|
|
||||||
// Get the associated clock to a port, or empty if the port is combinational
|
// Get the associated clock to a port, or empty if the port is combinational
|
||||||
IdString getPortClock(const CellInfo *cell, IdString port) const;
|
IdString getPortClock(const CellInfo *cell, IdString port) const;
|
||||||
// Return true if a port is a clock
|
// Return true if a port is a clock
|
||||||
|
@ -52,17 +52,14 @@ void svg_dump_el(const GraphicElement &el)
|
|||||||
std::string style = "stroke=\"black\" stroke-width=\"0.1\" fill=\"none\"";
|
std::string style = "stroke=\"black\" stroke-width=\"0.1\" fill=\"none\"";
|
||||||
|
|
||||||
if (el.type == GraphicElement::G_BOX) {
|
if (el.type == GraphicElement::G_BOX) {
|
||||||
std::cout << "<rect x=\"" << (offset + scale * el.x1) << "\" y=\""
|
std::cout << "<rect x=\"" << (offset + scale * el.x1) << "\" y=\"" << (offset + scale * el.y1) << "\" height=\""
|
||||||
<< (offset + scale * el.y1) << "\" height=\""
|
<< (scale * (el.y2 - el.y1)) << "\" width=\"" << (scale * (el.x2 - el.x1)) << "\" " << style
|
||||||
<< (scale * (el.y2 - el.y1)) << "\" width=\""
|
<< "/>\n";
|
||||||
<< (scale * (el.x2 - el.x1)) << "\" " << style << "/>\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (el.type == GraphicElement::G_LINE) {
|
if (el.type == GraphicElement::G_LINE) {
|
||||||
std::cout << "<line x1=\"" << (offset + scale * el.x1) << "\" y1=\""
|
std::cout << "<line x1=\"" << (offset + scale * el.x1) << "\" y1=\"" << (offset + scale * el.y1) << "\" x2=\""
|
||||||
<< (offset + scale * el.y1) << "\" x2=\""
|
<< (offset + scale * el.x2) << "\" y2=\"" << (offset + scale * el.y2) << "\" " << style << "/>\n";
|
||||||
<< (offset + scale * el.x2) << "\" y2=\""
|
|
||||||
<< (offset + scale * el.y2) << "\" " << style << "/>\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,23 +81,17 @@ int main(int argc, char *argv[])
|
|||||||
options.add_options()("gui", "start gui");
|
options.add_options()("gui", "start gui");
|
||||||
#endif
|
#endif
|
||||||
options.add_options()("svg", "dump SVG file");
|
options.add_options()("svg", "dump SVG file");
|
||||||
options.add_options()("pack-only",
|
options.add_options()("pack-only", "pack design only without placement or routing");
|
||||||
"pack design only without placement or routing");
|
|
||||||
|
|
||||||
po::positional_options_description pos;
|
po::positional_options_description pos;
|
||||||
#ifndef NO_PYTHON
|
#ifndef NO_PYTHON
|
||||||
options.add_options()("run", po::value<std::vector<std::string>>(),
|
options.add_options()("run", po::value<std::vector<std::string>>(), "python file to execute");
|
||||||
"python file to execute");
|
|
||||||
pos.add("run", -1);
|
pos.add("run", -1);
|
||||||
#endif
|
#endif
|
||||||
options.add_options()("json", po::value<std::string>(),
|
options.add_options()("json", po::value<std::string>(), "JSON design file to ingest");
|
||||||
"JSON design file to ingest");
|
options.add_options()("pcf", po::value<std::string>(), "PCF constraints file to ingest");
|
||||||
options.add_options()("pcf", po::value<std::string>(),
|
options.add_options()("asc", po::value<std::string>(), "asc bitstream file to write");
|
||||||
"PCF constraints file to ingest");
|
options.add_options()("seed", po::value<int>(), "seed value for random number generator");
|
||||||
options.add_options()("asc", po::value<std::string>(),
|
|
||||||
"asc bitstream file to write");
|
|
||||||
options.add_options()("seed", po::value<int>(),
|
|
||||||
"seed value for random number generator");
|
|
||||||
options.add_options()("version,V", "show version");
|
options.add_options()("version,V", "show version");
|
||||||
options.add_options()("tmfuzz", "run path delay estimate fuzzer");
|
options.add_options()("tmfuzz", "run path delay estimate fuzzer");
|
||||||
options.add_options()("lp384", "set device type to iCE40LP384");
|
options.add_options()("lp384", "set device type to iCE40LP384");
|
||||||
@ -109,18 +100,13 @@ int main(int argc, char *argv[])
|
|||||||
options.add_options()("hx1k", "set device type to iCE40HX1K");
|
options.add_options()("hx1k", "set device type to iCE40HX1K");
|
||||||
options.add_options()("hx8k", "set device type to iCE40HX8K");
|
options.add_options()("hx8k", "set device type to iCE40HX8K");
|
||||||
options.add_options()("up5k", "set device type to iCE40UP5K");
|
options.add_options()("up5k", "set device type to iCE40UP5K");
|
||||||
options.add_options()("freq", po::value<double>(),
|
options.add_options()("freq", po::value<double>(), "set target frequency for design in MHz");
|
||||||
"set target frequency for design in MHz");
|
|
||||||
options.add_options()("no-tmdriv", "disable timing-driven placement");
|
options.add_options()("no-tmdriv", "disable timing-driven placement");
|
||||||
options.add_options()("package", po::value<std::string>(),
|
options.add_options()("package", po::value<std::string>(), "set device package");
|
||||||
"set device package");
|
|
||||||
|
|
||||||
po::variables_map vm;
|
po::variables_map vm;
|
||||||
try {
|
try {
|
||||||
po::parsed_options parsed = po::command_line_parser(argc, argv)
|
po::parsed_options parsed = po::command_line_parser(argc, argv).options(options).positional(pos).run();
|
||||||
.options(options)
|
|
||||||
.positional(pos)
|
|
||||||
.run();
|
|
||||||
|
|
||||||
po::store(parsed, vm);
|
po::store(parsed, vm);
|
||||||
|
|
||||||
@ -134,8 +120,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (vm.count("help") || argc == 1) {
|
if (vm.count("help") || argc == 1) {
|
||||||
help:
|
help:
|
||||||
std::cout << boost::filesystem::basename(argv[0])
|
std::cout << boost::filesystem::basename(argv[0]) << " -- Next Generation Place and Route (git "
|
||||||
<< " -- Next Generation Place and Route (git "
|
|
||||||
"sha1 " GIT_COMMIT_HASH_STR ")\n";
|
"sha1 " GIT_COMMIT_HASH_STR ")\n";
|
||||||
std::cout << "\n";
|
std::cout << "\n";
|
||||||
std::cout << options << "\n";
|
std::cout << options << "\n";
|
||||||
@ -143,8 +128,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vm.count("version")) {
|
if (vm.count("version")) {
|
||||||
std::cout << boost::filesystem::basename(argv[0])
|
std::cout << boost::filesystem::basename(argv[0]) << " -- Next Generation Place and Route (git "
|
||||||
<< " -- Next Generation Place and Route (git "
|
|
||||||
"sha1 " GIT_COMMIT_HASH_STR ")\n";
|
"sha1 " GIT_COMMIT_HASH_STR ")\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -237,8 +221,7 @@ int main(int argc, char *argv[])
|
|||||||
std::cout << "<svg xmlns=\"http://www.w3.org/2000/svg\" "
|
std::cout << "<svg xmlns=\"http://www.w3.org/2000/svg\" "
|
||||||
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n";
|
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n";
|
||||||
for (auto bel : ctx.getBels()) {
|
for (auto bel : ctx.getBels()) {
|
||||||
std::cout << "<!-- " << ctx.getBelName(bel).str(&ctx)
|
std::cout << "<!-- " << ctx.getBelName(bel).str(&ctx) << " -->\n";
|
||||||
<< " -->\n";
|
|
||||||
for (auto &el : ctx.getBelGraphics(bel))
|
for (auto &el : ctx.getBelGraphics(bel))
|
||||||
svg_dump_el(el);
|
svg_dump_el(el);
|
||||||
}
|
}
|
||||||
@ -273,30 +256,23 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (ctx.getBelType(b) == TYPE_SB_IO) {
|
if (ctx.getBelType(b) == TYPE_SB_IO) {
|
||||||
dst_wires.push_back(ctx.getWireBelPin(b, PIN_D_OUT_0));
|
dst_wires.push_back(ctx.getWireBelPin(b, PIN_D_OUT_0));
|
||||||
dst_wires.push_back(
|
dst_wires.push_back(ctx.getWireBelPin(b, PIN_OUTPUT_ENABLE));
|
||||||
ctx.getWireBelPin(b, PIN_OUTPUT_ENABLE));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.shuffle(src_wires);
|
ctx.shuffle(src_wires);
|
||||||
ctx.shuffle(dst_wires);
|
ctx.shuffle(dst_wires);
|
||||||
|
|
||||||
for (int i = 0;
|
for (int i = 0; i < int(src_wires.size()) && i < int(dst_wires.size()); i++) {
|
||||||
i < int(src_wires.size()) && i < int(dst_wires.size()); i++) {
|
|
||||||
delay_t actual_delay;
|
delay_t actual_delay;
|
||||||
WireId src = src_wires[i], dst = dst_wires[i];
|
WireId src = src_wires[i], dst = dst_wires[i];
|
||||||
if (!get_actual_route_delay(&ctx, src, dst, actual_delay))
|
if (!get_actual_route_delay(&ctx, src, dst, actual_delay))
|
||||||
continue;
|
continue;
|
||||||
printf("%s %s %.3f %.3f %d %d %d %d %d %d\n",
|
printf("%s %s %.3f %.3f %d %d %d %d %d %d\n", ctx.getWireName(src).c_str(&ctx),
|
||||||
ctx.getWireName(src).c_str(&ctx),
|
ctx.getWireName(dst).c_str(&ctx), ctx.getDelayNS(actual_delay),
|
||||||
ctx.getWireName(dst).c_str(&ctx),
|
ctx.getDelayNS(ctx.estimateDelay(src, dst)), ctx.chip_info->wire_data[src.index].x,
|
||||||
ctx.getDelayNS(actual_delay),
|
ctx.chip_info->wire_data[src.index].y, ctx.chip_info->wire_data[src.index].type,
|
||||||
ctx.getDelayNS(ctx.estimateDelay(src, dst)),
|
ctx.chip_info->wire_data[dst.index].x, ctx.chip_info->wire_data[dst.index].y,
|
||||||
ctx.chip_info->wire_data[src.index].x,
|
|
||||||
ctx.chip_info->wire_data[src.index].y,
|
|
||||||
ctx.chip_info->wire_data[src.index].type,
|
|
||||||
ctx.chip_info->wire_data[dst.index].x,
|
|
||||||
ctx.chip_info->wire_data[dst.index].y,
|
|
||||||
ctx.chip_info->wire_data[dst.index].type);
|
ctx.chip_info->wire_data[dst.index].type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -339,8 +315,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#ifndef NO_PYTHON
|
#ifndef NO_PYTHON
|
||||||
if (vm.count("run")) {
|
if (vm.count("run")) {
|
||||||
std::vector<std::string> files =
|
std::vector<std::string> files = vm["run"].as<std::vector<std::string>>();
|
||||||
vm["run"].as<std::vector<std::string>>();
|
|
||||||
for (auto filename : files)
|
for (auto filename : files)
|
||||||
execute_python_file(filename.c_str());
|
execute_python_file(filename.c_str());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user