Merge pull request #129 from daveshah1/icetime_ufix

Fix handling of a port name like CLKHF_FABRIC in icetime
This commit is contained in:
Clifford Wolf 2018-02-28 16:13:12 +01:00 committed by GitHub
commit 535fde6361
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -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)