Skip to content

Commit e474416

Browse files
authored
Merge pull request #896 from os-fpga/checker_report_warnings_about_dangling
checker: report warnings about dangling RAM/DSP outputs
2 parents 7fddb02 + 548ee9b commit e474416

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

planning/src/RS/rsCheck.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ bool do_check_blif(CStr cfn,
110110
if (bfile.num_MOGs_ and tr >= 6) {
111111
ls << ">>>>> [NOTE] num_MOGs_ = " << bfile.num_MOGs_ << endl;
112112
}
113+
if (chk_ok) {
114+
uint numWarn = bfile.numWarnings();
115+
lprintf("===== has warnings: %s", numWarn ? "YES" : "NO");
116+
if (numWarn)
117+
lprintf(" # WARNINGS= %u", numWarn);
118+
lputs();
119+
}
113120
lprintf("===== passed: %s\n", chk_ok ? "YES" : "NO");
114121

115122
flush_out(true);
@@ -122,8 +129,8 @@ bool do_check_blif(CStr cfn,
122129
return true;
123130
}
124131

125-
ls << "[Error] !!! BLIF is not OK !!!" << endl;
126-
ls << "[Error] !!! " << bfile.err_msg_ << endl;
132+
ls << "[Error] ERROR BLIF is not OK ERROR" << endl;
133+
ls << "[Error] ERROR " << bfile.err_msg_ << endl;
127134

128135
flush_out(true);
129136
uint errLnum = std::max(bfile.err_lnum_, bfile.err_lnum2_);

planning/src/file_io/pln_blif_file.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ void BLIF_file::reset(CStr nm, uint16_t tr) noexcept {
1818
topOutputs_.clear();
1919
fabricNodes_.clear();
2020
fabricRealNodes_.clear();
21+
dang_RAM_outputs_.clear();
22+
dang_DSP_outputs_.clear();
2123
latches_.clear();
2224
constantNodes_.clear();
2325
rd_ok_ = chk_ok_ = false;
@@ -859,6 +861,12 @@ uint BLIF_file::countConstNodes() const noexcept {
859861
return cnt;
860862
}
861863

864+
uint BLIF_file::numWarnings() const noexcept {
865+
assert(dang_RAM_outputs_.size() < size_t(INT_MAX));
866+
assert(dang_DSP_outputs_.size() < size_t(INT_MAX));
867+
return dang_RAM_outputs_.size() + dang_DSP_outputs_.size();
868+
}
869+
862870
uint BLIF_file::printCarryNodes(std::ostream& os) const noexcept {
863871
uint nn = numNodes();
864872
if (!nn) {
@@ -1087,6 +1095,8 @@ bool BLIF_file::createNodes() noexcept {
10871095
topOutputs_.clear();
10881096
fabricNodes_.clear();
10891097
fabricRealNodes_.clear();
1098+
dang_RAM_outputs_.clear();
1099+
dang_DSP_outputs_.clear();
10901100
latches_.clear();
10911101
constantNodes_.clear();
10921102
if (!rd_ok_) return false;
@@ -1702,11 +1712,16 @@ bool BLIF_file::linkNodes() noexcept {
17021712
BNode* par = findFabricParent(nd.id_, nd.out_, pinIndex);
17031713
if (!par) {
17041714
if (nd.is_RAM() or nd.is_DSP()) {
1715+
bool is_ram = nd.is_RAM();
17051716
// RAM or DSP output bits may be unused
1706-
if (trace_ >= 6) {
1707-
lprintf("skipping dangling cell output issue for %s\n",
1708-
nd.is_RAM() ? "RAM" : "DSP" );
1717+
if (trace_ >= 5) {
1718+
lprintf("skipping dangling cell output issue for %s at line %u\n",
1719+
is_ram ? "RAM" : "DSP", nd.lnum_);
17091720
}
1721+
if (is_ram)
1722+
dang_RAM_outputs_.emplace_back(nd.id_);
1723+
else
1724+
dang_DSP_outputs_.emplace_back(nd.id_);
17101725
continue;
17111726
}
17121727
err_msg_ = "dangling cell output: ";

planning/src/file_io/pln_blif_file.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ struct BLIF_file : public fio::MMapReader
288288
uint countWireNodes() const noexcept;
289289
uint countConstNodes() const noexcept;
290290

291+
uint numWarnings() const noexcept;
292+
291293
uint printInputs(std::ostream& os, CStr spacer = nullptr) const noexcept;
292294
uint printOutputs(std::ostream& os, CStr spacer = nullptr) const noexcept;
293295
uint printNodes(std::ostream& os) const noexcept;
@@ -336,6 +338,9 @@ struct BLIF_file : public fio::MMapReader
336338
std::vector<BNode*> fabricNodes_, constantNodes_;
337339
std::vector<BNode*> fabricRealNodes_; // skip virtual SOGs
338340

341+
std::vector<uint> dang_RAM_outputs_;
342+
std::vector<uint> dang_DSP_outputs_;
343+
339344
std::vector<BNode*> latches_; // latches are not checked for now
340345

341346
std::unordered_map<uint, uint> pg2blif_; // map IDs from NW to BLIF_file::BNode::id_

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 = "pln0351";
1+
static const char* _pln_VERSION_STR = "pln0352";
22

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

0 commit comments

Comments
 (0)