diff options
author | Staf Verhaegen <staf@stafverhaegen.be> | 2018-01-03 20:36:22 +0000 |
---|---|---|
committer | Staf Verhaegen <staf@stafverhaegen.be> | 2018-01-03 21:37:17 +0000 |
commit | 92eb841f0a506ce776d511ec443769f5bcc2961f (patch) | |
tree | f38b5b71f3beb438d3839ca06eb56e953853d9a9 /passes/techmap | |
parent | 9804ebedbfd7db66849874bd11b167deb1bfed18 (diff) | |
download | yosys-92eb841f0a506ce776d511ec443769f5bcc2961f.tar.gz yosys-92eb841f0a506ce776d511ec443769f5bcc2961f.tar.bz2 yosys-92eb841f0a506ce776d511ec443769f5bcc2961f.zip |
Value of properties can be expression.
Example found in the 2007.03 Liberty Reference Manual that was also found
in the wild:
input_voltage(CMOS) {
vil : 0.3 * VDD ;
vih : 0.7 * VDD ;
vimin : -0.5 ;
vimax : VDD + 0.5 ;
}
Current implementation just parses the expression but no interpretation is done.
Diffstat (limited to 'passes/techmap')
-rw-r--r-- | passes/techmap/libparse.cc | 24 |
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; } |