Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion planning/src/RS/rsCheck.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "RS/rsCheck.h"
#include "file_io/pln_blif_file.h"
#include "file_io/pln_csv_reader.h"
#include <filesystem>

namespace pln {

Expand Down Expand Up @@ -117,8 +118,13 @@ bool do_check_blif(CStr cfn,
lprintf(" # WARNINGS= %u", numWarn);
lputs();
if (numWarn or ::getenv("pln_always_write_blif")) {
string outFn = str::concat("PLN_W", std::to_string(numWarn), "_", cfn);
std::filesystem::path full_path{bfile.fnm_};
std::filesystem::path base_path = full_path.filename();
std::string base = base_path.string();
string outFn = str::concat("PLN_W", std::to_string(numWarn), "_", base);

string wr_ok = bfile.writeBlif(outFn, numWarn);

if (wr_ok.empty())
lprintf("---!! FAILED writeBlif to '%s'\n", outFn.c_str());
else
Expand Down
15 changes: 11 additions & 4 deletions planning/src/file_io/pln_blif_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ bool BLIF_file::readBlif() noexcept {
}

size_t num_escaped = escapeNL();
if (trace_ >= 4) {
if (trace_ >= 6) {
lprintf(" ....\\ ... num_escaped= %zu\n", num_escaped);
}

Expand Down Expand Up @@ -2509,7 +2509,12 @@ string BLIF_file::writeBlif(const string& toFn, bool cleanUp) noexcept {
if (not hasLines())
return {};

string fn2 = (toFn == fnm_ ? str::concat("2_", toFn) : toFn);
string fn2 = toFn; // (toFn == fnm_ ? str::concat("2_", toFn) : toFn);

if (trace_ >= 4) {
lout() << "pln_blif_file: writing BLIF to " << fn2
<< "\n CWD= " << get_CWD() << endl;
}

CStr cnm = fn2.c_str();
FILE* f = ::fopen(cnm, "w");
Expand Down Expand Up @@ -2562,7 +2567,7 @@ string BLIF_file::writeBlif(const string& toFn, bool cleanUp) noexcept {
buf[0] = 0; buf[1] = 0;
size_t rdsz = dNode.realData_.size();
if (trace_ >= 4) {
lprintf("wrBlif: cell %s at line %zu has dangling bit, filtering..\n",
lprintf(" wrBlif: cell %s at line %zu has dangling bit, filtering..\n",
dNode.cPrimType(), lineNum);
if (trace_ >= 5) {
lprintf(" dangling cell realData_.size()= %zu\n", rdsz);
Expand All @@ -2581,7 +2586,7 @@ string BLIF_file::writeBlif(const string& toFn, bool cleanUp) noexcept {
tail = ::stpcpy(tail, ts);
}
if (trace_ >= 4) {
lprintf("wrBlif: filtered dangling bits (%u) for cell %s at line %zu\n",
lprintf(" wrBlif: filtered dangling bits (%u) for cell %s at line %zu\n",
skipCnt, dNode.cPrimType(), lineNum);
}
}
Expand Down Expand Up @@ -2617,6 +2622,8 @@ string BLIF_file::writeBlif(const string& toFn, bool cleanUp) noexcept {

flush_out(trace_ >= 5);

if (error)
return {};
return fn2;
}

Expand Down
2 changes: 1 addition & 1 deletion planning/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static const char* _pln_VERSION_STR = "pln0355";
static const char* _pln_VERSION_STR = "pln0356";

#include "RS/rsEnv.h"
#include "util/pln_log.h"
Expand Down
16 changes: 12 additions & 4 deletions planning/src/util/pln_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,18 @@ inline string concat(CStr a, const string& b, CStr c, CStr d) noexcept {
if (a)
z = a;
z += b;
if (c)
z += c;
if (d)
z += d;
if (c) z += c;
if (d) z += d;
return z;
}
inline string concat(CStr a, const string& b, CStr c, const string& d) noexcept {
string z;
z.reserve(p_strlen(a) + b.length() + p_strlen(c) + d.length() + 1);
if (a)
z = a;
z += b;
if (c) z += c;
z += d;
return z;
}
inline string concat(const string& a, CStr b) noexcept { return b ? a + b : a; }
Expand Down
Loading