diff options
Diffstat (limited to 'icetime/icetime.cc')
| -rw-r--r-- | icetime/icetime.cc | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/icetime/icetime.cc b/icetime/icetime.cc index cdec43e..f9e0994 100644 --- a/icetime/icetime.cc +++ b/icetime/icetime.cc @@ -33,6 +33,10 @@ #include <map> #include <set> +#ifdef __EMSCRIPTEN__ +#include <emscripten.h> +#endif + // add this number of ns as estimate for clock distribution mismatch #define GLOBAL_CLK_DIST_JITTER 0.1 @@ -1283,16 +1287,24 @@ 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) { + // Don't generate excessive warnings about unknown cells + static std::set<std::string> unsupported_cells; std::tuple<int, int, std::string> ecnet(x, y, net); std::tuple<std::string, int, int, int> key("", -1, -1, -1); bool found = false; @@ -1423,9 +1435,11 @@ std::string make_dsp_ip(int x, int y, std::string net, std::string &primnet) return cell; } else { - netlist_cell_types[cell] = "SB_" + ectype; - fprintf(stderr, "Warning: timing analysis not supported for cell type %s\n", ectype.c_str()); - return cell; + if (unsupported_cells.find(ectype) == unsupported_cells.end()) { + fprintf(stderr, "Warning: timing analysis not supported for cell type %s\n", ectype.c_str()); + unsupported_cells.insert(ectype); + } + return ""; } } @@ -1567,8 +1581,8 @@ void make_seg_cell(int net, const net_segment_t &seg) if(device_type == "up5k" && ((seg.x == 0) || (seg.x == int(config_tile_type.size()) - 1))) { std::string primnet; auto cell = make_dsp_ip(seg.x, seg.y, seg.name, primnet); - netlist_cell_ports[cell][primnet] = net_name(net); if(cell != "") { + netlist_cell_ports[cell][primnet] = net_name(net); make_inmux(seg.x, seg.y, net); } return; @@ -2213,6 +2227,18 @@ void help(const char *cmd) int main(int argc, char **argv) { +#ifdef __EMSCRIPTEN__ + EM_ASM( + if (ENVIRONMENT_IS_NODE) + { + FS.mkdir('/hostcwd'); + FS.mount(NODEFS, { root: '.' }, '/hostcwd'); + FS.mkdir('/hostfs'); + FS.mount(NODEFS, { root: '/' }, '/hostfs'); + } + ); +#endif + bool listnets = false; bool print_timing = false; bool interior_timing = false; |
