Use std::stoi instead of atoi(<str>.c_str())
authorEddie Hung <eddie@fpgeh.com>
Tue, 6 Aug 2019 23:45:48 +0000 (16:45 -0700)
committerEddie Hung <eddie@fpgeh.com>
Tue, 6 Aug 2019 23:45:48 +0000 (16:45 -0700)
36 files changed:
frontends/blif/blifparse.cc
frontends/liberty/liberty.cc
frontends/verific/verific.cc
kernel/rtlil.cc
passes/cmds/add.cc
passes/cmds/chformal.cc
passes/cmds/qwp.cc
passes/cmds/scc.cc
passes/cmds/select.cc
passes/cmds/setundef.cc
passes/cmds/show.cc
passes/cmds/tee.cc
passes/equiv/equiv_induct.cc
passes/equiv/equiv_simple.cc
passes/equiv/equiv_struct.cc
passes/memory/memory_bram.cc
passes/opt/opt_lut.cc
passes/opt/pmux2shiftx.cc
passes/opt/share.cc
passes/sat/freduce.cc
passes/sat/mutate.cc
passes/sat/sat.cc
passes/sat/sim.cc
passes/techmap/abc.cc
passes/techmap/abc9.cc
passes/techmap/extract.cc
passes/techmap/extract_counter.cc
passes/techmap/extract_fa.cc
passes/techmap/flowmap.cc
passes/techmap/nlutmap.cc
passes/techmap/shregmap.cc
passes/techmap/techmap.cc
passes/tests/test_abcloop.cc
passes/tests/test_autotb.cc
passes/tests/test_cell.cc
techlibs/common/synth.cc

index a6a07863fae8bfcbdc6e3948e8bf6f40ec01eb60..4852bb8cebad173e962ee7bbdbec0e8b8da569e3 100644 (file)
@@ -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 = atoi(num_str.c_str()) & 0x0fffffff;
+                                       int num = std::stoi(num_str) & 0x0fffffff;
                                        blif_maxnum = std::max(blif_maxnum, num);
                                }
                        }
index 14de95e07cbca778e4b5c87f2494d7fba75527d3..a6a65fdd877785c07041d2ccea035304fe0f7d2a 100644 (file)
@@ -430,13 +430,13 @@ void parse_type_map(std::map<std::string, std::tuple<int, int, bool>> &type_map,
                                goto next_type;
 
                        if (child->id == "bit_width")
-                               bit_width = atoi(child->value.c_str());
+                               bit_width = std::stoi(child->value);
 
                        if (child->id == "bit_from")
-                               bit_from = atoi(child->value.c_str());
+                               bit_from = std::stoi(child->value);
 
                        if (child->id == "bit_to")
-                               bit_to = atoi(child->value.c_str());
+                               bit_to = std::stoi(child->value);
 
                        if (child->id == "downto" && (child->value == "0" || child->value == "false" || child->value == "FALSE"))
                                upto = true;
index 06d58a44ab46ad8057d0f9fc478296f9355d04b9..12c2f7ab8c18b30610b6517fb5dbe3cd48ab56e5 100644 (file)
@@ -2244,7 +2244,7 @@ struct VerificPass : public Pass {
                                        continue;
                                }
                                if (args[argidx] == "-L" && argidx+1 < GetSize(args)) {
-                                       verific_sva_fsm_limit = atoi(args[++argidx].c_str());
+                                       verific_sva_fsm_limit = std::stoi(args[++argidx]);
                                        continue;
                                }
                                if (args[argidx] == "-n") {
index e770d4b4b540927253e9637c573e5f78e07c2c40..0c7216520c76b640d920f617341e557f24c9bb2c 100644 (file)
@@ -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 = atoi(index_tokens.at(0).c_str());
+                               int a = std::stoi(index_tokens.at(0));
                                if (a < 0 || a >= wire->width)
                                        return false;
                                sig.append(RTLIL::SigSpec(wire, a));
                        } else {
                                cover("kernel.rtlil.sigspec.parse.part_sel");
-                               int a = atoi(index_tokens.at(0).c_str());
-                               int b = atoi(index_tokens.at(1).c_str());
+                               int a = std::stoi(index_tokens.at(0));
+                               int b = std::stoi(index_tokens.at(1));
                                if (a > b) {
                                        int tmp = a;
                                        a = b, b = tmp;
index af6f7043d38b4a478d23c06245a478501460d997..971de1d00e77ee7a1d42b7cf8196fd4325cf8fcf 100644 (file)
@@ -130,7 +130,7 @@ struct AddPass : public Pass {
                                if (arg == "-global_input")
                                        arg_flag_global = true;
                                arg_name = args[++argidx];
-                               arg_width = atoi(args[++argidx].c_str());
+                               arg_width = std::stoi(args[++argidx]);
                                continue;
                        }
                        break;
index 7e32da65f857ad14560c85b24c69a46e410285b0..c97b204af23d8dd83991d5a5f8c5175890b9fd5a 100644 (file)
@@ -106,12 +106,12 @@ struct ChformalPass : public Pass {
                        }
                        if (mode == 0 && args[argidx] == "-delay" && argidx+1 < args.size()) {
                                mode = 'd';
-                               mode_arg = atoi(args[++argidx].c_str());
+                               mode_arg = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (mode == 0 && args[argidx] == "-skip" && argidx+1 < args.size()) {
                                mode = 's';
-                               mode_arg = atoi(args[++argidx].c_str());
+                               mode_arg = std::stoi(args[++argidx]);
                                continue;
                        }
                        if ((mode == 0 || mode == 'c') && args[argidx] == "-assert2assume") {
index adbe89e315f3c97a969f7ec5d3e46e3c7821fd95..4d53b3995ac829a9352f324895674b62dea7f5ea 100644 (file)
@@ -830,7 +830,7 @@ struct QwpPass : public Pass {
                                continue;
                        }
                        if (args[argidx] == "-grid" && argidx+1 < args.size()) {
-                               config.grid = 1.0 / atoi(args[++argidx].c_str());
+                               config.grid = 1.0 / std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-dump" && argidx+1 < args.size()) {
index 99f4fbae8799ff5c19c1b99d94154ab35c95d260..ad924e1bfc446309c9639c89d27335a47a2823d2 100644 (file)
@@ -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 = atoi(args[++argidx].c_str());
+                               maxDepth = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-expect" && argidx+1 < args.size()) {
-                               expect = atoi(args[++argidx].c_str());
+                               expect = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-nofeedback") {
index b5e8ef1afc02bdacd3932aaa6820f52237b97d39..e857e655f46a70aaac19deb1ddd3be89a392bfe5 100644 (file)
@@ -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 = atoi(arg.substr(pos, endpos-pos).c_str());
+               levels = std::stoi(arg.substr(pos, endpos-pos));
                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 = atoi(arg.substr(pos, endpos-pos).c_str());
+                       rem_objects = std::stoi(arg.substr(pos, endpos-pos));
                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 = atoi(arg_memb.substr(2).c_str());
+                               int width = std::stoi(arg_memb.substr(2));
                                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 : atoi(min_str.c_str());
-                               int max_width = max_str.empty() ? -1 : atoi(max_str.c_str());
+                               int min_width = min_str.empty() ? 0 : std::stoi(min_str);
+                               int max_width = max_str.empty() ? -1 : std::stoi(max_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 = atoi(args[++argidx].c_str());
+                               assert_count = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (arg == "-assert-max" && argidx+1 < args.size()) {
-                               assert_max = atoi(args[++argidx].c_str());
+                               assert_max = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (arg == "-assert-min" && argidx+1 < args.size()) {
-                               assert_min = atoi(args[++argidx].c_str());
+                               assert_min = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (arg == "-clear") {
index 3eedc86b8719f2040d37fe501567cbb0b920184c..0e3c0c853b42863e95cd875fa5943e79f3f5f7e4 100644 (file)
@@ -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 = atoi(args[++argidx].c_str()) + 1;
+                               worker.next_bit_state = std::stoi(args[++argidx]) + 1;
                                for (int i = 0; i < 10; i++)
                                        worker.next_bit();
                                continue;
index cf729215fdb0a3caf8f5ffdaccc3a87d38c3d4b5..3af477bd9d58527a6fce69a6ab126bdf7e60170e 100644 (file)
@@ -740,7 +740,7 @@ struct ShowPass : public Pass {
                                continue;
                        }
                        if (arg == "-colors" && argidx+1 < args.size()) {
-                               colorSeed = atoi(args[++argidx].c_str());
+                               colorSeed = std::stoi(args[++argidx]);
                                for (int i = 0; i < 100; i++)
                                        colorSeed = ShowWorker::xorshift32(colorSeed);
                                continue;
index 1a44bdaecbdc08bbc3a1973a79337026057ab9e4..e0a74099a90c595d6533cce49374d96a51d40371 100644 (file)
@@ -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 += atoi(args[argidx].c_str());
+                               log_verbose_level += std::stoi(args[argidx]);
                                continue;
                        }
                        break;
index bcc68d6d2ce4e1aa6d70268b080a93c597de1861..e3af16e2de2b6fa8dc532aa26de025348ce1f737 100644 (file)
@@ -207,7 +207,7 @@ struct EquivInductPass : public Pass {
                                continue;
                        }
                        if (args[argidx] == "-seq" && argidx+1 < args.size()) {
-                               max_seq = atoi(args[++argidx].c_str());
+                               max_seq = std::stoi(args[++argidx]);
                                continue;
                        }
                        break;
index c2fab26f2bc411c62c03572a1fdd601c9de76554..1f80e117d6119b7a8768c8b81b7adf419328bee6 100644 (file)
@@ -325,7 +325,7 @@ struct EquivSimplePass : public Pass {
                                continue;
                        }
                        if (args[argidx] == "-seq" && argidx+1 < args.size()) {
-                               max_seq = atoi(args[++argidx].c_str());
+                               max_seq = std::stoi(args[++argidx]);
                                continue;
                        }
                        break;
index a7973fd04e4adb2c5331e9171fa7802f400730e4..0bae558025403d527642d34a1264049299444336 100644 (file)
@@ -338,7 +338,7 @@ struct EquivStructPass : public Pass {
                                continue;
                        }
                        if (args[argidx] == "-maxiter" && argidx+1 < args.size()) {
-                               max_iter = atoi(args[++argidx].c_str());
+                               max_iter = std::stoi(args[++argidx]);
                                continue;
                        }
                        break;
index aa8f9414976ab07bdb727c5ffde5e28fd4a1eaf0..2913400c5bb0acf32279714f772f6354fed6a32e 100644 (file)
@@ -176,7 +176,7 @@ struct rules_t
        bool parse_single_int(const char *stmt, int &value)
        {
                if (GetSize(tokens) == 2 && tokens[0] == stmt) {
-                       value = atoi(tokens[1].c_str());
+                       value = std::stoi(tokens[1]);
                        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] = atoi(tokens[i].c_str());
+                               value[i-1] = std::stoi(tokens[i]);
                        return true;
                }
                return false;
@@ -297,12 +297,12 @@ struct rules_t
                        }
 
                        if (GetSize(tokens) == 3 && tokens[0] == "min") {
-                               data.min_limits[tokens[1]] = atoi(tokens[2].c_str());
+                               data.min_limits[tokens[1]] = std::stoi(tokens[2]);
                                continue;
                        }
 
                        if (GetSize(tokens) == 3 && tokens[0] == "max") {
-                               data.max_limits[tokens[1]] = atoi(tokens[2].c_str());
+                               data.max_limits[tokens[1]] = std::stoi(tokens[2]);
                                continue;
                        }
 
index 587ef878a6d68728fa2a93ccc7bc7fb7cb54be5e..6d97c0bb420e1cdbbae9006e75b38d2fcc1cce19 100644 (file)
@@ -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 = atoi(conn_tokens[1].c_str());
+                                       int lut_input = std::stoi(conn_tokens[1]);
                                        dlogic[type][lut_input] = logic_port;
                                }
                                continue;
                        }
                        if (args[argidx] == "-limit" && argidx + 1 < args.size())
                        {
-                               limit = atoi(args[++argidx].c_str());
+                               limit = std::stoi(args[++argidx]);
                                continue;
                        }
                        break;
index 65d8b8f324d8e507769548431f81cb3a56dc80b5..e571ed3c6a1f111f43c9eaee1602b1ece6da15e7 100644 (file)
@@ -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 = atoi(args[++argidx].c_str());
+                               min_density = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-min_choices" && argidx+1 < args.size()) {
-                               min_choices = atoi(args[++argidx].c_str());
+                               min_choices = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-onehot" && argidx+1 < args.size() && args[argidx+1] == "ignore") {
index 7f66f749f3775c4692799b105a8c7c5578739605..ea5bf8d333f3ba62c72c49a335b54d1a550e2140 100644 (file)
@@ -1521,7 +1521,7 @@ struct SharePass : public Pass {
                                continue;
                        }
                        if (args[argidx] == "-limit" && argidx+1 < args.size()) {
-                               config.limit = atoi(args[++argidx].c_str());
+                               config.limit = std::stoi(args[++argidx]);
                                continue;
                        }
                        break;
index f29631639baece20f765c2dd2e68d9d1fca53462..781b5e3cc1da37e232178d09c2b1c434735fc612 100644 (file)
@@ -816,7 +816,7 @@ struct FreducePass : public Pass {
                                continue;
                        }
                        if (args[argidx] == "-stop" && argidx+1 < args.size()) {
-                               reduce_stop_at = atoi(args[++argidx].c_str());
+                               reduce_stop_at = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-dump" && argidx+1 < args.size()) {
index b53bbfeb2d1ccb437b5530de31b6ea566ddb2fb1..a4b2f5eb5d287b9275f42d955d337c9c1eeff8dc 100644 (file)
@@ -803,7 +803,7 @@ struct MutatePass : public Pass {
                for (argidx = 1; argidx < args.size(); argidx++)
                {
                        if (args[argidx] == "-list" && argidx+1 < args.size()) {
-                               N = atoi(args[++argidx].c_str());
+                               N = std::stoi(args[++argidx]);
                                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 = atoi(args[++argidx].c_str());
+                               opts.seed = std::stoi(args[++argidx]);
                                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 = atoi(args[++argidx].c_str());
-                               opts.ctrl_value = atoi(args[++argidx].c_str());
+                               opts.ctrl_width = std::stoi(args[++argidx]);
+                               opts.ctrl_value = std::stoi(args[++argidx]);
                                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 = atoi(args[++argidx].c_str());
+                               opts.portbit = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-ctrlbit" && argidx+1 < args.size()) {
-                               opts.ctrlbit = atoi(args[++argidx].c_str());
+                               opts.ctrlbit = std::stoi(args[++argidx]);
                                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 = atoi(args[++argidx].c_str());
+                               opts.wirebit = std::stoi(args[++argidx]);
                                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 = atoi(args[argidx+2].c_str());
+                                       opts.pick_cover_prcnt = std::stoi(args[argidx+2]);
                                        argidx += 2;
                                        continue;
                                }
                                if (args[argidx+1] == "weight_cover") {
-                                       opts.weight_cover = atoi(args[argidx+2].c_str());
+                                       opts.weight_cover = std::stoi(args[argidx+2]);
                                        argidx += 2;
                                        continue;
                                }
                                if (args[argidx+1] == "weight_pq_w") {
-                                       opts.weight_pq_w = atoi(args[argidx+2].c_str());
+                                       opts.weight_pq_w = std::stoi(args[argidx+2]);
                                        argidx += 2;
                                        continue;
                                }
                                if (args[argidx+1] == "weight_pq_b") {
-                                       opts.weight_pq_b = atoi(args[argidx+2].c_str());
+                                       opts.weight_pq_b = std::stoi(args[argidx+2]);
                                        argidx += 2;
                                        continue;
                                }
                                if (args[argidx+1] == "weight_pq_c") {
-                                       opts.weight_pq_c = atoi(args[argidx+2].c_str());
+                                       opts.weight_pq_c = std::stoi(args[argidx+2]);
                                        argidx += 2;
                                        continue;
                                }
                                if (args[argidx+1] == "weight_pq_s") {
-                                       opts.weight_pq_s = atoi(args[argidx+2].c_str());
+                                       opts.weight_pq_s = std::stoi(args[argidx+2]);
                                        argidx += 2;
                                        continue;
                                }
                                if (args[argidx+1] == "weight_pq_mw") {
-                                       opts.weight_pq_mw = atoi(args[argidx+2].c_str());
+                                       opts.weight_pq_mw = std::stoi(args[argidx+2]);
                                        argidx += 2;
                                        continue;
                                }
                                if (args[argidx+1] == "weight_pq_mb") {
-                                       opts.weight_pq_mb = atoi(args[argidx+2].c_str());
+                                       opts.weight_pq_mb = std::stoi(args[argidx+2]);
                                        argidx += 2;
                                        continue;
                                }
                                if (args[argidx+1] == "weight_pq_mc") {
-                                       opts.weight_pq_mc = atoi(args[argidx+2].c_str());
+                                       opts.weight_pq_mc = std::stoi(args[argidx+2]);
                                        argidx += 2;
                                        continue;
                                }
                                if (args[argidx+1] == "weight_pq_ms") {
-                                       opts.weight_pq_ms = atoi(args[argidx+2].c_str());
+                                       opts.weight_pq_ms = std::stoi(args[argidx+2]);
                                        argidx += 2;
                                        continue;
                                }
index e4654d83549383dca604b774b74a1539ce2df3f8..847ca0e1d98fb34dec86393c384097a1d1429832 100644 (file)
@@ -1102,23 +1102,23 @@ struct SatPass : public Pass {
                                continue;
                        }
                        if (args[argidx] == "-timeout" && argidx+1 < args.size()) {
-                               timeout = atoi(args[++argidx].c_str());
+                               timeout = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-max" && argidx+1 < args.size()) {
-                               loopcount = atoi(args[++argidx].c_str());
+                               loopcount = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-maxsteps" && argidx+1 < args.size()) {
-                               maxsteps = atoi(args[++argidx].c_str());
+                               maxsteps = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-initsteps" && argidx+1 < args.size()) {
-                               initsteps = atoi(args[++argidx].c_str());
+                               initsteps = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-stepsize" && argidx+1 < args.size()) {
-                               stepsize = max(1, atoi(args[++argidx].c_str()));
+                               stepsize = max(1, std::stoi(args[++argidx]));
                                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 = atoi(args[++argidx].c_str());
+                               tempinduct_skip = std::stoi(args[++argidx]);
                                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 = atoi(args[++argidx].c_str());
+                               prove_skip = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-seq" && argidx+1 < args.size()) {
-                               seq_len = atoi(args[++argidx].c_str());
+                               seq_len = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-set-at" && argidx+3 < args.size()) {
-                               int timestep = atoi(args[++argidx].c_str());
+                               int timestep = std::stoi(args[++argidx]);
                                std::string lhs = args[++argidx];
                                std::string rhs = args[++argidx];
                                sets_at[timestep].push_back(std::pair<std::string, std::string>(lhs, rhs));
                                continue;
                        }
                        if (args[argidx] == "-unset-at" && argidx+2 < args.size()) {
-                               int timestep = atoi(args[++argidx].c_str());
+                               int timestep = std::stoi(args[++argidx]);
                                unsets_at[timestep].push_back(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-set-def-at" && argidx+2 < args.size()) {
-                               int timestep = atoi(args[++argidx].c_str());
+                               int timestep = std::stoi(args[++argidx]);
                                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 = atoi(args[++argidx].c_str());
+                               int timestep = std::stoi(args[++argidx]);
                                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 = atoi(args[++argidx].c_str());
+                               int timestep = std::stoi(args[++argidx]);
                                sets_all_undef_at[timestep].push_back(args[++argidx]);
                                enable_undef = true;
                                continue;
index 4c3022c709d451d7a48d5f63800209025fb178ac..cb102e8bfacbf13b2bb3d8e7108a3604aa0d7af8 100644 (file)
@@ -803,11 +803,11 @@ struct SimPass : public Pass {
                                continue;
                        }
                        if (args[argidx] == "-n" && argidx+1 < args.size()) {
-                               numcycles = atoi(args[++argidx].c_str());
+                               numcycles = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-rstlen" && argidx+1 < args.size()) {
-                               worker.rstlen = atoi(args[++argidx].c_str());
+                               worker.rstlen = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-clock" && argidx+1 < args.size()) {
index 73f63a4e11f47ee45b9659d67db74aaf9299ef79..5509c8c129b3b923444f0baaf5122aede8042825 100644 (file)
@@ -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 = atoi(arg.substr(0, pos).c_str());
-                                       lut_mode2 = atoi(arg.substr(pos+1).c_str());
+                                       lut_mode = std::stoi(arg.substr(0, pos));
+                                       lut_mode2 = std::stoi(arg.substr(pos+1));
                                } else {
-                                       lut_mode = atoi(arg.c_str());
+                                       lut_mode = std::stoi(arg);
                                        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(atoi(parts.at(0).c_str()));
+                                               lut_costs.push_back(std::stoi(parts.at(0)));
                                        else if (GetSize(parts) == 2)
-                                               while (GetSize(lut_costs) < atoi(parts.at(0).c_str()))
-                                                       lut_costs.push_back(atoi(parts.at(1).c_str()));
+                                               while (GetSize(lut_costs) < std::stoi(parts.at(0)))
+                                                       lut_costs.push_back(std::stoi(parts.at(1)));
                                        else
                                                log_cmd_error("Invalid -luts syntax.\n");
                                }
index 34919cf07439b7098879eef7567e5d16882e8ab8..36e3b4e6597aa110b355f976295fe51ff4859f36 100644 (file)
@@ -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 = atoi(arg.substr(0, pos).c_str());
-                                       lut_mode2 = atoi(arg.substr(pos+1).c_str());
+                                       lut_mode = std::stoi(arg.substr(0, pos));
+                                       lut_mode2 = std::stoi(arg.substr(pos+1));
                                } 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 = atoi(arg.c_str());
+                                               lut_mode = std::stoi(arg);
                                                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(atoi(parts.at(0).c_str()));
+                                               lut_costs.push_back(std::stoi(parts.at(0)));
                                        else if (GetSize(parts) == 2)
-                                               while (GetSize(lut_costs) < atoi(parts.at(0).c_str()))
-                                                       lut_costs.push_back(atoi(parts.at(1).c_str()));
+                                               while (GetSize(lut_costs) < std::stoi(parts.at(0)))
+                                                       lut_costs.push_back(std::stoi(parts.at(1)));
                                        else
                                                log_cmd_error("Invalid -luts syntax.\n");
                                }
index fff90f13c29018ed58994c1514d462a64845b648..cf974380654daa8aa9f88c831d52b2f872718c65 100644 (file)
@@ -476,16 +476,16 @@ struct ExtractPass : public Pass {
                                continue;
                        }
                        if (args[argidx] == "-mine_cells_span" && argidx+2 < args.size()) {
-                               mine_cells_min = atoi(args[++argidx].c_str());
-                               mine_cells_max = atoi(args[++argidx].c_str());
+                               mine_cells_min = std::stoi(args[++argidx]);
+                               mine_cells_max = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-mine_min_freq" && argidx+1 < args.size()) {
-                               mine_min_freq = atoi(args[++argidx].c_str());
+                               mine_min_freq = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-mine_limit_matches_per_module" && argidx+1 < args.size()) {
-                               mine_limit_mod = atoi(args[++argidx].c_str());
+                               mine_limit_mod = std::stoi(args[++argidx]);
                                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 = atoi(args[++argidx].c_str());
+                               mine_max_fanout = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-verbose") {
index a8d0bc834ee73437d8d86aaf848fa1c3a7a8ec8f..da56e087bd7adde44b94dfd549be3c818ce4006e 100644 (file)
@@ -613,7 +613,7 @@ struct ExtractCounterPass : public Pass {
 
                        if (args[argidx] == "-maxwidth" && argidx+1 < args.size())
                        {
-                               maxwidth = atoi(args[++argidx].c_str());
+                               maxwidth = std::stoi(args[++argidx]);
                                continue;
                        }
                }
index b541ceb6b8a7723199c56fefe8d2eb2ff16794cc..0b5b6a111ac7514f4776f3326b0f78d5dd543c67 100644 (file)
@@ -580,11 +580,11 @@ struct ExtractFaPass : public Pass {
                                continue;
                        }
                        if (args[argidx] == "-d" && argidx+2 < args.size()) {
-                               config.maxdepth = atoi(args[++argidx].c_str());
+                               config.maxdepth = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-b" && argidx+2 < args.size()) {
-                               config.maxbreadth = atoi(args[++argidx].c_str());
+                               config.maxbreadth = std::stoi(args[++argidx]);
                                continue;
                        }
                        break;
index 96d0df5f8b3c3632e7a1d1134d2ce804708fd998..3e66fcaccd43c1b8fe26ee5868dcef2981ead675 100644 (file)
@@ -1525,12 +1525,12 @@ struct FlowmapPass : public Pass {
                {
                        if (args[argidx] == "-maxlut" && argidx + 1 < args.size())
                        {
-                               order = atoi(args[++argidx].c_str());
+                               order = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-minlut" && argidx + 1 < args.size())
                        {
-                               minlut = atoi(args[++argidx].c_str());
+                               minlut = std::stoi(args[++argidx]);
                                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 = atoi(args[++argidx].c_str());
+                               r_alpha = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-r-beta" && argidx + 1 < args.size())
                        {
-                               r_beta = atoi(args[++argidx].c_str());
+                               r_beta = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-r-gamma" && argidx + 1 < args.size())
                        {
-                               r_gamma = atoi(args[++argidx].c_str());
+                               r_gamma = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-optarea" && argidx + 1 < args.size())
                        {
                                relax = true;
-                               optarea = atoi(args[++argidx].c_str());
+                               optarea = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-debug")
index cc765d89c2f2ae7a14bc5c0c842ad2f0b0fc667a..9ac39ed059d74a0905f3c1a0a9c025e718b8148a 100644 (file)
@@ -163,7 +163,7 @@ struct NlutmapPass : public Pass {
                                vector<string> tokens = split_tokens(args[++argidx], ",");
                                config.luts.clear();
                                for (auto &token : tokens)
-                                       config.luts.push_back(atoi(token.c_str()));
+                                       config.luts.push_back(std::stoi(token));
                                continue;
                        }
                        if (args[argidx] == "-assert") {
index 004ab1eb9a70c1b6e56655233c640b0ab6c9e69e..06eb7b79390fb13006b352f4a3b91cb1674e7bbf 100644 (file)
@@ -655,19 +655,19 @@ struct ShregmapPass : public Pass {
                                continue;
                        }
                        if (args[argidx] == "-minlen" && argidx+1 < args.size()) {
-                               opts.minlen = atoi(args[++argidx].c_str());
+                               opts.minlen = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-maxlen" && argidx+1 < args.size()) {
-                               opts.maxlen = atoi(args[++argidx].c_str());
+                               opts.maxlen = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-keep_before" && argidx+1 < args.size()) {
-                               opts.keep_before = atoi(args[++argidx].c_str());
+                               opts.keep_before = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-keep_after" && argidx+1 < args.size()) {
-                               opts.keep_after = atoi(args[++argidx].c_str());
+                               opts.keep_after = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-tech" && argidx+1 < args.size() && opts.tech == nullptr) {
index ceb0538255a12c919b3a64d14cdd0b04b7a16513..d10420ae80e86c9e8cd881d35d46271486154a0a 100644 (file)
@@ -1072,7 +1072,7 @@ struct TechmapPass : public Pass {
                                continue;
                        }
                        if (args[argidx] == "-max_iter" && argidx+1 < args.size()) {
-                               max_iter = atoi(args[++argidx].c_str());
+                               max_iter = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-D" && argidx+1 < args.size()) {
index 5d5466afe8a451952bf522f55a3f0deca4a53d07..d5a167db1968dd5ef79491578b7db64269980a7c 100644 (file)
@@ -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 = atoi(args[++argidx].c_str());
+                               num_iter = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-s" && argidx+1 < GetSize(args)) {
-                               xorshift32_state = atoi(args[++argidx].c_str());
+                               xorshift32_state = std::stoi(args[++argidx]);
                                continue;
                        }
                        break;
index bfb1d66423654f7173c653d294a12411f187b5f6..198007b87d3d611af559a2f5de913dcfd2dcac5c 100644 (file)
@@ -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 = atoi(args[++argidx].c_str());
+                               num_iter = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-seed" && argidx+1 < GetSize(args)) {
-                               seed = atoi(args[++argidx].c_str());
+                               seed = std::stoi(args[++argidx]);
                                continue;
                        }
                        break;
index e360b5edb209d2490d3d5e6f14f013a34add8537..7c58ec158e6288232fb26caa59dc26677a2b564c 100644 (file)
@@ -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 = atoi(args[++argidx].c_str());
+                               num_iter = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-s" && argidx+1 < GetSize(args)) {
-                               xorshift32_state = atoi(args[++argidx].c_str());
+                               xorshift32_state = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-map" && argidx+1 < GetSize(args)) {
index 555de9fba1568580f6536fefc5c41eba5dcc25c4..432ab3217bf83adf7611793f64a7cacb86e56c14 100644 (file)
@@ -140,7 +140,7 @@ struct SynthPass : public ScriptPass
                                continue;
                        }
                        if (args[argidx] == "-lut") {
-                               lut = atoi(args[++argidx].c_str());
+                               lut = std::stoi(args[++argidx]);
                                continue;
                        }
                        if (args[argidx] == "-nofsm") {