From 48d0f994064557dc0832748e17133ee2eac88cbf Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Wed, 7 Aug 2019 11:09:17 -0700 Subject: [PATCH] stoi -> atoi --- frontends/blif/blifparse.cc | 2 +- frontends/liberty/liberty.cc | 6 +++--- frontends/verific/verific.cc | 2 +- kernel/rtlil.cc | 6 +++--- passes/cmds/add.cc | 2 +- passes/cmds/chformal.cc | 4 ++-- passes/cmds/qwp.cc | 2 +- passes/cmds/scc.cc | 4 ++-- passes/cmds/select.cc | 16 +++++++-------- passes/cmds/setundef.cc | 2 +- passes/cmds/show.cc | 2 +- passes/cmds/tee.cc | 2 +- passes/equiv/equiv_induct.cc | 2 +- passes/equiv/equiv_simple.cc | 2 +- passes/equiv/equiv_struct.cc | 2 +- passes/hierarchy/hierarchy.cc | 6 +++--- passes/memory/memory_bram.cc | 8 ++++---- passes/opt/opt_lut.cc | 4 ++-- passes/opt/pmux2shiftx.cc | 4 ++-- passes/opt/share.cc | 2 +- passes/sat/freduce.cc | 2 +- passes/sat/mutate.cc | 34 +++++++++++++++---------------- passes/sat/sat.cc | 26 +++++++++++------------ passes/sat/sim.cc | 4 ++-- passes/techmap/abc.cc | 14 ++++++------- passes/techmap/abc9.cc | 12 +++++------ passes/techmap/dff2dffe.cc | 2 +- passes/techmap/extract.cc | 10 ++++----- passes/techmap/extract_counter.cc | 2 +- passes/techmap/extract_fa.cc | 4 ++-- passes/techmap/flowmap.cc | 12 +++++------ passes/techmap/muxcover.cc | 10 ++++----- passes/techmap/nlutmap.cc | 2 +- passes/techmap/shregmap.cc | 8 ++++---- passes/techmap/techmap.cc | 2 +- passes/tests/test_abcloop.cc | 4 ++-- passes/tests/test_autotb.cc | 4 ++-- passes/tests/test_cell.cc | 4 ++-- techlibs/common/synth.cc | 2 +- techlibs/ice40/synth_ice40.cc | 2 +- techlibs/xilinx/synth_xilinx.cc | 2 +- 41 files changed, 121 insertions(+), 121 deletions(-) diff --git a/frontends/blif/blifparse.cc b/frontends/blif/blifparse.cc index 4852bb8ce..a6a07863f 100644 --- a/frontends/blif/blifparse.cc +++ b/frontends/blif/blifparse.cc @@ -103,7 +103,7 @@ void parse_blif(RTLIL::Design *design, std::istream &f, std::string dff_name, bo if (len > 0) { string num_str = wire_name.substr(i+1, len); - int num = std::stoi(num_str) & 0x0fffffff; + int num = atoi(num_str.c_str()) & 0x0fffffff; blif_maxnum = std::max(blif_maxnum, num); } } diff --git a/frontends/liberty/liberty.cc b/frontends/liberty/liberty.cc index a6a65fdd8..14de95e07 100644 --- a/frontends/liberty/liberty.cc +++ b/frontends/liberty/liberty.cc @@ -430,13 +430,13 @@ void parse_type_map(std::map> &type_map, goto next_type; if (child->id == "bit_width") - bit_width = std::stoi(child->value); + bit_width = atoi(child->value.c_str()); if (child->id == "bit_from") - bit_from = std::stoi(child->value); + bit_from = atoi(child->value.c_str()); if (child->id == "bit_to") - bit_to = std::stoi(child->value); + bit_to = atoi(child->value.c_str()); if (child->id == "downto" && (child->value == "0" || child->value == "false" || child->value == "FALSE")) upto = true; diff --git a/frontends/verific/verific.cc b/frontends/verific/verific.cc index 12c2f7ab8..06d58a44a 100644 --- a/frontends/verific/verific.cc +++ b/frontends/verific/verific.cc @@ -2244,7 +2244,7 @@ struct VerificPass : public Pass { continue; } if (args[argidx] == "-L" && argidx+1 < GetSize(args)) { - verific_sva_fsm_limit = std::stoi(args[++argidx]); + verific_sva_fsm_limit = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-n") { diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index c8bfa8da6..479a5794a 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -3921,14 +3921,14 @@ bool RTLIL::SigSpec::parse(RTLIL::SigSpec &sig, RTLIL::Module *module, std::stri sigspec_parse_split(index_tokens, indices.substr(1, indices.size()-2), ':'); if (index_tokens.size() == 1) { cover("kernel.rtlil.sigspec.parse.bit_sel"); - int a = std::stoi(index_tokens.at(0)); + int a = atoi(index_tokens.at(0).c_str()); if (a < 0 || a >= wire->width) return false; sig.append(RTLIL::SigSpec(wire, a)); } else { cover("kernel.rtlil.sigspec.parse.part_sel"); - int a = std::stoi(index_tokens.at(0)); - int b = std::stoi(index_tokens.at(1)); + int a = atoi(index_tokens.at(0).c_str()); + int b = atoi(index_tokens.at(1).c_str()); if (a > b) { int tmp = a; a = b, b = tmp; diff --git a/passes/cmds/add.cc b/passes/cmds/add.cc index 971de1d00..af6f7043d 100644 --- a/passes/cmds/add.cc +++ b/passes/cmds/add.cc @@ -130,7 +130,7 @@ struct AddPass : public Pass { if (arg == "-global_input") arg_flag_global = true; arg_name = args[++argidx]; - arg_width = std::stoi(args[++argidx]); + arg_width = atoi(args[++argidx].c_str()); continue; } break; diff --git a/passes/cmds/chformal.cc b/passes/cmds/chformal.cc index c97b204af..7e32da65f 100644 --- a/passes/cmds/chformal.cc +++ b/passes/cmds/chformal.cc @@ -106,12 +106,12 @@ struct ChformalPass : public Pass { } if (mode == 0 && args[argidx] == "-delay" && argidx+1 < args.size()) { mode = 'd'; - mode_arg = std::stoi(args[++argidx]); + mode_arg = atoi(args[++argidx].c_str()); continue; } if (mode == 0 && args[argidx] == "-skip" && argidx+1 < args.size()) { mode = 's'; - mode_arg = std::stoi(args[++argidx]); + mode_arg = atoi(args[++argidx].c_str()); continue; } if ((mode == 0 || mode == 'c') && args[argidx] == "-assert2assume") { diff --git a/passes/cmds/qwp.cc b/passes/cmds/qwp.cc index 4d53b3995..adbe89e31 100644 --- a/passes/cmds/qwp.cc +++ b/passes/cmds/qwp.cc @@ -830,7 +830,7 @@ struct QwpPass : public Pass { continue; } if (args[argidx] == "-grid" && argidx+1 < args.size()) { - config.grid = 1.0 / std::stoi(args[++argidx]); + config.grid = 1.0 / atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-dump" && argidx+1 < args.size()) { diff --git a/passes/cmds/scc.cc b/passes/cmds/scc.cc index ad924e1bf..99f4fbae8 100644 --- a/passes/cmds/scc.cc +++ b/passes/cmds/scc.cc @@ -269,11 +269,11 @@ struct SccPass : public Pass { size_t argidx; for (argidx = 1; argidx < args.size(); argidx++) { if (args[argidx] == "-max_depth" && argidx+1 < args.size()) { - maxDepth = std::stoi(args[++argidx]); + maxDepth = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-expect" && argidx+1 < args.size()) { - expect = std::stoi(args[++argidx]); + expect = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-nofeedback") { diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc index e857e655f..b5e8ef1af 100644 --- a/passes/cmds/select.cc +++ b/passes/cmds/select.cc @@ -517,7 +517,7 @@ static void select_op_expand(RTLIL::Design *design, std::string arg, char mode, size_t endpos = arg.find_first_not_of("0123456789", pos); if (endpos == std::string::npos) endpos = arg.size(); - levels = std::stoi(arg.substr(pos, endpos-pos)); + levels = atoi(arg.substr(pos, endpos-pos).c_str()); pos = endpos; } @@ -526,7 +526,7 @@ static void select_op_expand(RTLIL::Design *design, std::string arg, char mode, if (endpos == std::string::npos) endpos = arg.size(); if (int(endpos) > pos) - rem_objects = std::stoi(arg.substr(pos, endpos-pos)); + rem_objects = atoi(arg.substr(pos, endpos-pos).c_str()); pos = endpos; } @@ -823,15 +823,15 @@ static void select_stmt(RTLIL::Design *design, std::string arg) if (arg_memb.substr(0, 2) == "s:") { size_t delim = arg_memb.substr(2).find(':'); if (delim == std::string::npos) { - int width = std::stoi(arg_memb.substr(2)); + int width = atoi(arg_memb.substr(2).c_str()); for (auto &it : mod->wires_) if (it.second->width == width) sel.selected_members[mod->name].insert(it.first); } else { std::string min_str = arg_memb.substr(2, delim); std::string max_str = arg_memb.substr(2+delim+1); - int min_width = min_str.empty() ? 0 : std::stoi(min_str); - int max_width = max_str.empty() ? -1 : std::stoi(max_str); + int min_width = min_str.empty() ? 0 : atoi(min_str.c_str()); + int max_width = max_str.empty() ? -1 : atoi(max_str.c_str()); for (auto &it : mod->wires_) if (min_width <= it.second->width && (it.second->width <= max_width || max_width == -1)) sel.selected_members[mod->name].insert(it.first); @@ -1230,15 +1230,15 @@ struct SelectPass : public Pass { continue; } if (arg == "-assert-count" && argidx+1 < args.size()) { - assert_count = std::stoi(args[++argidx]); + assert_count = atoi(args[++argidx].c_str()); continue; } if (arg == "-assert-max" && argidx+1 < args.size()) { - assert_max = std::stoi(args[++argidx]); + assert_max = atoi(args[++argidx].c_str()); continue; } if (arg == "-assert-min" && argidx+1 < args.size()) { - assert_min = std::stoi(args[++argidx]); + assert_min = atoi(args[++argidx].c_str()); continue; } if (arg == "-clear") { diff --git a/passes/cmds/setundef.cc b/passes/cmds/setundef.cc index 0e3c0c853..3eedc86b8 100644 --- a/passes/cmds/setundef.cc +++ b/passes/cmds/setundef.cc @@ -210,7 +210,7 @@ struct SetundefPass : public Pass { if (args[argidx] == "-random" && !got_value && argidx+1 < args.size()) { got_value = true; worker.next_bit_mode = MODE_RANDOM; - worker.next_bit_state = std::stoi(args[++argidx]) + 1; + worker.next_bit_state = atoi(args[++argidx].c_str()) + 1; for (int i = 0; i < 10; i++) worker.next_bit(); continue; diff --git a/passes/cmds/show.cc b/passes/cmds/show.cc index 3af477bd9..cf729215f 100644 --- a/passes/cmds/show.cc +++ b/passes/cmds/show.cc @@ -740,7 +740,7 @@ struct ShowPass : public Pass { continue; } if (arg == "-colors" && argidx+1 < args.size()) { - colorSeed = std::stoi(args[++argidx]); + colorSeed = atoi(args[++argidx].c_str()); for (int i = 0; i < 100; i++) colorSeed = ShowWorker::xorshift32(colorSeed); continue; diff --git a/passes/cmds/tee.cc b/passes/cmds/tee.cc index e0a74099a..1a44bdaec 100644 --- a/passes/cmds/tee.cc +++ b/passes/cmds/tee.cc @@ -79,7 +79,7 @@ struct TeePass : public Pass { continue; } if (GetSize(args[argidx]) >= 2 && (args[argidx][0] == '-' || args[argidx][0] == '+') && args[argidx][1] >= '0' && args[argidx][1] <= '9') { - log_verbose_level += std::stoi(args[argidx]); + log_verbose_level += atoi(args[argidx].c_str()); continue; } break; diff --git a/passes/equiv/equiv_induct.cc b/passes/equiv/equiv_induct.cc index e3af16e2d..bcc68d6d2 100644 --- a/passes/equiv/equiv_induct.cc +++ b/passes/equiv/equiv_induct.cc @@ -207,7 +207,7 @@ struct EquivInductPass : public Pass { continue; } if (args[argidx] == "-seq" && argidx+1 < args.size()) { - max_seq = std::stoi(args[++argidx]); + max_seq = atoi(args[++argidx].c_str()); continue; } break; diff --git a/passes/equiv/equiv_simple.cc b/passes/equiv/equiv_simple.cc index 1f80e117d..c2fab26f2 100644 --- a/passes/equiv/equiv_simple.cc +++ b/passes/equiv/equiv_simple.cc @@ -325,7 +325,7 @@ struct EquivSimplePass : public Pass { continue; } if (args[argidx] == "-seq" && argidx+1 < args.size()) { - max_seq = std::stoi(args[++argidx]); + max_seq = atoi(args[++argidx].c_str()); continue; } break; diff --git a/passes/equiv/equiv_struct.cc b/passes/equiv/equiv_struct.cc index 0bae55802..a7973fd04 100644 --- a/passes/equiv/equiv_struct.cc +++ b/passes/equiv/equiv_struct.cc @@ -338,7 +338,7 @@ struct EquivStructPass : public Pass { continue; } if (args[argidx] == "-maxiter" && argidx+1 < args.size()) { - max_iter = std::stoi(args[++argidx]); + max_iter = atoi(args[++argidx].c_str()); continue; } break; diff --git a/passes/hierarchy/hierarchy.cc b/passes/hierarchy/hierarchy.cc index 1319225ff..fd95b94b2 100644 --- a/passes/hierarchy/hierarchy.cc +++ b/passes/hierarchy/hierarchy.cc @@ -200,8 +200,8 @@ bool expand_module(RTLIL::Design *design, RTLIL::Module *module, bool flag_check int pos_idx = pos[0]; int pos_num = pos[1]; int pos_type = pos[2]; - int idx = std::stoi(cell->type.substr(pos_idx + 1, pos_num)); - int num = std::stoi(cell->type.substr(pos_num + 1, pos_type)); + int idx = atoi(cell->type.substr(pos_idx + 1, pos_num).c_str()); + int num = atoi(cell->type.substr(pos_num + 1, pos_type).c_str()); array_cells[cell] = std::pair(idx, num); cell->type = cell->type.substr(pos_type + 1); } @@ -423,7 +423,7 @@ bool expand_module(RTLIL::Design *design, RTLIL::Module *module, bool flag_check int conn_size = conn.second.size(); RTLIL::IdString portname = conn.first; if (portname.begins_with("$")) { - int port_id = std::stoi(portname.substr(1)); + int port_id = atoi(portname.substr(1).c_str()); for (auto &wire_it : mod->wires_) if (wire_it.second->port_id == port_id) { portname = wire_it.first; diff --git a/passes/memory/memory_bram.cc b/passes/memory/memory_bram.cc index 2913400c5..aa8f94149 100644 --- a/passes/memory/memory_bram.cc +++ b/passes/memory/memory_bram.cc @@ -176,7 +176,7 @@ struct rules_t bool parse_single_int(const char *stmt, int &value) { if (GetSize(tokens) == 2 && tokens[0] == stmt) { - value = std::stoi(tokens[1]); + value = atoi(tokens[1].c_str()); return true; } return false; @@ -187,7 +187,7 @@ struct rules_t if (GetSize(tokens) >= 2 && tokens[0] == stmt) { value.resize(GetSize(tokens)-1); for (int i = 1; i < GetSize(tokens); i++) - value[i-1] = std::stoi(tokens[i]); + value[i-1] = atoi(tokens[i].c_str()); return true; } return false; @@ -297,12 +297,12 @@ struct rules_t } if (GetSize(tokens) == 3 && tokens[0] == "min") { - data.min_limits[tokens[1]] = std::stoi(tokens[2]); + data.min_limits[tokens[1]] = atoi(tokens[2].c_str()); continue; } if (GetSize(tokens) == 3 && tokens[0] == "max") { - data.max_limits[tokens[1]] = std::stoi(tokens[2]); + data.max_limits[tokens[1]] = atoi(tokens[2].c_str()); continue; } diff --git a/passes/opt/opt_lut.cc b/passes/opt/opt_lut.cc index 6d97c0bb4..587ef878a 100644 --- a/passes/opt/opt_lut.cc +++ b/passes/opt/opt_lut.cc @@ -555,14 +555,14 @@ struct OptLutPass : public Pass { if (conn_tokens.size() != 2) log_cmd_error("Invalid format of -dlogic signal mapping.\n"); IdString logic_port = "\\" + conn_tokens[0]; - int lut_input = std::stoi(conn_tokens[1]); + int lut_input = atoi(conn_tokens[1].c_str()); dlogic[type][lut_input] = logic_port; } continue; } if (args[argidx] == "-limit" && argidx + 1 < args.size()) { - limit = std::stoi(args[++argidx]); + limit = atoi(args[++argidx].c_str()); continue; } break; diff --git a/passes/opt/pmux2shiftx.cc b/passes/opt/pmux2shiftx.cc index e571ed3c6..65d8b8f32 100644 --- a/passes/opt/pmux2shiftx.cc +++ b/passes/opt/pmux2shiftx.cc @@ -240,11 +240,11 @@ struct Pmux2ShiftxPass : public Pass { size_t argidx; for (argidx = 1; argidx < args.size(); argidx++) { if (args[argidx] == "-min_density" && argidx+1 < args.size()) { - min_density = std::stoi(args[++argidx]); + min_density = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-min_choices" && argidx+1 < args.size()) { - min_choices = std::stoi(args[++argidx]); + min_choices = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-onehot" && argidx+1 < args.size() && args[argidx+1] == "ignore") { diff --git a/passes/opt/share.cc b/passes/opt/share.cc index ea5bf8d33..7f66f749f 100644 --- a/passes/opt/share.cc +++ b/passes/opt/share.cc @@ -1521,7 +1521,7 @@ struct SharePass : public Pass { continue; } if (args[argidx] == "-limit" && argidx+1 < args.size()) { - config.limit = std::stoi(args[++argidx]); + config.limit = atoi(args[++argidx].c_str()); continue; } break; diff --git a/passes/sat/freduce.cc b/passes/sat/freduce.cc index 781b5e3cc..f29631639 100644 --- a/passes/sat/freduce.cc +++ b/passes/sat/freduce.cc @@ -816,7 +816,7 @@ struct FreducePass : public Pass { continue; } if (args[argidx] == "-stop" && argidx+1 < args.size()) { - reduce_stop_at = std::stoi(args[++argidx]); + reduce_stop_at = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-dump" && argidx+1 < args.size()) { diff --git a/passes/sat/mutate.cc b/passes/sat/mutate.cc index a4b2f5eb5..b53bbfeb2 100644 --- a/passes/sat/mutate.cc +++ b/passes/sat/mutate.cc @@ -803,7 +803,7 @@ struct MutatePass : public Pass { for (argidx = 1; argidx < args.size(); argidx++) { if (args[argidx] == "-list" && argidx+1 < args.size()) { - N = std::stoi(args[++argidx]); + N = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-o" && argidx+1 < args.size()) { @@ -815,7 +815,7 @@ struct MutatePass : public Pass { continue; } if (args[argidx] == "-seed" && argidx+1 < args.size()) { - opts.seed = std::stoi(args[++argidx]); + opts.seed = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-none") { @@ -828,8 +828,8 @@ struct MutatePass : public Pass { } if (args[argidx] == "-ctrl" && argidx+3 < args.size()) { opts.ctrl_name = RTLIL::escape_id(args[++argidx]); - opts.ctrl_width = std::stoi(args[++argidx]); - opts.ctrl_value = std::stoi(args[++argidx]); + opts.ctrl_width = atoi(args[++argidx].c_str()); + opts.ctrl_value = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-module" && argidx+1 < args.size()) { @@ -845,11 +845,11 @@ struct MutatePass : public Pass { continue; } if (args[argidx] == "-portbit" && argidx+1 < args.size()) { - opts.portbit = std::stoi(args[++argidx]); + opts.portbit = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-ctrlbit" && argidx+1 < args.size()) { - opts.ctrlbit = std::stoi(args[++argidx]); + opts.ctrlbit = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-wire" && argidx+1 < args.size()) { @@ -857,7 +857,7 @@ struct MutatePass : public Pass { continue; } if (args[argidx] == "-wirebit" && argidx+1 < args.size()) { - opts.wirebit = std::stoi(args[++argidx]); + opts.wirebit = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-src" && argidx+1 < args.size()) { @@ -866,52 +866,52 @@ struct MutatePass : public Pass { } if (args[argidx] == "-cfg" && argidx+2 < args.size()) { if (args[argidx+1] == "pick_cover_prcnt") { - opts.pick_cover_prcnt = std::stoi(args[argidx+2]); + opts.pick_cover_prcnt = atoi(args[argidx+2].c_str()); argidx += 2; continue; } if (args[argidx+1] == "weight_cover") { - opts.weight_cover = std::stoi(args[argidx+2]); + opts.weight_cover = atoi(args[argidx+2].c_str()); argidx += 2; continue; } if (args[argidx+1] == "weight_pq_w") { - opts.weight_pq_w = std::stoi(args[argidx+2]); + opts.weight_pq_w = atoi(args[argidx+2].c_str()); argidx += 2; continue; } if (args[argidx+1] == "weight_pq_b") { - opts.weight_pq_b = std::stoi(args[argidx+2]); + opts.weight_pq_b = atoi(args[argidx+2].c_str()); argidx += 2; continue; } if (args[argidx+1] == "weight_pq_c") { - opts.weight_pq_c = std::stoi(args[argidx+2]); + opts.weight_pq_c = atoi(args[argidx+2].c_str()); argidx += 2; continue; } if (args[argidx+1] == "weight_pq_s") { - opts.weight_pq_s = std::stoi(args[argidx+2]); + opts.weight_pq_s = atoi(args[argidx+2].c_str()); argidx += 2; continue; } if (args[argidx+1] == "weight_pq_mw") { - opts.weight_pq_mw = std::stoi(args[argidx+2]); + opts.weight_pq_mw = atoi(args[argidx+2].c_str()); argidx += 2; continue; } if (args[argidx+1] == "weight_pq_mb") { - opts.weight_pq_mb = std::stoi(args[argidx+2]); + opts.weight_pq_mb = atoi(args[argidx+2].c_str()); argidx += 2; continue; } if (args[argidx+1] == "weight_pq_mc") { - opts.weight_pq_mc = std::stoi(args[argidx+2]); + opts.weight_pq_mc = atoi(args[argidx+2].c_str()); argidx += 2; continue; } if (args[argidx+1] == "weight_pq_ms") { - opts.weight_pq_ms = std::stoi(args[argidx+2]); + opts.weight_pq_ms = atoi(args[argidx+2].c_str()); argidx += 2; continue; } diff --git a/passes/sat/sat.cc b/passes/sat/sat.cc index 847ca0e1d..80498f5b4 100644 --- a/passes/sat/sat.cc +++ b/passes/sat/sat.cc @@ -1102,23 +1102,23 @@ struct SatPass : public Pass { continue; } if (args[argidx] == "-timeout" && argidx+1 < args.size()) { - timeout = std::stoi(args[++argidx]); + timeout = std::atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-max" && argidx+1 < args.size()) { - loopcount = std::stoi(args[++argidx]); + loopcount = std::atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-maxsteps" && argidx+1 < args.size()) { - maxsteps = std::stoi(args[++argidx]); + maxsteps = std::atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-initsteps" && argidx+1 < args.size()) { - initsteps = std::stoi(args[++argidx]); + initsteps = std::atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-stepsize" && argidx+1 < args.size()) { - stepsize = max(1, std::stoi(args[++argidx])); + stepsize = max(1, std::atoi(args[++argidx].c_str())); continue; } if (args[argidx] == "-ignore_div_by_zero") { @@ -1185,7 +1185,7 @@ struct SatPass : public Pass { continue; } if (args[argidx] == "-tempinduct-skip" && argidx+1 < args.size()) { - tempinduct_skip = std::stoi(args[++argidx]); + tempinduct_skip = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-prove" && argidx+2 < args.size()) { @@ -1206,39 +1206,39 @@ struct SatPass : public Pass { continue; } if (args[argidx] == "-prove-skip" && argidx+1 < args.size()) { - prove_skip = std::stoi(args[++argidx]); + prove_skip = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-seq" && argidx+1 < args.size()) { - seq_len = std::stoi(args[++argidx]); + seq_len = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-set-at" && argidx+3 < args.size()) { - int timestep = std::stoi(args[++argidx]); + int timestep = atoi(args[++argidx].c_str()); std::string lhs = args[++argidx]; std::string rhs = args[++argidx]; sets_at[timestep].push_back(std::pair(lhs, rhs)); continue; } if (args[argidx] == "-unset-at" && argidx+2 < args.size()) { - int timestep = std::stoi(args[++argidx]); + int timestep = atoi(args[++argidx].c_str()); unsets_at[timestep].push_back(args[++argidx]); continue; } if (args[argidx] == "-set-def-at" && argidx+2 < args.size()) { - int timestep = std::stoi(args[++argidx]); + int timestep = atoi(args[++argidx].c_str()); sets_def_at[timestep].push_back(args[++argidx]); enable_undef = true; continue; } if (args[argidx] == "-set-any-undef-at" && argidx+2 < args.size()) { - int timestep = std::stoi(args[++argidx]); + int timestep = atoi(args[++argidx].c_str()); sets_any_undef_at[timestep].push_back(args[++argidx]); enable_undef = true; continue; } if (args[argidx] == "-set-all-undef-at" && argidx+2 < args.size()) { - int timestep = std::stoi(args[++argidx]); + int timestep = atoi(args[++argidx].c_str()); sets_all_undef_at[timestep].push_back(args[++argidx]); enable_undef = true; continue; diff --git a/passes/sat/sim.cc b/passes/sat/sim.cc index cb102e8bf..4c3022c70 100644 --- a/passes/sat/sim.cc +++ b/passes/sat/sim.cc @@ -803,11 +803,11 @@ struct SimPass : public Pass { continue; } if (args[argidx] == "-n" && argidx+1 < args.size()) { - numcycles = std::stoi(args[++argidx]); + numcycles = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-rstlen" && argidx+1 < args.size()) { - worker.rstlen = std::stoi(args[++argidx]); + worker.rstlen = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-clock" && argidx+1 < args.size()) { diff --git a/passes/techmap/abc.cc b/passes/techmap/abc.cc index 5509c8c12..76634cb31 100644 --- a/passes/techmap/abc.cc +++ b/passes/techmap/abc.cc @@ -343,7 +343,7 @@ std::string remap_name(RTLIL::IdString abc_name, RTLIL::Wire **orig_wire = nullp abc_sname.erase(0, 5); if (std::isdigit(abc_sname.at(0))) { - int sid = std::stoi(abc_sname); + int sid = std::atoi(abc_sname.c_str()); size_t postfix_start = abc_sname.find_first_not_of("0123456789"); std::string postfix = postfix_start != std::string::npos ? abc_sname.substr(postfix_start) : ""; @@ -1564,10 +1564,10 @@ struct AbcPass : public Pass { size_t pos = arg.find_first_of(':'); int lut_mode = 0, lut_mode2 = 0; if (pos != string::npos) { - lut_mode = std::stoi(arg.substr(0, pos)); - lut_mode2 = std::stoi(arg.substr(pos+1)); + lut_mode = std::atoi(arg.substr(0, pos).c_str()); + lut_mode2 = std::atoi(arg.substr(pos+1).c_str()); } else { - lut_mode = std::stoi(arg); + lut_mode = std::atoi(arg.c_str()); lut_mode2 = lut_mode; } lut_costs.clear(); @@ -1584,10 +1584,10 @@ struct AbcPass : public Pass { if (GetSize(parts) == 0 && !lut_costs.empty()) lut_costs.push_back(lut_costs.back()); else if (GetSize(parts) == 1) - lut_costs.push_back(std::stoi(parts.at(0))); + lut_costs.push_back(atoi(parts.at(0).c_str())); else if (GetSize(parts) == 2) - while (GetSize(lut_costs) < std::stoi(parts.at(0))) - lut_costs.push_back(std::stoi(parts.at(1))); + while (GetSize(lut_costs) < std::atoi(parts.at(0).c_str())) + lut_costs.push_back(atoi(parts.at(1).c_str())); else log_cmd_error("Invalid -luts syntax.\n"); } diff --git a/passes/techmap/abc9.cc b/passes/techmap/abc9.cc index 36e3b4e65..34919cf07 100644 --- a/passes/techmap/abc9.cc +++ b/passes/techmap/abc9.cc @@ -999,8 +999,8 @@ struct Abc9Pass : public Pass { size_t pos = arg.find_first_of(':'); int lut_mode = 0, lut_mode2 = 0; if (pos != string::npos) { - lut_mode = std::stoi(arg.substr(0, pos)); - lut_mode2 = std::stoi(arg.substr(pos+1)); + lut_mode = atoi(arg.substr(0, pos).c_str()); + lut_mode2 = atoi(arg.substr(pos+1).c_str()); } else { pos = arg.find_first_of('.'); if (pos != string::npos) { @@ -1010,7 +1010,7 @@ struct Abc9Pass : public Pass { lut_file = std::string(pwd) + "/" + lut_file; } else { - lut_mode = std::stoi(arg); + lut_mode = atoi(arg.c_str()); lut_mode2 = lut_mode; } } @@ -1028,10 +1028,10 @@ struct Abc9Pass : public Pass { if (GetSize(parts) == 0 && !lut_costs.empty()) lut_costs.push_back(lut_costs.back()); else if (GetSize(parts) == 1) - lut_costs.push_back(std::stoi(parts.at(0))); + lut_costs.push_back(atoi(parts.at(0).c_str())); else if (GetSize(parts) == 2) - while (GetSize(lut_costs) < std::stoi(parts.at(0))) - lut_costs.push_back(std::stoi(parts.at(1))); + while (GetSize(lut_costs) < atoi(parts.at(0).c_str())) + lut_costs.push_back(atoi(parts.at(1).c_str())); else log_cmd_error("Invalid -luts syntax.\n"); } diff --git a/passes/techmap/dff2dffe.cc b/passes/techmap/dff2dffe.cc index 44bc14628..8e947b4dc 100644 --- a/passes/techmap/dff2dffe.cc +++ b/passes/techmap/dff2dffe.cc @@ -304,7 +304,7 @@ struct Dff2dffePass : public Pass { } if (args[argidx] == "-unmap-mince" && argidx + 1 < args.size()) { unmap_mode = true; - min_ce_use = std::stoi(args[++argidx]); + min_ce_use = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-direct" && argidx + 2 < args.size()) { diff --git a/passes/techmap/extract.cc b/passes/techmap/extract.cc index cf9743806..fff90f13c 100644 --- a/passes/techmap/extract.cc +++ b/passes/techmap/extract.cc @@ -476,16 +476,16 @@ struct ExtractPass : public Pass { continue; } if (args[argidx] == "-mine_cells_span" && argidx+2 < args.size()) { - mine_cells_min = std::stoi(args[++argidx]); - mine_cells_max = std::stoi(args[++argidx]); + mine_cells_min = atoi(args[++argidx].c_str()); + mine_cells_max = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-mine_min_freq" && argidx+1 < args.size()) { - mine_min_freq = std::stoi(args[++argidx]); + mine_min_freq = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-mine_limit_matches_per_module" && argidx+1 < args.size()) { - mine_limit_mod = std::stoi(args[++argidx]); + mine_limit_mod = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-mine_split" && argidx+2 < args.size()) { @@ -494,7 +494,7 @@ struct ExtractPass : public Pass { continue; } if (args[argidx] == "-mine_max_fanout" && argidx+1 < args.size()) { - mine_max_fanout = std::stoi(args[++argidx]); + mine_max_fanout = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-verbose") { diff --git a/passes/techmap/extract_counter.cc b/passes/techmap/extract_counter.cc index da56e087b..a8d0bc834 100644 --- a/passes/techmap/extract_counter.cc +++ b/passes/techmap/extract_counter.cc @@ -613,7 +613,7 @@ struct ExtractCounterPass : public Pass { if (args[argidx] == "-maxwidth" && argidx+1 < args.size()) { - maxwidth = std::stoi(args[++argidx]); + maxwidth = atoi(args[++argidx].c_str()); continue; } } diff --git a/passes/techmap/extract_fa.cc b/passes/techmap/extract_fa.cc index 0b5b6a111..b541ceb6b 100644 --- a/passes/techmap/extract_fa.cc +++ b/passes/techmap/extract_fa.cc @@ -580,11 +580,11 @@ struct ExtractFaPass : public Pass { continue; } if (args[argidx] == "-d" && argidx+2 < args.size()) { - config.maxdepth = std::stoi(args[++argidx]); + config.maxdepth = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-b" && argidx+2 < args.size()) { - config.maxbreadth = std::stoi(args[++argidx]); + config.maxbreadth = atoi(args[++argidx].c_str()); continue; } break; diff --git a/passes/techmap/flowmap.cc b/passes/techmap/flowmap.cc index 3e66fcacc..96d0df5f8 100644 --- a/passes/techmap/flowmap.cc +++ b/passes/techmap/flowmap.cc @@ -1525,12 +1525,12 @@ struct FlowmapPass : public Pass { { if (args[argidx] == "-maxlut" && argidx + 1 < args.size()) { - order = std::stoi(args[++argidx]); + order = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-minlut" && argidx + 1 < args.size()) { - minlut = std::stoi(args[++argidx]); + minlut = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-cells" && argidx + 1 < args.size()) @@ -1545,23 +1545,23 @@ struct FlowmapPass : public Pass { } if (args[argidx] == "-r-alpha" && argidx + 1 < args.size()) { - r_alpha = std::stoi(args[++argidx]); + r_alpha = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-r-beta" && argidx + 1 < args.size()) { - r_beta = std::stoi(args[++argidx]); + r_beta = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-r-gamma" && argidx + 1 < args.size()) { - r_gamma = std::stoi(args[++argidx]); + r_gamma = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-optarea" && argidx + 1 < args.size()) { relax = true; - optarea = std::stoi(args[++argidx]); + optarea = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-debug") diff --git a/passes/techmap/muxcover.cc b/passes/techmap/muxcover.cc index d53378a29..45987392e 100644 --- a/passes/techmap/muxcover.cc +++ b/passes/techmap/muxcover.cc @@ -676,14 +676,14 @@ struct MuxcoverPass : public Pass { { const auto &arg = args[argidx]; if (arg.size() >= 6 && arg.substr(0,6) == "-mux2=") { - cost_mux2 = std::stoi(arg.substr(6)); + cost_mux2 = atoi(arg.substr(6).c_str()); continue; } if (arg.size() >= 5 && arg.substr(0,5) == "-mux4") { use_mux4 = true; if (arg.size() > 5) { if (arg[5] != '=') break; - cost_mux4 = std::stoi(arg.substr(6)); + cost_mux4 = atoi(arg.substr(6).c_str()); } continue; } @@ -691,7 +691,7 @@ struct MuxcoverPass : public Pass { use_mux8 = true; if (arg.size() > 5) { if (arg[5] != '=') break; - cost_mux8 = std::stoi(arg.substr(6)); + cost_mux8 = atoi(arg.substr(6).c_str()); } continue; } @@ -699,12 +699,12 @@ struct MuxcoverPass : public Pass { use_mux16 = true; if (arg.size() > 6) { if (arg[6] != '=') break; - cost_mux16 = std::stoi(arg.substr(7)); + cost_mux16 = atoi(arg.substr(7).c_str()); } continue; } if (arg.size() >= 6 && arg.substr(0,6) == "-dmux=") { - cost_dmux = std::stoi(arg.substr(6)); + cost_dmux = atoi(arg.substr(6).c_str()); continue; } if (arg == "-nodecode") { diff --git a/passes/techmap/nlutmap.cc b/passes/techmap/nlutmap.cc index 9ac39ed05..cc765d89c 100644 --- a/passes/techmap/nlutmap.cc +++ b/passes/techmap/nlutmap.cc @@ -163,7 +163,7 @@ struct NlutmapPass : public Pass { vector tokens = split_tokens(args[++argidx], ","); config.luts.clear(); for (auto &token : tokens) - config.luts.push_back(std::stoi(token)); + config.luts.push_back(atoi(token.c_str())); continue; } if (args[argidx] == "-assert") { diff --git a/passes/techmap/shregmap.cc b/passes/techmap/shregmap.cc index 06eb7b793..004ab1eb9 100644 --- a/passes/techmap/shregmap.cc +++ b/passes/techmap/shregmap.cc @@ -655,19 +655,19 @@ struct ShregmapPass : public Pass { continue; } if (args[argidx] == "-minlen" && argidx+1 < args.size()) { - opts.minlen = std::stoi(args[++argidx]); + opts.minlen = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-maxlen" && argidx+1 < args.size()) { - opts.maxlen = std::stoi(args[++argidx]); + opts.maxlen = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-keep_before" && argidx+1 < args.size()) { - opts.keep_before = std::stoi(args[++argidx]); + opts.keep_before = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-keep_after" && argidx+1 < args.size()) { - opts.keep_after = std::stoi(args[++argidx]); + opts.keep_after = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-tech" && argidx+1 < args.size() && opts.tech == nullptr) { diff --git a/passes/techmap/techmap.cc b/passes/techmap/techmap.cc index d10420ae8..ceb053825 100644 --- a/passes/techmap/techmap.cc +++ b/passes/techmap/techmap.cc @@ -1072,7 +1072,7 @@ struct TechmapPass : public Pass { continue; } if (args[argidx] == "-max_iter" && argidx+1 < args.size()) { - max_iter = std::stoi(args[++argidx]); + max_iter = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-D" && argidx+1 < args.size()) { diff --git a/passes/tests/test_abcloop.cc b/passes/tests/test_abcloop.cc index d5a167db1..5d5466afe 100644 --- a/passes/tests/test_abcloop.cc +++ b/passes/tests/test_abcloop.cc @@ -268,11 +268,11 @@ struct TestAbcloopPass : public Pass { for (argidx = 1; argidx < GetSize(args); argidx++) { if (args[argidx] == "-n" && argidx+1 < GetSize(args)) { - num_iter = std::stoi(args[++argidx]); + num_iter = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-s" && argidx+1 < GetSize(args)) { - xorshift32_state = std::stoi(args[++argidx]); + xorshift32_state = atoi(args[++argidx].c_str()); continue; } break; diff --git a/passes/tests/test_autotb.cc b/passes/tests/test_autotb.cc index 198007b87..bfb1d6642 100644 --- a/passes/tests/test_autotb.cc +++ b/passes/tests/test_autotb.cc @@ -360,11 +360,11 @@ struct TestAutotbBackend : public Backend { for (argidx = 1; argidx < GetSize(args); argidx++) { if (args[argidx] == "-n" && argidx+1 < GetSize(args)) { - num_iter = std::stoi(args[++argidx]); + num_iter = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-seed" && argidx+1 < GetSize(args)) { - seed = std::stoi(args[++argidx]); + seed = atoi(args[++argidx].c_str()); continue; } break; diff --git a/passes/tests/test_cell.cc b/passes/tests/test_cell.cc index 7c58ec158..e360b5edb 100644 --- a/passes/tests/test_cell.cc +++ b/passes/tests/test_cell.cc @@ -730,11 +730,11 @@ struct TestCellPass : public Pass { for (argidx = 1; argidx < GetSize(args); argidx++) { if (args[argidx] == "-n" && argidx+1 < GetSize(args)) { - num_iter = std::stoi(args[++argidx]); + num_iter = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-s" && argidx+1 < GetSize(args)) { - xorshift32_state = std::stoi(args[++argidx]); + xorshift32_state = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-map" && argidx+1 < GetSize(args)) { diff --git a/techlibs/common/synth.cc b/techlibs/common/synth.cc index 432ab3217..555de9fba 100644 --- a/techlibs/common/synth.cc +++ b/techlibs/common/synth.cc @@ -140,7 +140,7 @@ struct SynthPass : public ScriptPass continue; } if (args[argidx] == "-lut") { - lut = std::stoi(args[++argidx]); + lut = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-nofsm") { diff --git a/techlibs/ice40/synth_ice40.cc b/techlibs/ice40/synth_ice40.cc index be60a0071..dc04eed67 100644 --- a/techlibs/ice40/synth_ice40.cc +++ b/techlibs/ice40/synth_ice40.cc @@ -183,7 +183,7 @@ struct SynthIce40Pass : public ScriptPass continue; } if (args[argidx] == "-dffe_min_ce_use" && argidx+1 < args.size()) { - min_ce_use = std::stoi(args[++argidx]); + min_ce_use = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-nobram") { diff --git a/techlibs/xilinx/synth_xilinx.cc b/techlibs/xilinx/synth_xilinx.cc index b672a0d4f..d143c6823 100644 --- a/techlibs/xilinx/synth_xilinx.cc +++ b/techlibs/xilinx/synth_xilinx.cc @@ -195,7 +195,7 @@ struct SynthXilinxPass : public ScriptPass continue; } if (args[argidx] == "-widemux" && argidx+1 < args.size()) { - widemux = std::stoi(args[++argidx]); + widemux = atoi(args[++argidx].c_str()); continue; } if (args[argidx] == "-abc9") { -- 2.30.2