aboutsummaryrefslogtreecommitdiffstats
path: root/icetime
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-02-28 15:03:40 +0000
committerDavid Shah <davey1576@gmail.com>2018-02-28 15:04:57 +0000
commitc1d7ef8b529953bb38f575930eca662d714385ab (patch)
tree9ddc0c6adbcca2d4487799f071853e88cabc015a /icetime
parent4cdf41c8408c092e69b819bdbad5a39c1e43943b (diff)
downloadicestorm-c1d7ef8b529953bb38f575930eca662d714385ab.tar.gz
icestorm-c1d7ef8b529953bb38f575930eca662d714385ab.tar.bz2
icestorm-c1d7ef8b529953bb38f575930eca662d714385ab.zip
Fix handling of a port name like CLKHF_FABRIC in icetime
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'icetime')
-rw-r--r--icetime/icetime.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/icetime/icetime.cc b/icetime/icetime.cc
index 9caf82b..0b7cea2 100644
--- a/icetime/icetime.cc
+++ b/icetime/icetime.cc
@@ -1283,12 +1283,18 @@ std::string ecnetname_to_vlog(std::string ec_name)
std::string end = ec_name.substr(last_+1);
size_t nidx = 0;
- int num = std::stoi(end, &nidx, 10);
- if(nidx == end.length()) {
- return base + "[" + std::to_string(num) + "]";
- } else {
+ int num = 0;
+ try {
+ num = std::stoi(end, &nidx, 10);
+ if(nidx == end.length()) {
+ return base + "[" + std::to_string(num) + "]";
+ } else {
+ return ec_name;
+ }
+ } catch(std::invalid_argument e) { // Not numeric and stoi throws exception
return ec_name;
}
+
}
std::string make_dsp_ip(int x, int y, std::string net, std::string &primnet)