diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-02-16 00:16:54 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-02-16 00:16:54 +0100 |
commit | 9a816b65a80a7a56b06ac5d0859be73b24008202 (patch) | |
tree | 56d5d728dae91feea311b84f3b9504072322ed8f | |
parent | 623a68f5283331d96cded03bfd323266c88286f6 (diff) | |
download | yosys-9a816b65a80a7a56b06ac5d0859be73b24008202.tar.gz yosys-9a816b65a80a7a56b06ac5d0859be73b24008202.tar.bz2 yosys-9a816b65a80a7a56b06ac5d0859be73b24008202.zip |
Added != support for relational select pattern
-rw-r--r-- | passes/cmds/select.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc index a1a64f145..3a886b1c8 100644 --- a/passes/cmds/select.cc +++ b/passes/cmds/select.cc @@ -63,6 +63,8 @@ static bool match_attr_val(const RTLIL::Const &value, std::string pattern, char if (match_op == '=') return value == pattern_value; + if (match_op == '!') + return value != pattern_value; if (match_op == '<') return value.as_int() < pattern_value.as_int(); if (match_op == '>') @@ -82,6 +84,8 @@ static bool match_attr_val(const RTLIL::Const &value, std::string pattern, char if (match_op == '=') return value_str == pattern; + if (match_op == '!') + return value_str != pattern; if (match_op == '<') return value_str < pattern; if (match_op == '>') @@ -115,9 +119,11 @@ static bool match_attr(const std::map<RTLIL::IdString, RTLIL::Const> &attributes static bool match_attr(const std::map<RTLIL::IdString, RTLIL::Const> &attributes, std::string match_expr) { - size_t pos = match_expr.find_first_of("<=>"); + size_t pos = match_expr.find_first_of("<!=>"); if (pos != std::string::npos) { + if (match_expr.substr(pos, 2) == "!=") + return match_attr(attributes, match_expr.substr(0, pos), match_expr.substr(pos+2), '!'); if (match_expr.substr(pos, 2) == "<=") return match_attr(attributes, match_expr.substr(0, pos), match_expr.substr(pos+2), '['); if (match_expr.substr(pos, 2) == ">=") |