Skip to content

Commit 3e29c93

Browse files
committed
pin_c: translateClockName debug print. EDA-3041
1 parent eacd26a commit 3e29c93

File tree

6 files changed

+58
-10
lines changed

6 files changed

+58
-10
lines changed

planning/src/RS/rsEnv.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,6 @@ void rsEnv::listDevEnv() const noexcept {
278278
#ifdef PINC_DEVEL_MODE
279279
lprintf("\t PINC_DEVEL_MODE :\t (defined)\n");
280280
#endif
281-
#ifdef RSBE_PLANNER_MODE
282-
lprintf("\t RSBE_PLANNER_MODE :\t (defined)\n");
283-
#endif
284281
#ifdef NN_FAST_BUILD
285282
lprintf("\t NN_FAST_BUILD :\t (defined)\n");
286283
#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 = "pln0259";
1+
static const char* _pln_VERSION_STR = "pln0261";
22

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

planning/src/pin_loc/map_clocks.cpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ int PinPlacer::map_clocks() {
5555
return 1;
5656
}
5757

58+
static bool is_post_edit_clock(CStr cs, size_t len) noexcept {
59+
if (!cs or !cs[0])
60+
return false;
61+
if (len < 18)
62+
return false;
63+
if (cs[0] != '$')
64+
return false;
65+
if (cs[1] != 'a')
66+
return false;
67+
68+
// len("$auto$clkbufmap") == 15
69+
if (::strncmp(cs, "$auto$clkbufmap", 15) == 0)
70+
return true;
71+
return false;
72+
}
73+
5874
int PinPlacer::write_clocks_logical_to_physical() {
5975
flush_out(false);
6076
uint16_t tr = ltrace();
@@ -183,10 +199,13 @@ int PinPlacer::write_clocks_logical_to_physical() {
183199
udes_clocks.reserve(tokenized_cmds.size());
184200
pdev_clocks.reserve(tokenized_cmds.size());
185201

202+
string uclk, postEdit_uclk;
186203
for (const auto& tcmd : tokenized_cmds) {
204+
uclk.clear();
205+
postEdit_uclk.clear();
187206
assert(tcmd.size() < USHRT_MAX);
188207
uint sz = tcmd.size();
189-
if (tr >= 6) {
208+
if (tr >= 7) {
190209
logVec(tcmd, " tcmd: ");
191210
lprintf("\t tcmd.size()= %u\n", sz);
192211
}
@@ -201,6 +220,17 @@ int PinPlacer::write_clocks_logical_to_physical() {
201220
}
202221
if (tk == "-design_clock") {
203222
udes_clocks.push_back(tcmd[j + 1]);
223+
uclk = udes_clocks.back();
224+
postEdit_uclk.clear();
225+
CStr cs = uclk.c_str();
226+
bool is_post_edit = is_post_edit_clock(cs, uclk.length());
227+
if (tr >= 6)
228+
lprintf("\t uclk: %s is_post_edit:%i\n", cs, is_post_edit);
229+
if (not is_post_edit) {
230+
postEdit_uclk = translateClockName(uclk);
231+
if (tr >= 6)
232+
lprintf("\t\t ..... postEdit_uclk: %s\n", postEdit_uclk.c_str());
233+
}
204234
j++;
205235
continue;
206236
}

planning/src/pin_loc/pin_placer.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ struct PinPlacer {
4747

4848
EditItem() noexcept = default;
4949

50-
CStr c_jsdir() const noexcept { return js_dir_.c_str(); }
5150
CStr cname() const noexcept { return name_.c_str(); }
51+
size_t nameHash() const noexcept { return str::hashf(name_.c_str()); }
52+
53+
CStr c_jsdir() const noexcept { return js_dir_.c_str(); }
5254
CStr c_mod() const noexcept { return module_.c_str(); }
5355
CStr c_old() const noexcept { return oldPin_.c_str(); }
5456
CStr c_new() const noexcept { return newPin_.c_str(); }
@@ -268,6 +270,11 @@ struct PinPlacer {
268270

269271
string translatePinName(const string& pinName, bool is_input) const noexcept;
270272
uint translatePinNames(const string& memo) noexcept;
273+
274+
string translateClockName(const string& clkName) const noexcept {
275+
assert(not clkName.empty());
276+
return translatePinName(clkName, true);
277+
}
271278
};
272279

273280
}

planning/src/pin_loc/read_ports.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,8 @@ void PinPlacer::dump_edits(const string& memo) noexcept {
639639
for (uint i = 0; i < esz; i++) {
640640
const EditItem& ed = all_edits_[i];
641641
lprintf(
642-
" |%u| %s module: %s js_dir:%s dir:%i old: %s new: %s",
643-
i+1, ed.cname(), ed.c_mod(), ed.c_jsdir(), ed.dir_, ed.c_old(), ed.c_new());
642+
" |%u| %zu module: %s js_dir:%s dir:%i old: %s new: %s",
643+
i+1, ed.nameHash(), ed.c_mod(), ed.c_jsdir(), ed.dir_, ed.c_old(), ed.c_new());
644644
if (ed.isQBus())
645645
lprintf(" QBUS-%u", ed.qbusSize());
646646
lputs();
@@ -861,6 +861,14 @@ void PinPlacer::set_edit_dirs(bool initial) noexcept {
861861
for (uint i = 0; i < sz; i++) {
862862
EditItem& item = all_edits_[i];
863863
assert(item.dir_ == 0);
864+
if (item.js_dir_ == "IN") {
865+
item.dir_ = 1;
866+
continue;
867+
}
868+
if (item.js_dir_ == "OUT") {
869+
item.dir_ = -1;
870+
continue;
871+
}
864872
const string& mod = item.module_;
865873
if (mod == "I_BUF" or mod == "CLK_BUF" or mod == "I_DELAY" or mod == "I_SERDES")
866874
item.dir_ = 1;

planning/src/util/pln_log.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,13 @@
4242
#include <memory>
4343
#include <numeric>
4444
#include <string>
45+
#include <string_view>
4546
#include <functional>
4647
#include <stdexcept>
4748
#include <utility>
4849
#include <vector>
4950
#include <array>
5051

51-
#define RSBE_PLANNER_MODE 1
52-
5352
namespace pln {
5453

5554
using CStr = const char*;
@@ -252,6 +251,13 @@ inline CStr trimFront(CStr z) noexcept {
252251
return z;
253252
}
254253

254+
inline size_t hashf(CStr z) noexcept {
255+
if (!z) return 0;
256+
if (!z[0]) return 1;
257+
std::hash<std::string_view> h;
258+
return h(std::string_view{z});
259+
}
260+
255261
} // NS str
256262

257263
template <typename T>

0 commit comments

Comments
 (0)