Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pin_c: check and report --clk_map argument #761

Merged
merged 1 commit into from
Jul 15, 2024
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
22 changes: 21 additions & 1 deletion planning/src/RS/rsOpts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ static CStr _xml_[] = {"XM", "xm", "xml", "XML", nullptr};
static CStr _pcf_[] = {"PCF", "pcf", nullptr};

static CStr _edtf_[] = {"EDT", "edit", "edits", nullptr};
static CStr _cmap_[] = {"MAPC", "clkmap", "clk_map", nullptr};

static CStr _blif_[] = {"BL", "blif", nullptr};

Expand Down Expand Up @@ -288,7 +289,7 @@ void rsOpts::parse(int argc, const char** argv) noexcept {
assert(argc_ > 0 and argv_);

CStr inp = 0, out = 0, csv = 0, xml = 0, pcf = 0, blif = 0, jsnf = 0,
fun = 0, assignOrd = 0, edtf = 0;
fun = 0, assignOrd = 0, edtf = 0, cmapf = 0;

for (int i = 1; i < argc_; i++) {
CStr arg = argv_[i];
Expand Down Expand Up @@ -354,6 +355,14 @@ void rsOpts::parse(int argc, const char** argv) noexcept {
edtf = nullptr;
continue;
}
if (op_match(arg, _cmap_)) {
i++;
if (i < argc_)
cmapf = argv_[i];
else
cmapf = nullptr;
continue;
}
if (op_match(arg, _blif_)) {
i++;
if (i < argc_)
Expand Down Expand Up @@ -433,6 +442,7 @@ void rsOpts::parse(int argc, const char** argv) noexcept {
blifFile_ = p_strdup(blif);
jsonFile_ = p_strdup(jsnf);
editsFile_ = p_strdup(edtf);
cmapFile_ = p_strdup(cmapf);

if (fun)
setFunction(fun);
Expand Down Expand Up @@ -606,6 +616,16 @@ bool rsOpts::validate_pinc_args(int argc, const char** argv) noexcept {
}
}

CStr cmap = tmpO.cmapFile_;
if (cmap) {
if (not Fio::regularFileExists(cmap)) {
flush_out(true); err_puts();
lprintf2("[Error] specified --clk_map file does not exist: %s\n", cmap);
err_puts(); flush_out(true);
return false;
}
}

flush_out(false);
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions planning/src/RS/rsOpts.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ struct rsOpts {
char* pcfFile_ = nullptr;
char* blifFile_ = nullptr;
char* jsonFile_ = nullptr;

char* editsFile_ = nullptr;
char* cmapFile_ = nullptr;

char* input_ = nullptr;
char* output_ = nullptr;
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 = "pln0258";
static const char* _pln_VERSION_STR = "pln0259";

#include "RS/rsEnv.h"
#include "util/pln_log.h"
Expand Down
9 changes: 6 additions & 3 deletions planning/src/pin_loc/map_clocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ using fio::Fio;
#define CERROR std::cerr << "[Error] "

int PinPlacer::map_clocks() {
clk_map_file_.clear();
uint16_t tr = ltrace();
if (tr >= 4) {
flush_out(true);
Expand All @@ -33,9 +34,9 @@ int PinPlacer::map_clocks() {

string fpga_repack = cl_.get_param("--read_repack");
string user_constrained_repack = cl_.get_param("--write_repack");
string clk_map_file = cl_.get_param("--clk_map");
clk_map_file_ = cl_.get_param("--clk_map");

bool constraint_xml_requested = fpga_repack.size() or clk_map_file.size();
bool constraint_xml_requested = fpga_repack.size() or clk_map_file_.size();
if (not constraint_xml_requested) {
if (tr >= 4)
lputs("PinPlacer::map_clocks() returns NOP");
Expand Down Expand Up @@ -65,7 +66,9 @@ int PinPlacer::write_clocks_logical_to_physical() {
}

bool rd_ok = false, wr_ok = false;
string clkmap_fn = cl_.get_param("--clk_map");

clk_map_file_ = cl_.get_param("--clk_map");
const string& clkmap_fn = clk_map_file_;

if (not Fio::regularFileExists(clkmap_fn)) {
flush_out(true);
Expand Down
3 changes: 3 additions & 0 deletions planning/src/pin_loc/pcf_place.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ void PinPlacer::print_summary(const string& csv_name) const {
CStr editsVal = has_edits_.empty() ? "FALSE" : has_edits_.c_str();
lprintf(" has edits (config.json) : %s\n", editsVal);

CStr cmapVal = clk_map_file_.empty() ? "(NONE)" : clk_map_file_.c_str();
lprintf(" clk_map_file : %s\n", cmapVal);

lprintf(" pinc_trace verbosity= %u\n", tr);

if (num_critical_warnings_) {
Expand Down
1 change: 1 addition & 0 deletions planning/src/pin_loc/pin_placer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ void PinPlacer::resetState() noexcept {
num_critical_warnings_ = 0;
user_pcf_.clear();
has_edits_.clear();
clk_map_file_.clear();
clear_err_code();
}

Expand Down
1 change: 1 addition & 0 deletions planning/src/pin_loc/pin_placer.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ struct PinPlacer {
bool auto_pcf_created_ = false;
string user_pcf_;
string has_edits_;
string clk_map_file_;

public:
enum class PortDir : uint8_t {
Expand Down
Loading