aboutsummaryrefslogtreecommitdiffstats
path: root/passes
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-01-04 13:30:00 +0100
committerGitHub <noreply@github.com>2018-01-04 13:30:00 +0100
commitfefb652d568749731b581185e6cb201f0fff479e (patch)
tree7fd12aef40de8755d366b4369e5951f8fdab6937 /passes
parent2d140a44ebfff31876778a4e70102763aa1cb595 (diff)
parent92eb841f0a506ce776d511ec443769f5bcc2961f (diff)
downloadyosys-fefb652d568749731b581185e6cb201f0fff479e.tar.gz
yosys-fefb652d568749731b581185e6cb201f0fff479e.tar.bz2
yosys-fefb652d568749731b581185e6cb201f0fff479e.zip
Merge pull request #480 from Fatsie/liberty_value_expression
Value of properties can be expression.
Diffstat (limited to 'passes')
-rw-r--r--passes/techmap/libparse.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/passes/techmap/libparse.cc b/passes/techmap/libparse.cc
index d5254c029..d3b1ff02f 100644
--- a/passes/techmap/libparse.cc
+++ b/passes/techmap/libparse.cc
@@ -100,8 +100,15 @@ int LibertyParser::lexer(std::string &str)
break;
}
f.unget();
- // fprintf(stderr, "LEX: identifier >>%s<<\n", str.c_str());
- return 'v';
+ if (str == "+" || str == "-") {
+ /* Single operator is not an identifier */
+ // fprintf(stderr, "LEX: char >>%s<<\n", str.c_str());
+ return str[0];
+ }
+ else {
+ // fprintf(stderr, "LEX: identifier >>%s<<\n", str.c_str());
+ return 'v';
+ }
}
if (c == '"') {
@@ -191,6 +198,19 @@ LibertyAst *LibertyParser::parse()
tok = lexer(ast->value);
if (tok != 'v')
error();
+ tok = lexer(str);
+ while (tok == '+' || tok == '-' || tok == '*' || tok == '/') {
+ ast->value += tok;
+ tok = lexer(str);
+ if (tok != 'v')
+ error();
+ ast->value += str;
+ tok = lexer(str);
+ }
+ if (tok == ';')
+ break;
+ else
+ error();
continue;
}