Improve log messages, move many messages to verbose mode

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2018-06-21 14:09:50 +02:00
parent 693c34ad06
commit 993f6ef7d3
7 changed files with 36 additions and 48 deletions

View File

@ -64,11 +64,13 @@ void print_utilisation(const Context *ctx)
for (auto bel : ctx->getBels()) { for (auto bel : ctx->getBels()) {
available_types[ctx->getBelType(bel)]++; available_types[ctx->getBelType(bel)]++;
} }
log("\nDesign utilisation:\n"); log_break();
log_info("Device utilisation:\n");
for (auto type : available_types) { for (auto type : available_types) {
log("\t%20s: %5d/%5d\n", ctx->belTypeToId(type.first).c_str(ctx), log_info("\t%20s: %5d/%5d\n", ctx->belTypeToId(type.first).c_str(ctx),
get_or_default(used_types, type.first, 0), type.second); get_or_default(used_types, type.first, 0), type.second);
} }
log_break();
} }
NEXTPNR_NAMESPACE_END NEXTPNR_NAMESPACE_END

View File

@ -212,7 +212,7 @@ void log_cmd_error(const char *format, ...)
logv_error(format, ap); logv_error(format, ap);
} }
void log_spacer() void log_break()
{ {
if (log_newline_count < 2) if (log_newline_count < 2)
log("\n"); log("\n");
@ -220,12 +220,6 @@ void log_spacer()
log("\n"); log("\n");
} }
void log_push() {}
void log_pop() { log_flush(); }
void log_reset_stack() { log_flush(); }
void log_flush() void log_flush()
{ {
for (auto f : log_files) for (auto f : log_files)
@ -235,8 +229,4 @@ void log_flush()
f->flush(); f->flush();
} }
void log_cell(CellInfo *cell, std::string indent) {}
void log_net(NetInfo *net, std::string indent) {}
NEXTPNR_NAMESPACE_END NEXTPNR_NAMESPACE_END

View File

@ -71,25 +71,9 @@ NXP_NORETURN void log_error(const char *format, ...)
NXP_NORETURN void log_cmd_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);
void log_spacer(); void log_break();
void log_push();
void log_pop();
void log_backtrace(const char *prefix, int levels);
void log_reset_stack();
void log_flush(); void log_flush();
/*
const char *log_id(RTLIL::IdString id);
template<typename T> static inline const char *log_id(T *obj) {
return log_id(obj->name);
}
*/
void log_cell(CellInfo *cell, std::string indent = "");
void log_net(NetInfo *net, std::string indent = "");
#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)

View File

@ -77,6 +77,8 @@ class SAPlacer
bool place() bool place()
{ {
log_break();
size_t placed_cells = 0; size_t placed_cells = 0;
// Initial constraints placer // Initial constraints placer
for (auto cell_entry : ctx->cells) { for (auto cell_entry : ctx->cells) {
@ -408,9 +410,9 @@ class SAPlacer
delta = new_wirelength - curr_wirelength; delta = new_wirelength - curr_wirelength;
n_move++; n_move++;
// SA acceptance criterea // SA acceptance criterea
if (delta < 0 || if (delta < 0 || (temp > 1e-6 &&
(temp > 1e-6 && (ctx->rng() / float(0x3fffffff)) <= (ctx->rng() / float(0x3fffffff)) <=
std::exp(-(delta / 2) / temp))) { std::exp(-(delta / 2) / temp))) {
n_accept++; n_accept++;
if (delta < 2) if (delta < 2)
improved = true; improved = true;

View File

@ -406,6 +406,7 @@ bool route_design(Context *ctx)
delay_t ripup_penalty = ctx->getRipupDelayPenalty(); delay_t ripup_penalty = ctx->getRipupDelayPenalty();
RipupScoreboard scores; RipupScoreboard scores;
log_break();
log_info("Routing..\n"); log_info("Routing..\n");
std::unordered_set<IdString> netsQueue; std::unordered_set<IdString> netsQueue;

View File

@ -659,7 +659,8 @@ static void insert_iobuf(Context *ctx, NetInfo *net, PortType type,
std::copy(net->attrs.begin(), net->attrs.end(), std::copy(net->attrs.begin(), net->attrs.end(),
std::inserter(iobuf->attrs, iobuf->attrs.begin())); std::inserter(iobuf->attrs, iobuf->attrs.begin()));
if (type == PORT_IN) { if (type == PORT_IN) {
log_info("processing input port %s\n", name.c_str()); if (ctx->verbose)
log_info("processing input port %s\n", name.c_str());
iobuf->type = ctx->id("$nextpnr_ibuf"); iobuf->type = ctx->id("$nextpnr_ibuf");
iobuf->ports[ctx->id("O")] = PortInfo{ctx->id("O"), net, PORT_OUT}; iobuf->ports[ctx->id("O")] = PortInfo{ctx->id("O"), net, PORT_OUT};
// Special case: input, etc, directly drives inout // Special case: input, etc, directly drives inout
@ -671,7 +672,8 @@ static void insert_iobuf(Context *ctx, NetInfo *net, PortType type,
net->driver.port = ctx->id("O"); net->driver.port = ctx->id("O");
net->driver.cell = iobuf; net->driver.cell = iobuf;
} else if (type == PORT_OUT) { } else if (type == PORT_OUT) {
log_info("processing output port %s\n", name.c_str()); if (ctx->verbose)
log_info("processing output port %s\n", name.c_str());
iobuf->type = ctx->id("$nextpnr_obuf"); iobuf->type = ctx->id("$nextpnr_obuf");
iobuf->ports[ctx->id("I")] = PortInfo{ctx->id("I"), net, PORT_IN}; iobuf->ports[ctx->id("I")] = PortInfo{ctx->id("I"), net, PORT_IN};
PortRef ref; PortRef ref;
@ -679,7 +681,8 @@ static void insert_iobuf(Context *ctx, NetInfo *net, PortType type,
ref.port = ctx->id("I"); ref.port = ctx->id("I");
net->users.push_back(ref); net->users.push_back(ref);
} else if (type == PORT_INOUT) { } else if (type == PORT_INOUT) {
log_info("processing inout port %s\n", name.c_str()); if (ctx->verbose)
log_info("processing inout port %s\n", name.c_str());
iobuf->type = ctx->id("$nextpnr_iobuf"); iobuf->type = ctx->id("$nextpnr_iobuf");
iobuf->ports[ctx->id("I")] = PortInfo{ctx->id("I"), nullptr, PORT_IN}; iobuf->ports[ctx->id("I")] = PortInfo{ctx->id("I"), nullptr, PORT_IN};

View File

@ -36,8 +36,9 @@ static void pack_lut_lutffs(Context *ctx)
std::vector<CellInfo *> new_cells; std::vector<CellInfo *> new_cells;
for (auto cell : ctx->cells) { for (auto cell : ctx->cells) {
CellInfo *ci = cell.second; CellInfo *ci = cell.second;
log_info("cell '%s' is of type '%s'\n", ci->name.c_str(ctx), if (ctx->verbose)
ci->type.c_str(ctx)); log_info("cell '%s' is of type '%s'\n", ci->name.c_str(ctx),
ci->type.c_str(ctx));
if (is_lut(ctx, ci)) { if (is_lut(ctx, ci)) {
CellInfo *packed = create_ice_cell(ctx, "ICESTORM_LC", CellInfo *packed = create_ice_cell(ctx, "ICESTORM_LC",
ci->name.str(ctx) + "_LC"); ci->name.str(ctx) + "_LC");
@ -45,8 +46,9 @@ static void pack_lut_lutffs(Context *ctx)
std::inserter(packed->attrs, packed->attrs.begin())); std::inserter(packed->attrs, packed->attrs.begin()));
packed_cells.insert(ci->name); packed_cells.insert(ci->name);
new_cells.push_back(packed); new_cells.push_back(packed);
log_info("packed cell %s into %s\n", ci->name.c_str(ctx), if (ctx->verbose)
packed->name.c_str(ctx)); log_info("packed cell %s into %s\n", ci->name.c_str(ctx),
packed->name.c_str(ctx));
// See if we can pack into a DFF // See if we can pack into a DFF
// TODO: LUT cascade // TODO: LUT cascade
NetInfo *o = ci->ports.at(ctx->id("O")).net; NetInfo *o = ci->ports.at(ctx->id("O")).net;
@ -54,7 +56,8 @@ static void pack_lut_lutffs(Context *ctx)
auto lut_bel = ci->attrs.find(ctx->id("BEL")); auto lut_bel = ci->attrs.find(ctx->id("BEL"));
bool packed_dff = false; bool packed_dff = false;
if (dff) { if (dff) {
log_info("found attached dff %s\n", dff->name.c_str(ctx)); if (ctx->verbose)
log_info("found attached dff %s\n", dff->name.c_str(ctx));
auto dff_bel = dff->attrs.find(ctx->id("BEL")); auto dff_bel = dff->attrs.find(ctx->id("BEL"));
if (lut_bel != ci->attrs.end() && dff_bel != dff->attrs.end() && if (lut_bel != ci->attrs.end() && dff_bel != dff->attrs.end() &&
lut_bel->second != dff_bel->second) { lut_bel->second != dff_bel->second) {
@ -66,8 +69,9 @@ static void pack_lut_lutffs(Context *ctx)
if (dff_bel != dff->attrs.end()) if (dff_bel != dff->attrs.end())
packed->attrs[ctx->id("BEL")] = dff_bel->second; packed->attrs[ctx->id("BEL")] = dff_bel->second;
packed_cells.insert(dff->name); packed_cells.insert(dff->name);
log_info("packed cell %s into %s\n", dff->name.c_str(ctx), if (ctx->verbose)
packed->name.c_str(ctx)); log_info("packed cell %s into %s\n",
dff->name.c_str(ctx), packed->name.c_str(ctx));
packed_dff = true; packed_dff = true;
} }
} }
@ -99,8 +103,9 @@ static void pack_nonlut_ffs(Context *ctx)
ci->name.str(ctx) + "_DFFLC"); ci->name.str(ctx) + "_DFFLC");
std::copy(ci->attrs.begin(), ci->attrs.end(), std::copy(ci->attrs.begin(), ci->attrs.end(),
std::inserter(packed->attrs, packed->attrs.begin())); std::inserter(packed->attrs, packed->attrs.begin()));
log_info("packed cell %s into %s\n", ci->name.c_str(ctx), if (ctx->verbose)
packed->name.c_str(ctx)); log_info("packed cell %s into %s\n", ci->name.c_str(ctx),
packed->name.c_str(ctx));
packed_cells.insert(ci->name); packed_cells.insert(ci->name);
new_cells.push_back(packed); new_cells.push_back(packed);
dff_to_lc(ctx, ci, packed, true); dff_to_lc(ctx, ci, packed, true);
@ -242,8 +247,9 @@ static void set_net_constant(const Context *ctx, NetInfo *orig,
for (auto user : orig->users) { for (auto user : orig->users) {
if (user.cell != nullptr) { if (user.cell != nullptr) {
CellInfo *uc = user.cell; CellInfo *uc = user.cell;
log_info("%s user %s\n", orig->name.c_str(ctx), if (ctx->verbose)
uc->name.c_str(ctx)); log_info("%s user %s\n", orig->name.c_str(ctx),
uc->name.c_str(ctx));
if ((is_lut(ctx, uc) || is_lc(ctx, uc)) && if ((is_lut(ctx, uc) || is_lc(ctx, uc)) &&
(user.port.str(ctx).at(0) == 'I') && !constval) { (user.port.str(ctx).at(0) == 'I') && !constval) {
uc->ports[user.port].net = nullptr; uc->ports[user.port].net = nullptr;