Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANSI Style localparam causes parsing error #129

Open
mclark-iontra opened this issue Jun 15, 2024 · 0 comments
Open

ANSI Style localparam causes parsing error #129

mclark-iontra opened this issue Jun 15, 2024 · 0 comments

Comments

@mclark-iontra
Copy link

When a localparam is encountered in the ANSI style parameter declaration, a parsing error is reported.

Example source verilog

module a_module #(
  localparam A = 2
)(
  input [A-1:0] sig
);
endmodule

The resulting pyverilog output:

Generating LALR tables
WARNING: 183 shift/reduce conflicts
Traceback (most recent call last):
  File ".../pyverilog_test.py", line 14, in <module>
    ast, directives = parse(vlog)
                      ^^^^^^^^^^^
  File ".../.venv/lib/python3.12/site-packages/pyverilog/vparser/parser.py", line 2338, in parse
    ast = codeparser.parse()
          ^^^^^^^^^^^^^^^^^^
  File ".../.venv/lib/python3.12/site-packages/pyverilog/vparser/parser.py", line 2316, in parse
    ast = self.parser.parse(text, debug=debug)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../.venv/lib/python3.12/site-packages/pyverilog/vparser/parser.py", line 77, in parse
    return self.parser.parse(text, lexer=self.lexer, debug=debug)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../.venv/lib/python3.12/site-packages/ply/yacc.py", line 333, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../.venv/lib/python3.12/site-packages/ply/yacc.py", line 1201, in parseopt_notrack
    tok = call_errorfunc(self.errorfunc, errtoken, self)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../.venv/lib/python3.12/site-packages/ply/yacc.py", line 192, in call_errorfunc
    r = errorfunc(token)
        ^^^^^^^^^^^^^^^^
  File ".../.venv/lib/python3.12/site-packages/pyverilog/vparser/parser.py", line 2268, in p_error
    self._raise_error(p)
  File ".../.venv/lib/python3.12/site-packages/pyverilog/vparser/parser.py", line 2279, in _raise_error
    raise ParseError("%s: %s" % (coord, msg))
pyverilog.vparser.parser.ParseError:  line:3: before: "localparam"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant