Repository navigation
Open
Labels
Description
It seems that Verilog user defined primitives are not supported by this parser.
If I put in an example with a user defined primitive, I get an error message.
primitive udp_and (c, a, b);
output c;
input a, b;
// in0 in1 sel : out
table
// a b c
0 ?: 0;
? 0: 0;
1 1: 1;
endtable
endprimitiveUsing the example parser, I get the following error message:
$ python3 example_parser.py udp_and.v
Generating LALR tables
WARNING: 183 shift/reduce conflicts
Traceback (most recent call last):
File "example_parser.py", line 55, in <module>
main()
File "example_parser.py", line 45, in main
ast, directives = parse(filelist,
File "/usr/local/lib/python3.10/dist-packages/pyverilog/vparser/parser.py", line 2338, in parse
ast = codeparser.parse()
File "/usr/local/lib/python3.10/dist-packages/pyverilog/vparser/parser.py", line 2316, in parse
ast = self.parser.parse(text, debug=debug)
File "/usr/local/lib/python3.10/dist-packages/pyverilog/vparser/parser.py", line 77, in parse
return self.parser.parse(text, lexer=self.lexer, debug=debug)
File "/usr/local/lib/python3.10/dist-packages/ply/yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/usr/local/lib/python3.10/dist-packages/ply/yacc.py", line 1201, in parseopt_notrack
tok = call_errorfunc(self.errorfunc, errtoken, self)
File "/usr/local/lib/python3.10/dist-packages/ply/yacc.py", line 192, in call_errorfunc
r = errorfunc(token)
File "/usr/local/lib/python3.10/dist-packages/pyverilog/vparser/parser.py", line 2268, in p_error
self._raise_error(p)
File "/usr/local/lib/python3.10/dist-packages/pyverilog/vparser/parser.py", line 2279, in _raise_error
raise ParseError("%s: %s" % (coord, msg))
pyverilog.vparser.parser.ParseError: line:1: before: "primitive"
Activity
shtaxxx commentedon Nov 5, 2022
Sorry, the current version of Pyverilog does not support
primitive.I think the modification of AST parser is not so difficult if add this feature based on the current parsing function for
module.