There are some IPs whose port definitions contain some ternary operators, causing problems in the process of importing verilog.
The main reason is that the original regular expression \\[(.*?)\\s*[:]\\s*(.*?)\\] did not take into account the colon in the ternary operator.
So, as shown in the picture, causing the problem.
To address this issue, VerilogPortParser and SystemVerilogExpressionParser have been improved, and test cases have been added to prove correctness.
Before fix:
After fix:
Test result about trinary operations:
...
PASS : tst_SystemVerilogExpressionParser::testTrinaryOperations(Trinary 1?2:3 should be 2)
PASS : tst_SystemVerilogExpressionParser::testTrinaryOperations(Trinary 1-1?2:3+1 should be 4)
PASS : tst_SystemVerilogExpressionParser::testTrinaryOperations(Trinary ? should invalid)
PASS : tst_SystemVerilogExpressionParser::testTrinaryOperations(Trinary : should invalid)
PASS : tst_SystemVerilogExpressionParser::testTrinaryOperations(Trinary (3+2)?(4+6) should invalid)
PASS : tst_SystemVerilogExpressionParser::testTrinaryOperations(Trinary (3+2):(4+6) should invalid)
PASS : tst_SystemVerilogExpressionParser::testTrinaryOperations(Trinary (3+2)?((3+3)?(4+7):1):0 should be 11)
PASS : tst_SystemVerilogExpressionParser::testTrinaryOperations(Trinary (1>2)?((3+3)?(4+7):1):0 should be 0)
PASS : tst_SystemVerilogExpressionParser::testTrinaryOperations(Trinary 3+2?3+3?4+7:1:0 should be 11)
PASS : tst_SystemVerilogExpressionParser::testTrinaryOperations(Trinary 1>2?3+3?4+7:1:0 should be 0)
PASS : tst_SystemVerilogExpressionParser::testTrinaryOperations(Trinary 1?11:2?12:0 should be 11)
PASS : tst_SystemVerilogExpressionParser::testTrinaryOperations(Trinary 1?11:(2?12:0) should be 11)
PASS : tst_SystemVerilogExpressionParser::testTrinaryOperations(Trinary 1?12?1:0:22 should be 1)
...
PASS : tst_SystemVerilogExpressionParser::cleanupTestCase()
Totals: 378 passed, 0 failed, 0 skipped, 0 blacklisted, 1428ms
********* Finished testing of tst_SystemVerilogExpressionParser *********
There are some IPs whose port definitions contain some ternary operators, causing problems in the process of importing verilog.
The main reason is that the original regular expression
\\[(.*?)\\s*[:]\\s*(.*?)\\]
did not take into account the colon in the ternary operator.So, as shown in the picture, causing the problem.
To address this issue, VerilogPortParser and SystemVerilogExpressionParser have been improved, and test cases have been added to prove correctness.
Before fix:
After fix:
Test result about trinary operations: