Skip to content

Commit 35126a1

Browse files
authored
Merge pull request #813 from os-fpga/pln_trace_option
pln: enable --trace <number> CL option, overrides pln_trace variable
2 parents 69e0bd0 + 7cff61a commit 35126a1

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

planning/src/RS/rsCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ bool do_check_blif(CStr cfn) {
1515
BLIF_file bfile(string{cfn});
1616

1717
if (tr >= 4)
18-
bfile.setTrace(3);
18+
bfile.setTrace(tr);
1919

2020
bool exi = false;
2121
exi = bfile.fileExists();

planning/src/RS/rsOpts.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static CStr _output_[] = {"OU", "ou", "out", "outp", "output", nullptr};
4040

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

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

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

@@ -156,6 +156,7 @@ void rsOpts::printHelp() const noexcept {
156156
static CStr tab1[] = {
157157
"--help,-H", "Help",
158158
"--version,-V", "Version",
159+
"--trace,-T <number>", "Trace level, default 3",
159160
"--check <blif_file_name>", "BLIF or EBLIF file to check",
160161
"--csv <csv_file_name>", "CSV file (pin table) to check",
161162
nullptr, nullptr, nullptr };

planning/src/RS/rsOpts.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,12 @@ struct rsOpts {
9292
void printHelp() const noexcept;
9393

9494
bool unit_specified() const noexcept {
95-
return unit1_ || unit2_ || unit3_ || unit4_ || unit5_ || unit6_ || unit7_;
95+
return unit1_ or unit2_ or unit3_ or unit4_ or unit5_ or unit6_
96+
or unit7_;
9697
}
97-
bool ver_or_help() const noexcept { return version_ || det_ver_ || help_; }
98+
bool ver_or_help() const noexcept { return version_ or det_ver_ or help_; }
9899

99-
bool trace_specified() const noexcept { return traceIndex_ > 0; }
100+
bool trace_specified() const noexcept { return traceIndex_ > 0 and trace_ > 0; }
100101
bool test_id_specified() const noexcept { return test_id_ > 0; }
101102

102103
bool set_STA_testCase(int TC_id) noexcept;

planning/src/main.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
static const char* _pln_VERSION_STR = "pln0318";
1+
static const char* _pln_VERSION_STR = "pln0319";
22

33
#include "RS/rsEnv.h"
44
#include "util/pln_log.h"
@@ -449,27 +449,29 @@ int main(int argc, char** argv) {
449449
using std::string;
450450

451451
rsOpts& opts = s_env.opts_;
452-
const char* trace = getenv("pln_trace");
452+
const char* trace = ::getenv("pln_trace");
453453
if (trace)
454-
set_ltrace(atoi(trace));
454+
set_ltrace(::atoi(trace));
455455
else
456-
set_ltrace(opts.trace_);
456+
set_ltrace(3);
457457

458458
cout << s_env.traceMarker_ << endl;
459459

460460
s_env.initVersions(_pln_VERSION_STR);
461461

462462
s_env.parse(argc, argv);
463+
if (opts.trace_specified())
464+
set_ltrace(opts.trace_);
463465

464-
if (opts.trace_ >= 8 || ltrace() >= 9 || getenv("pln_trace_env")) {
466+
if (opts.trace_ >= 8 or ltrace() >= 9 or ::getenv("pln_trace_env")) {
465467
s_env.dump("\n----env----\n");
466468
lout() << "-----------" << endl;
467469
}
468470

469471
if (opts.ver_or_help()) {
470472
if (ltrace() >= 2) {
471473
printf("\t %s\n", _pln_VERSION_STR);
472-
printf("\t compiled: %s\n", s_env.compTimeCS());
474+
printf("\t compiled: %s\n", s_env.compTimeCS());
473475
}
474476
deal_help(opts);
475477
pln::flush_out();

0 commit comments

Comments
 (0)