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
9 changes: 9 additions & 0 deletions planning/src/RS/rsCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ bool do_check_blif(CStr cfn,
std::filesystem::path full_path{bfile.fnm_};
std::filesystem::path base_path = full_path.filename();
std::string base = base_path.string();
//lputs9();
string outFn = str::concat("PLN_W", std::to_string(numWarn), "_", base);

string wr_ok = bfile.writeBlif(outFn, numWarn);
Expand Down Expand Up @@ -154,6 +155,14 @@ bool do_check_blif(CStr cfn,
return false;
}

// 'corrected' : (lnum, removed_net)
bool do_cleanup_blif(CStr cfn, std::vector<uspair>& corrected) {
assert(cfn);
corrected.clear();

return false;
}

static bool do_check_csv(CStr cfn) {
assert(cfn);
uint16_t tr = ltrace();
Expand Down
5 changes: 5 additions & 0 deletions planning/src/RS/rsCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ bool do_check_blif(CStr cfn,
std::vector<std::string>& badInputs,
std::vector<std::string>& badOutputs);

bool do_cleanup_blif(
CStr cfn,
std::vector<uspair>& corrected // (lnum, removed_net)
);

}

#endif
Expand Down
33 changes: 21 additions & 12 deletions planning/src/RS/rsOpts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,24 @@ namespace alias {

static CStr _ver_[] = {"V", "v", "ver", "vers", "version", nullptr};

static CStr _det_ver_[] = {"VV", "vv", "VVV", "vvv", "det_ver", "detailed_version", nullptr};
static CStr _det_ver_[] = { "VV", "vv", "VVV", "vvv", "det_ver",
"detailed_version", nullptr };

static CStr _help_[] = {"H", "h", "help", "hel", "hlp", "he", nullptr};
static CStr _help_[] = { "H", "HH", "h", "hh", "help",
"hel", "hlp", "he", nullptr };

static CStr _fun_[] = {"F", "fu", "fun", "func", "funct", "function", nullptr};
static CStr _fun_[] = { "F", "FF", "ff", "fu", "fun", "func",
"funct", "function", nullptr };

static CStr _check_[] = {"CH", "ch", "CC", "cc", "che", "chec", "check", nullptr};
static CStr _check_[] = { "CH", "CHECK", "ch", "CC", "cc", "che", "chec",
"check", "check_blif", nullptr };

static CStr _csv_[] = {"CSV", "cs", "csv", nullptr};
static CStr _clean_[] = { "CLEAN", "CLEANUP", "clean", "cleanup", "clean_up",
"cleanup_blif", "cleanupblif", "clean_up_blif", nullptr };

static CStr _xml_[] = {"XM", "xm", "xml", "XML", nullptr};
static CStr _csv_[] = {"CSV", "cs", "csv", "Csv", nullptr};

static CStr _xml_[] = {"XM", "xm", "xml", "Xml", "XML", nullptr};

static CStr _pcf_[] = {"PCF", "pcf", nullptr};

Expand All @@ -38,15 +45,13 @@ static CStr _json_[] = {"JS", "js", "jsf", "json", "port_info", "port_i", "PI",

static CStr _output_[] = {"OU", "ou", "out", "outp", "output", nullptr};

static CStr _assOrd_[] = {"ASS", "ass", "assign", "assign_unconstrained", "assign_unconstrained_pins", nullptr};
static CStr _assOrd_[] = { "ASS", "ass", "assign", "assign_unconstrained",
"assign_unconstrained_pins", nullptr };

static CStr _trace_[] = {"TR", "T", "TT", "tt", "trace", "Trace", "Tr", "tr", "tra", "trac", nullptr};

static CStr _test_[] = {"TE", "TC", "test", "te", "tc", "tes", "tst", "test_case", "test_c", nullptr};

#ifdef RSBE_UNIT_TEST_ON
#endif // RSBE_UNIT_TEST_ON

}

static constexpr size_t UNIX_Path_Max = PATH_MAX - 4;
Expand Down Expand Up @@ -158,6 +163,7 @@ void rsOpts::printHelp() const noexcept {
"--version,-V", "Version",
"--trace,-T <number>", "Trace level, default 3",
"--check <blif_file_name>", "BLIF or EBLIF file to check",
"--clean_up <blif_file_name>", "BLIF or EBLIF file to clean up",
"--csv <csv_file_name>", "CSV file (pin table) to check",
nullptr, nullptr, nullptr };

Expand Down Expand Up @@ -323,9 +329,12 @@ void rsOpts::parse(int argc, const char** argv) noexcept {
check_ = true;
continue;
}
if (op_match(arg, _clean_)) {
cleanup_ = true;
continue;
}

#ifdef RSBE_UNIT_TEST_ON
#endif // RSBE_UNIT_TEST_ON
// --

if (op_match(arg, _csv_)) {
i++;
Expand Down
1 change: 1 addition & 0 deletions planning/src/RS/rsOpts.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ struct rsOpts {

bool help_ = false;
bool check_ = false;
bool cleanup_ = false;

bool unit1_ = false;
bool unit2_ = false;
Expand Down
48 changes: 47 additions & 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 = "pln0356";
static const char* _pln_VERSION_STR = "pln0357";

#include "RS/rsEnv.h"
#include "util/pln_log.h"
Expand Down Expand Up @@ -62,6 +62,45 @@ static bool deal_check(const rsOpts& opts) {
return status;
}

static bool deal_cleanup(const rsOpts& opts) {
bool status = false;
uint16_t tr = ltrace();

if (tr >= 4) {
flush_out(true);
lprintf("[PLANNER BLIF-CLEANER] deal_cleanup()\n");
}

if (not opts.hasInputFile()) {
err_puts("\n[PLANNER BLIF-CLEANER] : something wrong with input file\n");
if (!opts.input_) {
lputs("[PLANNER BLIF-CLEANER] : input file is not specified");
} else {
lprintf("[PLANNER BLIF-CLEANER] : input file '%s'\n", opts.input_);
lprintf(" : does not exist or not readable\n");
}
flush_out(true);
return false;
}

std::vector<uspair> corrected;
status = do_cleanup_blif(opts.input_, corrected);

if (tr >= 3) {
lprintf(" deal_cleanup status: %s\n", status ? "TRUE" : "FALSE");
if (corrected.empty()) {
if (status)
lprintf(" deal_cleanup: BLIF was not modified (NOP)\n");
} else {
lprintf(" deal_cleanup: modified BLIF, #changes= %zu\n",
corrected.size());
}
}

flush_out(true);
return status;
}

static bool deal_stars(const rsOpts& opts, bool orig_args) {
bool status = false;

Expand Down Expand Up @@ -498,6 +537,13 @@ int main(int argc, char** argv) {
else
::exit(1);
}
if (opts.cleanup_) {
bool cleanup_ok = deal_cleanup(opts);
if (cleanup_ok)
::exit(0);
else
::exit(1);
}

int status = 1;
bool ok = false;
Expand Down
Loading