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
17 changes: 12 additions & 5 deletions planning/src/RS/rsCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>& badInputs,
vector<string>& badOutputs) {
assert(cfn);
uint16_t tr = ltrace();
auto& ls = lout();
badInputs.clear();
badOutputs.clear();

BLIF_file bfile(string{cfn});

Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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<string> badInp, badOut;
status = do_check_blif(cfn, badInp, badOut);
} else {
status = do_check_csv(cfn);
}

flush_out(true);

Expand Down
4 changes: 3 additions & 1 deletion planning/src/RS/rsCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>& badInputs,
std::vector<std::string>& badOutputs);

}

Expand Down
12 changes: 7 additions & 5 deletions planning/src/file_io/pln_blif_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,13 @@ bool BLIF_file::readBlif() noexcept {
return true;
}

bool BLIF_file::checkBlif() noexcept {
bool BLIF_file::checkBlif(vector<string>& badInputs,
vector<string>& badOutputs) noexcept {
chk_ok_ = false;
err_msg_.clear();
badInputs.clear();
badOutputs.clear();

auto& ls = lout();

if (inputs_.empty() and outputs_.empty()) {
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion planning/src/file_io/pln_blif_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>& badInputs, vector<string>& badOutputs) noexcept;

uint numInputs() const noexcept { return inputs_.size(); }
uint numOutputs() const noexcept { return outputs_.size(); }
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 = "pln0348";
static const char* _pln_VERSION_STR = "pln0349";

#include "RS/rsEnv.h"
#include "util/pln_log.h"
Expand Down
6 changes: 3 additions & 3 deletions planning/src/pin_loc/pcf_place.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down
33 changes: 6 additions & 27 deletions planning/src/pin_loc/pin_placer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion planning/src/pin_loc/pin_placer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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&);

Expand Down
10 changes: 6 additions & 4 deletions planning/src/pin_loc/read_ports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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];
Expand Down Expand Up @@ -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();
Expand All @@ -1117,10 +1117,12 @@ bool PinPlacer::BlifReader::read_blif(const string& blif_fn, bool& checked_ok) n
return false;
}

vector<string> 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");
Expand Down