From 17cfc969ddfe800525dbeab272b53949846e28b8 Mon Sep 17 00:00:00 2001 From: Muthu Annamalai Date: Sun, 7 May 2023 06:19:02 +0000 Subject: [PATCH] [YOSYS] Issue #3498 - Fix Synopsys style unquoted Liberty style function body parsing with unittest --- passes/techmap/libparse.cc | 11 +++++++---- tests/liberty/issue3498_bad.lib | 8 ++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100755 tests/liberty/issue3498_bad.lib diff --git a/passes/techmap/libparse.cc b/passes/techmap/libparse.cc index 3d0ebaea3..1a1726f94 100644 --- a/passes/techmap/libparse.cc +++ b/passes/techmap/libparse.cc @@ -236,10 +236,13 @@ LibertyAst *LibertyParser::parse() if (tok == ':' && ast->value.empty()) { tok = lexer(ast->value); - if (tok != 'v') - error(); - tok = lexer(str); - while (tok == '+' || tok == '-' || tok == '*' || tok == '/') { + if (tok != 'v') { + //Synopsys-style unquoted identifiers issue#3498 + } else { + //Liberty canonical identifier including double quotes + tok = lexer(str); + } + while (tok == '+' || tok == '-' || tok == '*' || tok == '/' || tok == '!') { ast->value += tok; tok = lexer(str); if (tok != 'v') diff --git a/tests/liberty/issue3498_bad.lib b/tests/liberty/issue3498_bad.lib new file mode 100755 index 000000000..f85c4e19b --- /dev/null +++ b/tests/liberty/issue3498_bad.lib @@ -0,0 +1,8 @@ +library(fake) { + cell(bugbad) { + bundle(X) { + members(x1, x2); + power_down_function : !a+b ; + } + } +}