diff options
author | Claire Xen <claire@clairexen.net> | 2023-01-11 16:33:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-11 16:33:08 +0100 |
commit | 843f329b96051bf26804bf3dd6259266257df8ab (patch) | |
tree | 96b2babe96707fb2ba39b369be38dbc4098dacbe /passes | |
parent | 6d56d4ecfc2c9afda3fd58f945a5f10daf87a999 (diff) | |
parent | 5abaa5908082f13f6b574d66f6f8a9ebb476fd54 (diff) | |
download | yosys-843f329b96051bf26804bf3dd6259266257df8ab.tar.gz yosys-843f329b96051bf26804bf3dd6259266257df8ab.tar.bz2 yosys-843f329b96051bf26804bf3dd6259266257df8ab.zip |
Merge branch 'master' into claire/eqystuff
Diffstat (limited to 'passes')
-rw-r--r-- | passes/cmds/exec.cc | 8 | ||||
-rw-r--r-- | passes/cmds/logger.cc | 8 | ||||
-rw-r--r-- | passes/sat/qbfsat.cc | 10 | ||||
-rw-r--r-- | passes/sat/qbfsat.h | 46 |
4 files changed, 36 insertions, 36 deletions
diff --git a/passes/cmds/exec.cc b/passes/cmds/exec.cc index c15ef23bf..e5fa4fb41 100644 --- a/passes/cmds/exec.cc +++ b/passes/cmds/exec.cc @@ -86,7 +86,7 @@ struct ExecPass : public Pass { bool polarity; //true: this regex must match at least one line //false: this regex must not match any line std::string str; - YS_REGEX_TYPE re; + std::regex re; expect_stdout_elem() : matched(false), polarity(true), str(), re(){}; }; @@ -121,7 +121,7 @@ struct ExecPass : public Pass { x.str = args[argidx]; x.re = YS_REGEX_COMPILE(args[argidx]); expect_stdout.push_back(x); - } catch (const YS_REGEX_NS::regex_error& e) { + } catch (const std::regex_error& e) { log_cmd_error("Error in regex expression '%s' !\n", args[argidx].c_str()); } } else if (args[argidx] == "-not-expect-stdout") { @@ -136,7 +136,7 @@ struct ExecPass : public Pass { x.re = YS_REGEX_COMPILE(args[argidx]); x.polarity = false; expect_stdout.push_back(x); - } catch (const YS_REGEX_NS::regex_error& e) { + } catch (const std::regex_error& e) { log_cmd_error("Error in regex expression '%s' !\n", args[argidx].c_str()); } @@ -171,7 +171,7 @@ struct ExecPass : public Pass { if (flag_expect_stdout) for(auto &x : expect_stdout) - if (YS_REGEX_NS::regex_search(line, x.re)) + if (std::regex_search(line, x.re)) x.matched = true; pos = linebuf.find('\n'); diff --git a/passes/cmds/logger.cc b/passes/cmds/logger.cc index ec92f1d01..9e45e86af 100644 --- a/passes/cmds/logger.cc +++ b/passes/cmds/logger.cc @@ -104,7 +104,7 @@ struct LoggerPass : public Pass { log("Added regex '%s' for warnings to warn list.\n", pattern.c_str()); log_warn_regexes.push_back(YS_REGEX_COMPILE(pattern)); } - catch (const YS_REGEX_NS::regex_error& e) { + catch (const std::regex_error& e) { log_cmd_error("Error in regex expression '%s' !\n", pattern.c_str()); } continue; @@ -116,7 +116,7 @@ struct LoggerPass : public Pass { log("Added regex '%s' for warnings to nowarn list.\n", pattern.c_str()); log_nowarn_regexes.push_back(YS_REGEX_COMPILE(pattern)); } - catch (const YS_REGEX_NS::regex_error& e) { + catch (const std::regex_error& e) { log_cmd_error("Error in regex expression '%s' !\n", pattern.c_str()); } continue; @@ -128,7 +128,7 @@ struct LoggerPass : public Pass { log("Added regex '%s' for warnings to werror list.\n", pattern.c_str()); log_werror_regexes.push_back(YS_REGEX_COMPILE(pattern)); } - catch (const YS_REGEX_NS::regex_error& e) { + catch (const std::regex_error& e) { log_cmd_error("Error in regex expression '%s' !\n", pattern.c_str()); } continue; @@ -172,7 +172,7 @@ struct LoggerPass : public Pass { log_expect_log[pattern] = LogExpectedItem(YS_REGEX_COMPILE(pattern), count); else log_abort(); } - catch (const YS_REGEX_NS::regex_error& e) { + catch (const std::regex_error& e) { log_cmd_error("Error in regex expression '%s' !\n", pattern.c_str()); } continue; diff --git a/passes/sat/qbfsat.cc b/passes/sat/qbfsat.cc index 42d3e188a..db6836ea1 100644 --- a/passes/sat/qbfsat.cc +++ b/passes/sat/qbfsat.cc @@ -66,9 +66,9 @@ pool<std::string> validate_design_and_get_inputs(RTLIL::Module *module, bool ass } void specialize_from_file(RTLIL::Module *module, const std::string &file) { - YS_REGEX_TYPE hole_bit_assn_regex = YS_REGEX_COMPILE_WITH_SUBS("^(.+) ([0-9]+) ([^ ]+) \\[([0-9]+)] = ([01])$"); - YS_REGEX_TYPE hole_assn_regex = YS_REGEX_COMPILE_WITH_SUBS("^(.+) ([0-9]+) ([^ ]+) = ([01])$"); //if no index specified - YS_REGEX_MATCH_TYPE bit_m, m; + std::regex hole_bit_assn_regex = YS_REGEX_COMPILE_WITH_SUBS("^(.+) ([0-9]+) ([^ ]+) \\[([0-9]+)] = ([01])$"); + std::regex hole_assn_regex = YS_REGEX_COMPILE_WITH_SUBS("^(.+) ([0-9]+) ([^ ]+) = ([01])$"); //if no index specified + std::smatch bit_m, m; dict<pool<std::string>, RTLIL::Cell*> anyconst_loc_to_cell; dict<RTLIL::SigBit, RTLIL::State> hole_assignments; @@ -83,9 +83,9 @@ void specialize_from_file(RTLIL::Module *module, const std::string &file) { std::string buf; while (std::getline(fin, buf)) { bool bit_assn = true; - if (!YS_REGEX_NS::regex_search(buf, bit_m, hole_bit_assn_regex)) { + if (!std::regex_search(buf, bit_m, hole_bit_assn_regex)) { bit_assn = false; - if (!YS_REGEX_NS::regex_search(buf, m, hole_assn_regex)) + if (!std::regex_search(buf, m, hole_assn_regex)) log_cmd_error("solution file is not formatted correctly: \"%s\"\n", buf.c_str()); } diff --git a/passes/sat/qbfsat.h b/passes/sat/qbfsat.h index 8fb6093bc..253cecce4 100644 --- a/passes/sat/qbfsat.h +++ b/passes/sat/qbfsat.h @@ -154,67 +154,67 @@ struct QbfSolutionType { } void recover_solution() { - YS_REGEX_TYPE sat_regex = YS_REGEX_COMPILE("Status: PASSED"); - YS_REGEX_TYPE unsat_regex = YS_REGEX_COMPILE("Solver Error.*model is not available"); - YS_REGEX_TYPE unsat_regex2 = YS_REGEX_COMPILE("Status: FAILED"); - YS_REGEX_TYPE timeout_regex = YS_REGEX_COMPILE("No solution found! \\(timeout\\)"); - YS_REGEX_TYPE timeout_regex2 = YS_REGEX_COMPILE("No solution found! \\(interrupted\\)"); - YS_REGEX_TYPE unknown_regex = YS_REGEX_COMPILE("No solution found! \\(unknown\\)"); - YS_REGEX_TYPE unknown_regex2 = YS_REGEX_COMPILE("Unexpected EOF response from solver"); - YS_REGEX_TYPE memout_regex = YS_REGEX_COMPILE("Solver Error:.*error \"out of memory\""); - YS_REGEX_TYPE hole_value_regex = YS_REGEX_COMPILE_WITH_SUBS("Value for anyconst in [a-zA-Z0-9_]* \\(([^:]*:[^\\)]*)\\): (.*)"); + std::regex sat_regex = YS_REGEX_COMPILE("Status: PASSED"); + std::regex unsat_regex = YS_REGEX_COMPILE("Solver Error.*model is not available"); + std::regex unsat_regex2 = YS_REGEX_COMPILE("Status: FAILED"); + std::regex timeout_regex = YS_REGEX_COMPILE("No solution found! \\(timeout\\)"); + std::regex timeout_regex2 = YS_REGEX_COMPILE("No solution found! \\(interrupted\\)"); + std::regex unknown_regex = YS_REGEX_COMPILE("No solution found! \\(unknown\\)"); + std::regex unknown_regex2 = YS_REGEX_COMPILE("Unexpected EOF response from solver"); + std::regex memout_regex = YS_REGEX_COMPILE("Solver Error:.*error \"out of memory\""); + std::regex hole_value_regex = YS_REGEX_COMPILE_WITH_SUBS("Value for anyconst in [a-zA-Z0-9_]* \\(([^:]*:[^\\)]*)\\): (.*)"); #ifndef NDEBUG - YS_REGEX_TYPE hole_loc_regex = YS_REGEX_COMPILE("[^:]*:[0-9]+.[0-9]+-[0-9]+.[0-9]+"); - YS_REGEX_TYPE hole_val_regex = YS_REGEX_COMPILE("[0-9]+"); + std::regex hole_loc_regex = YS_REGEX_COMPILE("[^:]*:[0-9]+.[0-9]+-[0-9]+.[0-9]+"); + std::regex hole_val_regex = YS_REGEX_COMPILE("[0-9]+"); #endif - YS_REGEX_MATCH_TYPE m; + std::smatch m; bool sat_regex_found = false; bool unsat_regex_found = false; dict<std::string, bool> hole_value_recovered; for (const std::string &x : stdout_lines) { - if(YS_REGEX_NS::regex_search(x, m, hole_value_regex)) { + if(std::regex_search(x, m, hole_value_regex)) { std::string loc = m[1].str(); std::string val = m[2].str(); #ifndef NDEBUG - log_assert(YS_REGEX_NS::regex_search(loc, hole_loc_regex)); - log_assert(YS_REGEX_NS::regex_search(val, hole_val_regex)); + log_assert(std::regex_search(loc, hole_loc_regex)); + log_assert(std::regex_search(val, hole_val_regex)); #endif auto locs = split_tokens(loc, "|"); pool<std::string> loc_pool(locs.begin(), locs.end()); hole_to_value[loc_pool] = val; } - else if (YS_REGEX_NS::regex_search(x, sat_regex)) { + else if (std::regex_search(x, sat_regex)) { sat_regex_found = true; sat = true; unknown = false; } - else if (YS_REGEX_NS::regex_search(x, unsat_regex)) { + else if (std::regex_search(x, unsat_regex)) { unsat_regex_found = true; sat = false; unknown = false; } - else if (YS_REGEX_NS::regex_search(x, memout_regex)) { + else if (std::regex_search(x, memout_regex)) { unknown = true; log_warning("solver ran out of memory\n"); } - else if (YS_REGEX_NS::regex_search(x, timeout_regex)) { + else if (std::regex_search(x, timeout_regex)) { unknown = true; log_warning("solver timed out\n"); } - else if (YS_REGEX_NS::regex_search(x, timeout_regex2)) { + else if (std::regex_search(x, timeout_regex2)) { unknown = true; log_warning("solver timed out\n"); } - else if (YS_REGEX_NS::regex_search(x, unknown_regex)) { + else if (std::regex_search(x, unknown_regex)) { unknown = true; log_warning("solver returned \"unknown\"\n"); } - else if (YS_REGEX_NS::regex_search(x, unsat_regex2)) { + else if (std::regex_search(x, unsat_regex2)) { unsat_regex_found = true; sat = false; unknown = false; } - else if (YS_REGEX_NS::regex_search(x, unknown_regex2)) { + else if (std::regex_search(x, unknown_regex2)) { unknown = true; } } |