Skip to content

Commit 08f78ef

Browse files
committed
pln: option to call blif-checker from pin_c
1 parent 253d51e commit 08f78ef

File tree

4 files changed

+16
-66
lines changed

4 files changed

+16
-66
lines changed

planning/src/RS/rsCheck.cpp

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
#include "RS/rsCheck.h"
22
#include "file_io/pln_blif_file.h"
33
#include "file_io/pln_csv_reader.h"
4-
#include "util/nw/Nw.h"
54

65
namespace pln {
76

87
using std::string;
98
using std::endl;
109

11-
static void nw_test_01();
12-
13-
static bool do_check_blif(CStr cfn) {
10+
bool do_check_blif(CStr cfn) {
1411
assert(cfn);
1512
uint16_t tr = ltrace();
1613
auto& ls = lout();
1714

18-
if (::getenv("pln_nw_test_01")) {
19-
nw_test_01();
20-
}
21-
2215
BLIF_file bfile(string{cfn});
2316

2417
if (tr >= 4)
@@ -171,56 +164,5 @@ bool do_check(const rsOpts& opts, bool blif_vs_csv) {
171164
return status;
172165
}
173166

174-
// DEBUG new NW code:
175-
static void nw_test_01() {
176-
flush_out(true);
177-
pln::NW g;
178-
uint64_t key_cnt = 100;
179-
uint nid = g.insP(XY{0, 0}, key_cnt++);
180-
assert(nid > 0);
181-
assert(g.hasNode(nid));
182-
183-
g.addRoot(nid);
184-
g.insP(XY{200, 0}, key_cnt++);
185-
g.insP(XY{200, 200}, key_cnt++);
186-
g.insP(XY{0, 200}, key_cnt++);
187-
188-
g.beComplete();
189-
190-
g.dump("\t g is a complete graph");
191-
lprintf("\t g. numN()= %u numE()= %u\n", g.numN(), g.numE());
192-
assert(g.numE() == 6);
193-
194-
pln::vecu topo;
195-
g.getTopo(topo);
196-
197-
flush_out(true);
198-
lputs("==== **** DOT ****");
199-
200-
g.dumpDot("g");
201-
std::ofstream fos("g.dot");
202-
if (fos.is_open()) {
203-
g.printDot(fos, nullptr, false, false);
204-
lputs(" written g.dot");
205-
fos.close();
206-
} else {
207-
flush_out(true);
208-
lprintf2("[Error] NOT fos.is_open()\n");
209-
flush_out(true);
210-
}
211-
212-
flush_out(true);
213-
lputs("==== **** METIS ****");
214-
215-
g.dumpMetis(true);
216-
217-
flush_out(true);
218-
219-
bool wr_ok = g.writeMetis("g.met", true);
220-
lprintf("wr_ok:%i\n", wr_ok);
221-
if (wr_ok)
222-
lputs(" written g.met");
223-
}
224-
225167
}
226168

planning/src/RS/rsCheck.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ namespace pln {
99

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

12+
bool do_check_blif(CStr cfn);
13+
1214
}
1315

1416
#endif

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

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

planning/src/pin_loc/read_ports.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "RS/rsCheck.h"
12
#include "pin_loc/pin_placer.h"
23
#include "file_io/pln_blif_file.h"
34
#include "file_io/nlohmann3_11_2_json.h"
@@ -1095,8 +1096,6 @@ bool PinPlacer::BlifReader::read_blif(const string& blif_fn) {
10951096

10961097
bool exi = false;
10971098
exi = bfile.fileExists();
1098-
if (tr >= 8)
1099-
ls << int(exi) << endl;
11001099
if (not exi) {
11011100
flush_out(true); err_puts();
11021101
lprintf2("[Error] BLIF file '%s' does not exist\n", cfn);
@@ -1105,18 +1104,25 @@ bool PinPlacer::BlifReader::read_blif(const string& blif_fn) {
11051104
}
11061105

11071106
exi = bfile.fileAccessible();
1108-
if (tr >= 8)
1109-
ls << int(exi) << endl;
11101107
if (not exi) {
11111108
flush_out(true); err_puts();
11121109
lprintf2("[Error] BLIF file '%s' is not accessible\n", cfn);
11131110
err_puts(); flush_out(true);
11141111
return false;
11151112
}
11161113

1114+
if (::getenv("pinc_check_blif")) {
1115+
flush_out(true);
1116+
lprintf("____ BEGIN pinc_check_blif: %s\n", cfn);
1117+
bool check_blif_ok = do_check_blif(cfn);
1118+
flush_out(true);
1119+
lprintf(" pinc_check_blif STATUS = %s\n\n",
1120+
check_blif_ok ? "PASS" : "FAIL");
1121+
lprintf("------ END pinc_check_blif: %s\n", cfn);
1122+
flush_out(true);
1123+
}
1124+
11171125
bool rd_ok = bfile.readBlif();
1118-
if (tr >= 8)
1119-
ls << int(rd_ok) << endl;
11201126
if (not rd_ok) {
11211127
flush_out(true); err_puts();
11221128
lprintf2("[Error] failed reading BLIF file '%s'\n", cfn);

0 commit comments

Comments
 (0)