Skip to content

Commit 0329a36

Browse files
authored
Merge pull request #881 from os-fpga/pinc_checker_add_bad_port_API_E3293
pinc_checker: add bad port API EDA-3293
2 parents 964eec4 + 2683cda commit 0329a36

File tree

9 files changed

+40
-48
lines changed

9 files changed

+40
-48
lines changed

planning/src/RS/rsCheck.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@
44

55
namespace pln {
66

7+
using std::vector;
78
using std::string;
89
using std::endl;
910

10-
bool do_check_blif(CStr cfn) {
11+
bool do_check_blif(CStr cfn,
12+
vector<string>& badInputs,
13+
vector<string>& badOutputs) {
1114
assert(cfn);
1215
uint16_t tr = ltrace();
1316
auto& ls = lout();
17+
badInputs.clear();
18+
badOutputs.clear();
1419

1520
BLIF_file bfile(string{cfn});
1621

@@ -58,7 +63,7 @@ bool do_check_blif(CStr cfn) {
5863
flush_out(true);
5964
ls << ">>>>> checking BLIF " << cfn << " ..." << endl;
6065

61-
bool chk_ok = bfile.checkBlif();
66+
bool chk_ok = bfile.checkBlif(badInputs, badOutputs);
6267
assert(chk_ok == bfile.chk_ok_);
6368

6469
lprintf("===== passed: %s\n", chk_ok ? "YES" : "NO");
@@ -193,10 +198,12 @@ bool do_check(const rsOpts& opts, bool blif_vs_csv) {
193198
lprintf(" checking %s file: %s\n", fileType, cfn);
194199

195200
bool status;
196-
if (blif_vs_csv)
197-
status = do_check_blif(cfn);
198-
else
201+
if (blif_vs_csv) {
202+
vector<string> badInp, badOut;
203+
status = do_check_blif(cfn, badInp, badOut);
204+
} else {
199205
status = do_check_csv(cfn);
206+
}
200207

201208
flush_out(true);
202209

planning/src/RS/rsCheck.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ namespace pln {
99

1010
bool do_check(const rsOpts& opts, bool blif_vs_csv);
1111

12-
bool do_check_blif(CStr cfn);
12+
bool do_check_blif(CStr cfn,
13+
std::vector<std::string>& badInputs,
14+
std::vector<std::string>& badOutputs);
1315

1416
}
1517

planning/src/file_io/pln_blif_file.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,13 @@ bool BLIF_file::readBlif() noexcept {
343343
return true;
344344
}
345345

346-
bool BLIF_file::checkBlif() noexcept {
346+
bool BLIF_file::checkBlif(vector<string>& badInputs,
347+
vector<string>& badOutputs) noexcept {
347348
chk_ok_ = false;
348349
err_msg_.clear();
350+
badInputs.clear();
351+
badOutputs.clear();
352+
349353
auto& ls = lout();
350354

351355
if (inputs_.empty() and outputs_.empty()) {
@@ -499,8 +503,6 @@ bool BLIF_file::checkBlif() noexcept {
499503

500504
// -- write yaml file to check prim-DB:
501505
if (trace_ >= 8) {
502-
//string written = pr_write_yaml( DSP19X2 );
503-
//string written = pr_write_yaml( DSP38 );
504506
//string written = pr_write_yaml( FIFO36K );
505507
//string written = pr_write_yaml( FIFO18KX2 );
506508
string written = pr_write_yaml( TDP_RAM36K );
@@ -1329,8 +1331,8 @@ bool BLIF_file::createNodes() noexcept {
13291331
}
13301332
if (nd.kw_ == ".subckt" or nd.kw_ == ".gate") {
13311333
if (nd.data_.size() > 1) {
1332-
if (nd.lnum_ == 47)
1333-
lputs8();
1334+
// if (nd.lnum_ == 47)
1335+
// lputs8();
13341336
const string& last = nd.data_.back();
13351337
size_t llen = last.length();
13361338
if (!last.empty() and llen < 4095) {

planning/src/file_io/pln_blif_file.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ struct BLIF_file : public fio::MMapReader
266266
virtual void reset(CStr nm, uint16_t tr = 0) noexcept override;
267267

268268
bool readBlif() noexcept;
269-
bool checkBlif() noexcept;
269+
bool checkBlif(vector<string>& badInputs, vector<string>& badOutputs) noexcept;
270270

271271
uint numInputs() const noexcept { return inputs_.size(); }
272272
uint numOutputs() const noexcept { return outputs_.size(); }

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

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

planning/src/pin_loc/pcf_place.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ void PinPlacer::get_pcf_directions(
647647
}
648648
}
649649

650-
bool PinPlacer::write_dot_place(const PcCsvReader& csv) {
650+
bool PinPlacer::write_placement(const PcCsvReader& csv) {
651651
flush_out(true);
652652
placed_inputs_.clear();
653653
placed_outputs_.clear();
@@ -657,7 +657,7 @@ bool PinPlacer::write_dot_place(const PcCsvReader& csv) {
657657
if (tr >= 3) {
658658
ls << "pin_c: writing .place output file: " << out_fn << endl;
659659
if (tr >= 7) {
660-
ls << "write_dot_place() __ Creating .place file get_param(--output) : "
660+
ls << "write_placement() __ Creating .place file get_param(--output) : "
661661
<< out_fn << endl;
662662
}
663663
if (tr >= 5) {
@@ -686,7 +686,7 @@ bool PinPlacer::write_dot_place(const PcCsvReader& csv) {
686686
if (tr >= 1) {
687687
flush_out(true);
688688
err_puts();
689-
lprintf2("[Error] pin_c: write_dot_place() output file is not writable: %s\n",
689+
lprintf2("[Error] pin_c: write_placement() output file is not writable: %s\n",
690690
out_fn.c_str());
691691
flush_out(true);
692692
}

planning/src/pin_loc/pin_placer.cpp

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -240,35 +240,14 @@ bool PinPlacer::read_and_write() {
240240
!(csv_name.empty() || no_b_json || output_name.empty()) &&
241241
user_pcf_.empty();
242242

243-
if (tr >= 4) {
243+
if (tr >= 5) {
244244
ls << "\t usage_requirement_1 : " << boolalpha << usage_requirement_1 << endl;
245245
ls << "\t usage_requirement_2 : " << boolalpha << usage_requirement_2 << endl;
246246
}
247247

248248
if (usage_requirement_0) {
249-
/*
250-
// generate new csv file with information from xml
251-
// and csv for os flow
252-
if (tr >= 2) {
253-
ls << "(usage_requirement_0)\n"
254-
<< "generate new csv file with info from xml and csv for os flow"
255-
<< endl;
256-
}
257-
if (!generate_csv_file_for_os_flow()) {
258-
CERROR << err_lookup("GENERATE_CSV_FILE_FOR_OS_FLOW") << endl;
259-
return false;
260-
}
261-
// in os mode, the pcf does not contains any "-mode"
262-
// we need to generate a temp pcf file with "-mode" option, which selects
263-
// mode "Mode_GPIO"
264-
if (user_pcf_.size()) {
265-
if (!convert_pcf_for_os_flow(user_pcf_)) {
266-
CERROR << err_lookup("GENERATE_PCF_FILE_FOR_OS_FLOW") << endl;
267-
return false;
268-
}
269-
}
270-
*/
271-
} else if (!usage_requirement_1 && !usage_requirement_2) {
249+
}
250+
else if (!usage_requirement_1 && !usage_requirement_2) {
272251
flush_out(true);
273252
if (tr >= 2)
274253
lputs("[Error] pin_c: !usage_requirement_1 && !usage_requirement_2\n");
@@ -454,13 +433,13 @@ bool PinPlacer::read_and_write() {
454433
finalize_edits();
455434

456435
// --7. create .place file
457-
if (!write_dot_place(csv_rd)) {
436+
if (!write_placement(csv_rd)) {
458437
// error messages will be issued in callee
459438
if (tr) {
460439
flush_out(true);
461-
ls << "[Error] pin_c: !write_dot_place(csv_rd)" << endl;
440+
ls << "[Error] pin_c: !write_placement()" << endl;
462441
err_puts();
463-
CERROR << "write_dot_place() failed" << endl;
442+
CERROR << "write_placement() failed" << endl;
464443
flush_out(true);
465444
}
466445
return false;

planning/src/pin_loc/pin_placer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ struct PinPlacer {
242242

243243
bool read_PCF(const PcCsvReader&);
244244

245-
bool write_dot_place(const PcCsvReader&);
245+
bool write_placement(const PcCsvReader&);
246246

247247
bool create_temp_pcf(PcCsvReader&);
248248

planning/src/pin_loc/read_ports.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ using fio::Fio;
1414

1515
static bool s_is_fabric_blif(const string& fn) noexcept {
1616
size_t len = fn.length();
17-
if (len < 12 or len > 5000)
17+
if (len < 8 or len > 5000)
1818
return false;
1919
char buf[len + 2] = {};
2020
::strcpy(buf, fn.c_str());
@@ -29,7 +29,7 @@ static bool s_is_fabric_blif(const string& fn) noexcept {
2929
Fio::split_spa(buf, W);
3030
if (W.size() < 2)
3131
return false;
32-
if (W.back() != "eblif")
32+
if (W.back() != "eblif" and W.back() != "blif")
3333
return false;
3434

3535
const string& f = W[W.size() - 2];
@@ -1098,7 +1098,7 @@ bool PinPlacer::BlifReader::read_blif(const string& blif_fn, bool& checked_ok) n
10981098
BLIF_file bfile(blif_fn);
10991099

11001100
if (tr >= 4)
1101-
bfile.setTrace(3);
1101+
bfile.setTrace(4);
11021102

11031103
bool exi = false;
11041104
exi = bfile.fileExists();
@@ -1117,10 +1117,12 @@ bool PinPlacer::BlifReader::read_blif(const string& blif_fn, bool& checked_ok) n
11171117
return false;
11181118
}
11191119

1120+
vector<string> badInputs, badOutputs;
1121+
11201122
if (not ::getenv("pinc_dont_check_blif")) {
11211123
lprintf("____ BEGIN pinc_check_blif: %s\n", cfn);
11221124
flush_out(true);
1123-
checked_ok = do_check_blif(cfn);
1125+
checked_ok = do_check_blif(cfn, badInputs, badOutputs);
11241126
flush_out(true);
11251127
lprintf(" pinc_check_blif STATUS = %s\n\n",
11261128
checked_ok ? "PASS" : "FAIL");

0 commit comments

Comments
 (0)