diff options
author | David Shah <davey1576@gmail.com> | 2018-06-17 11:45:41 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-06-17 11:45:41 +0200 |
commit | 3afce5ff5a6adfa1baccb4f4625005300b9a3862 (patch) | |
tree | 6217511802c19514a1168a4e6412d1268ac07fb3 /common/design_utils.cc | |
parent | c604426341c75bc34b9d97ad5cd49cc28f9198fb (diff) | |
download | nextpnr-3afce5ff5a6adfa1baccb4f4625005300b9a3862.tar.gz nextpnr-3afce5ff5a6adfa1baccb4f4625005300b9a3862.tar.bz2 nextpnr-3afce5ff5a6adfa1baccb4f4625005300b9a3862.zip |
Improving the placer output
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'common/design_utils.cc')
-rw-r--r-- | common/design_utils.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/common/design_utils.cc b/common/design_utils.cc index 85895a75..c6504fb9 100644 --- a/common/design_utils.cc +++ b/common/design_utils.cc @@ -18,7 +18,9 @@ */ #include "design_utils.h" - +#include <map> +#include "log.h" +#include "util.h" NEXTPNR_NAMESPACE_BEGIN void replace_port(CellInfo *old_cell, IdString old_name, CellInfo *rep_cell, @@ -49,4 +51,23 @@ void replace_port(CellInfo *old_cell, IdString old_name, CellInfo *rep_cell, } } +// Print utilisation of a design +void print_utilisation(const Design *design) +{ + // Sort by Bel type + std::map<BelType, int> used_types; + for (auto cell : design->cells) { + used_types[belTypeFromId(cell.second->type)]++; + } + std::map<BelType, int> available_types; + for (auto bel : design->chip.getBels()) { + available_types[design->chip.getBelType(bel)]++; + } + log("\nDesign utilisation:\n"); + for (auto type : available_types) { + log("\t%20s: %5d/%5d\n", belTypeToId(type.first).c_str(), + get_or_default(used_types, type.first, 0), type.second); + } +} + NEXTPNR_NAMESPACE_END |