Skip to content

Commit f9acae8

Browse files
authored
Merge pull request #831 from os-fpga/checker_improved_report_and_stats
checker: improved report and stats
2 parents 209ac8d + 9828b8d commit f9acae8

File tree

4 files changed

+47
-4
lines changed

4 files changed

+47
-4
lines changed

planning/src/RS/rsCheck.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ bool do_check_blif(CStr cfn) {
6969
ls << "----- #outputs= " << numOut << endl;
7070
ls << "----- #LUTs= " << bfile.countLUTs() << endl;
7171
ls << "----- #FFs= " << bfile.countFFs() << endl;
72-
ls << "----- #CLK_BUFs= " << bfile.countCBUFs() << endl;
72+
uint nIBUF = 0, nOBUF = 0, nCBUF = 0;
73+
bfile.countBUFs(nIBUF, nOBUF, nCBUF);
74+
ls << "----- #I_BUFs= " << nIBUF << endl;
75+
ls << "----- #O_BUFs= " << nOBUF << endl;
76+
ls << "----- #CLK_BUFs= " << nCBUF << endl;
77+
ls << "----- #I_SERDES= " << bfile.typeHist(prim::I_SERDES) << endl;
7378
ls << "----- PinGraph: " << bfile.pinGraphFile_ << endl;
7479
if (bfile.num_MOGs_ and tr >= 5) {
7580
ls << ">>>>> [NOTE] num_MOGs_ = " << bfile.num_MOGs_ << endl;

planning/src/file_io/pln_blif_file.cpp

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ void BLIF_file::reset(CStr nm, uint16_t tr) noexcept {
2525
err_msg_.clear();
2626
pg_.clear();
2727
pg2blif_.clear();
28+
29+
for (uint t = 0; t < Prim_MAX_ID; t++)
30+
typeHistogram_[t] = 0;
2831
}
2932

3033
// "model "
@@ -186,6 +189,9 @@ bool BLIF_file::readBlif() noexcept {
186189
topModel_.clear();
187190
pinGraphFile_.clear();
188191

192+
for (uint t = 0; t < prim::Prim_MAX_ID; t++)
193+
typeHistogram_[t] = 0;
194+
189195
rd_ok_ = chk_ok_ = false;
190196
err_msg_.clear();
191197
trace_ = 0;
@@ -370,6 +376,8 @@ bool BLIF_file::checkBlif() noexcept {
370376
// 4. create and link nodes
371377
createNodes();
372378

379+
typeHistogram_ = countTypes();
380+
373381
if (trace_ >= 4) {
374382
printPrimitives(ls, false);
375383
if (trace_ >= 5) {
@@ -709,6 +717,28 @@ uint BLIF_file::countCBUFs() const noexcept {
709717
return cnt;
710718
}
711719

720+
void BLIF_file::countBUFs(uint& nIBUF, uint& nOBUF, uint& nCBUF) const noexcept {
721+
nIBUF = nOBUF = nCBUF = 0;
722+
uint nn = numNodes();
723+
if (nn == 0)
724+
return;
725+
726+
for (uint i = 1; i <= nn; i++) {
727+
const BNode& nd = nodePool_[i];
728+
if (nd.is_IBUF()) {
729+
nIBUF++;
730+
continue;
731+
}
732+
if (nd.is_OBUF()) {
733+
nOBUF++;
734+
continue;
735+
}
736+
if (nd.is_CLK_BUF()) {
737+
nCBUF++;
738+
}
739+
}
740+
}
741+
712742
uint BLIF_file::countCarryNodes() const noexcept {
713743
uint nn = numNodes();
714744
if (nn == 0)
@@ -1999,6 +2029,7 @@ bool BLIF_file::createPinGraph() noexcept {
19992029
flush_out(true); err_puts();
20002030
lprintf2("[Error] no driver for clock-buf node #%u %s line:%u\n",
20012031
dn.id_, dn.cPrimType(), dn.lnum_);
2032+
err_lnum_ = dn.lnum_;
20022033
err_puts(); flush_out(true);
20032034
return false;
20042035
}
@@ -2012,9 +2043,11 @@ bool BLIF_file::createPinGraph() noexcept {
20122043

20132044
if (not drv_drv->is_CLK_BUF() and not drv_drv->isTopInput()) {
20142045
flush_out(true); err_puts();
2015-
lprintf2("[Error] bad drv_drv for clock-buf node #%u line:%u must be CLK_BUF or iport\n",
2016-
dn.id_, dn.lnum_);
2046+
lprintf2("[Error] bad driver (%s) for clock-buf node #%u line:%u must be CLK_BUF or iport\n",
2047+
drv_drv->cPrimType(), dn.id_, dn.lnum_);
20172048
err_puts(); flush_out(true);
2049+
err_lnum_ = dn.lnum_;
2050+
err_lnum2_ = drv_drv->lnum_;
20182051
return false;
20192052
}
20202053

planning/src/file_io/pln_blif_file.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ struct BLIF_file : public fio::MMapReader
234234
bool chk_ok_ = false;
235235
uint num_MOGs_ = 0;
236236

237+
std::array<uint, prim::Prim_MAX_ID> typeHistogram_;
238+
237239
public:
238240
BLIF_file() noexcept = default;
239241
BLIF_file(CStr nm) noexcept : fio::MMapReader(nm) {}
@@ -252,6 +254,9 @@ struct BLIF_file : public fio::MMapReader
252254
uint countLUTs() const noexcept;
253255
uint countFFs() const noexcept;
254256
uint countCBUFs() const noexcept;
257+
void countBUFs(uint& nIBUF, uint& nOBUF, uint& nCBUF) const noexcept;
258+
259+
uint typeHist(prim::Prim_t t) const noexcept { return typeHistogram_[t]; }
255260

256261
void collectClockedNodes(vector<const BNode*>& V) noexcept;
257262
std::array<uint, prim::Prim_MAX_ID> countTypes() const noexcept;

planning/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
static const char* _pln_VERSION_STR = "pln0332";
1+
static const char* _pln_VERSION_STR = "pln0333";
22

33
#include "RS/rsEnv.h"
44
#include "util/pln_log.h"

0 commit comments

Comments
 (0)