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

Parse error for multiple wildcard imports #54

Open
huettern opened this issue May 10, 2022 · 3 comments
Open

Parse error for multiple wildcard imports #54

huettern opened this issue May 10, 2022 · 3 comments

Comments

@huettern
Copy link

huettern commented May 10, 2022

When trying to parse the snitch IP I get a parse error, I guess due to the multiple import statements?

Error: parse error
   --> /tmp/snitch/hw/ip/snitch/src/snitch.sv:13:60
   |
13 | module snitch import snitch_pkg::*; import riscv_instr::*; #(
   |                                                            ^
Error: Parse error: Some(("/tmp/snitch/hw/ip/snitch/src/snitch.sv", 490))

Steps to reproduce

  • sv-parser: 0.11.3
git clone --depth=1 [email protected]:pulp-platform/snitch.git
cd snitch/hw/ip/snitch
bender sources -f > sources.tcl
morty -f sources.tcl
@huettern huettern changed the title Parse error for multiple imoprts Parse error for multiple wildcard imports May 10, 2022
@huettern
Copy link
Author

CC: @zarubaf

@DaveMcEwan
Copy link

I think sv-parser does the correct thing here. The correct syntax is module snitch import snitch_pkg::*, riscv_instr::*; #(.

In the LRM (IEEE1800-2017), page 697 shows an except from Annex A, where module_ansi_header permits a single optional package_import_declaration. The definition of package_import_declaration shown on page 777 allows multiple comma-separated package_import_item.

@zarubaf
Copy link
Contributor

zarubaf commented Jun 10, 2022

@DaveMcEwan Indeed I agree after looking into the Language Manual. Interesting, that most of the tools have no problem with the ; though.

p. 781 also gives an example:

module M import A::instruction_t, B::*; #(WIDTH = 32)
...
(input [WIDTH-1:0] data, input instruction_t a, output [WIDTH-1:0] result, output boolean_t OK
); endmodule: M

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

3 participants