diff --git a/planning/src/RS/rsCheck.cpp b/planning/src/RS/rsCheck.cpp index 68e55ecf..58e9b4d5 100644 --- a/planning/src/RS/rsCheck.cpp +++ b/planning/src/RS/rsCheck.cpp @@ -4,13 +4,18 @@ namespace pln { +using std::vector; using std::string; using std::endl; -bool do_check_blif(CStr cfn) { +bool do_check_blif(CStr cfn, + vector& badInputs, + vector& badOutputs) { assert(cfn); uint16_t tr = ltrace(); auto& ls = lout(); + badInputs.clear(); + badOutputs.clear(); BLIF_file bfile(string{cfn}); @@ -58,7 +63,7 @@ bool do_check_blif(CStr cfn) { flush_out(true); ls << ">>>>> checking BLIF " << cfn << " ..." << endl; - bool chk_ok = bfile.checkBlif(); + bool chk_ok = bfile.checkBlif(badInputs, badOutputs); assert(chk_ok == bfile.chk_ok_); lprintf("===== passed: %s\n", chk_ok ? "YES" : "NO"); @@ -193,10 +198,12 @@ bool do_check(const rsOpts& opts, bool blif_vs_csv) { lprintf(" checking %s file: %s\n", fileType, cfn); bool status; - if (blif_vs_csv) - status = do_check_blif(cfn); - else + if (blif_vs_csv) { + vector badInp, badOut; + status = do_check_blif(cfn, badInp, badOut); + } else { status = do_check_csv(cfn); + } flush_out(true); diff --git a/planning/src/RS/rsCheck.h b/planning/src/RS/rsCheck.h index d33e97fa..8543ca9b 100644 --- a/planning/src/RS/rsCheck.h +++ b/planning/src/RS/rsCheck.h @@ -9,7 +9,9 @@ namespace pln { bool do_check(const rsOpts& opts, bool blif_vs_csv); -bool do_check_blif(CStr cfn); +bool do_check_blif(CStr cfn, + std::vector& badInputs, + std::vector& badOutputs); } diff --git a/planning/src/file_io/pln_blif_file.cpp b/planning/src/file_io/pln_blif_file.cpp index a2122796..35f74ada 100644 --- a/planning/src/file_io/pln_blif_file.cpp +++ b/planning/src/file_io/pln_blif_file.cpp @@ -343,9 +343,13 @@ bool BLIF_file::readBlif() noexcept { return true; } -bool BLIF_file::checkBlif() noexcept { +bool BLIF_file::checkBlif(vector& badInputs, + vector& badOutputs) noexcept { chk_ok_ = false; err_msg_.clear(); + badInputs.clear(); + badOutputs.clear(); + auto& ls = lout(); if (inputs_.empty() and outputs_.empty()) { @@ -499,8 +503,6 @@ bool BLIF_file::checkBlif() noexcept { // -- write yaml file to check prim-DB: if (trace_ >= 8) { - //string written = pr_write_yaml( DSP19X2 ); - //string written = pr_write_yaml( DSP38 ); //string written = pr_write_yaml( FIFO36K ); //string written = pr_write_yaml( FIFO18KX2 ); string written = pr_write_yaml( TDP_RAM36K ); @@ -1329,8 +1331,8 @@ bool BLIF_file::createNodes() noexcept { } if (nd.kw_ == ".subckt" or nd.kw_ == ".gate") { if (nd.data_.size() > 1) { - if (nd.lnum_ == 47) - lputs8(); + // if (nd.lnum_ == 47) + // lputs8(); const string& last = nd.data_.back(); size_t llen = last.length(); if (!last.empty() and llen < 4095) { diff --git a/planning/src/file_io/pln_blif_file.h b/planning/src/file_io/pln_blif_file.h index 241d935b..20666c78 100644 --- a/planning/src/file_io/pln_blif_file.h +++ b/planning/src/file_io/pln_blif_file.h @@ -266,7 +266,7 @@ struct BLIF_file : public fio::MMapReader virtual void reset(CStr nm, uint16_t tr = 0) noexcept override; bool readBlif() noexcept; - bool checkBlif() noexcept; + bool checkBlif(vector& badInputs, vector& badOutputs) noexcept; uint numInputs() const noexcept { return inputs_.size(); } uint numOutputs() const noexcept { return outputs_.size(); } diff --git a/planning/src/main.cpp b/planning/src/main.cpp index 2a8f896a..aa975907 100644 --- a/planning/src/main.cpp +++ b/planning/src/main.cpp @@ -1,4 +1,4 @@ -static const char* _pln_VERSION_STR = "pln0348"; +static const char* _pln_VERSION_STR = "pln0349"; #include "RS/rsEnv.h" #include "util/pln_log.h" diff --git a/planning/src/pin_loc/pcf_place.cpp b/planning/src/pin_loc/pcf_place.cpp index ca7cb942..e9f11782 100644 --- a/planning/src/pin_loc/pcf_place.cpp +++ b/planning/src/pin_loc/pcf_place.cpp @@ -647,7 +647,7 @@ void PinPlacer::get_pcf_directions( } } -bool PinPlacer::write_dot_place(const PcCsvReader& csv) { +bool PinPlacer::write_placement(const PcCsvReader& csv) { flush_out(true); placed_inputs_.clear(); placed_outputs_.clear(); @@ -657,7 +657,7 @@ bool PinPlacer::write_dot_place(const PcCsvReader& csv) { if (tr >= 3) { ls << "pin_c: writing .place output file: " << out_fn << endl; if (tr >= 7) { - ls << "write_dot_place() __ Creating .place file get_param(--output) : " + ls << "write_placement() __ Creating .place file get_param(--output) : " << out_fn << endl; } if (tr >= 5) { @@ -686,7 +686,7 @@ bool PinPlacer::write_dot_place(const PcCsvReader& csv) { if (tr >= 1) { flush_out(true); err_puts(); - lprintf2("[Error] pin_c: write_dot_place() output file is not writable: %s\n", + lprintf2("[Error] pin_c: write_placement() output file is not writable: %s\n", out_fn.c_str()); flush_out(true); } diff --git a/planning/src/pin_loc/pin_placer.cpp b/planning/src/pin_loc/pin_placer.cpp index 6846f376..0a76297c 100644 --- a/planning/src/pin_loc/pin_placer.cpp +++ b/planning/src/pin_loc/pin_placer.cpp @@ -240,35 +240,14 @@ bool PinPlacer::read_and_write() { !(csv_name.empty() || no_b_json || output_name.empty()) && user_pcf_.empty(); - if (tr >= 4) { + if (tr >= 5) { ls << "\t usage_requirement_1 : " << boolalpha << usage_requirement_1 << endl; ls << "\t usage_requirement_2 : " << boolalpha << usage_requirement_2 << endl; } if (usage_requirement_0) { - /* - // generate new csv file with information from xml - // and csv for os flow - if (tr >= 2) { - ls << "(usage_requirement_0)\n" - << "generate new csv file with info from xml and csv for os flow" - << endl; - } - if (!generate_csv_file_for_os_flow()) { - CERROR << err_lookup("GENERATE_CSV_FILE_FOR_OS_FLOW") << endl; - return false; - } - // in os mode, the pcf does not contains any "-mode" - // we need to generate a temp pcf file with "-mode" option, which selects - // mode "Mode_GPIO" - if (user_pcf_.size()) { - if (!convert_pcf_for_os_flow(user_pcf_)) { - CERROR << err_lookup("GENERATE_PCF_FILE_FOR_OS_FLOW") << endl; - return false; - } - } - */ - } else if (!usage_requirement_1 && !usage_requirement_2) { + } + else if (!usage_requirement_1 && !usage_requirement_2) { flush_out(true); if (tr >= 2) lputs("[Error] pin_c: !usage_requirement_1 && !usage_requirement_2\n"); @@ -454,13 +433,13 @@ bool PinPlacer::read_and_write() { finalize_edits(); // --7. create .place file - if (!write_dot_place(csv_rd)) { + if (!write_placement(csv_rd)) { // error messages will be issued in callee if (tr) { flush_out(true); - ls << "[Error] pin_c: !write_dot_place(csv_rd)" << endl; + ls << "[Error] pin_c: !write_placement()" << endl; err_puts(); - CERROR << "write_dot_place() failed" << endl; + CERROR << "write_placement() failed" << endl; flush_out(true); } return false; diff --git a/planning/src/pin_loc/pin_placer.h b/planning/src/pin_loc/pin_placer.h index 538e8ace..5f3856f6 100644 --- a/planning/src/pin_loc/pin_placer.h +++ b/planning/src/pin_loc/pin_placer.h @@ -242,7 +242,7 @@ struct PinPlacer { bool read_PCF(const PcCsvReader&); - bool write_dot_place(const PcCsvReader&); + bool write_placement(const PcCsvReader&); bool create_temp_pcf(PcCsvReader&); diff --git a/planning/src/pin_loc/read_ports.cpp b/planning/src/pin_loc/read_ports.cpp index 40c2e654..58760bf1 100644 --- a/planning/src/pin_loc/read_ports.cpp +++ b/planning/src/pin_loc/read_ports.cpp @@ -14,7 +14,7 @@ using fio::Fio; static bool s_is_fabric_blif(const string& fn) noexcept { size_t len = fn.length(); - if (len < 12 or len > 5000) + if (len < 8 or len > 5000) return false; char buf[len + 2] = {}; ::strcpy(buf, fn.c_str()); @@ -29,7 +29,7 @@ static bool s_is_fabric_blif(const string& fn) noexcept { Fio::split_spa(buf, W); if (W.size() < 2) return false; - if (W.back() != "eblif") + if (W.back() != "eblif" and W.back() != "blif") return false; const string& f = W[W.size() - 2]; @@ -1098,7 +1098,7 @@ bool PinPlacer::BlifReader::read_blif(const string& blif_fn, bool& checked_ok) n BLIF_file bfile(blif_fn); if (tr >= 4) - bfile.setTrace(3); + bfile.setTrace(4); bool exi = false; exi = bfile.fileExists(); @@ -1117,10 +1117,12 @@ bool PinPlacer::BlifReader::read_blif(const string& blif_fn, bool& checked_ok) n return false; } + vector badInputs, badOutputs; + if (not ::getenv("pinc_dont_check_blif")) { lprintf("____ BEGIN pinc_check_blif: %s\n", cfn); flush_out(true); - checked_ok = do_check_blif(cfn); + checked_ok = do_check_blif(cfn, badInputs, badOutputs); flush_out(true); lprintf(" pinc_check_blif STATUS = %s\n\n", checked_ok ? "PASS" : "FAIL");