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

Linter erroneously flags pure virtual functions #60

Open
palchak-google opened this issue Mar 19, 2021 · 1 comment
Open

Linter erroneously flags pure virtual functions #60

palchak-google opened this issue Mar 19, 2021 · 1 comment

Comments

@palchak-google
Copy link

palchak-google commented Mar 19, 2021

The following code is valid SystemVerilog (confirmed here):

package test_pkg;
  virtual class Class;
    pure virtual function automatic void func1();
    pure virtual function automatic void func2();
  endclass
endpackage

The linter erroneously flags the second function declaration as invalid syntax.
image

It appears that the linter is assuming that every function will have an endfunction, but this is not true for pure virtual functions.

@dalance
Copy link
Owner

dalance commented Mar 20, 2021

Thank you for your report.
In language specification, automatic is not allowed in pure virtual function.

class_method ::= pure virtual { class_item_qualifier } method_prototype ;
method_prototype ::= function_prototype 
function_prototype ::= function data_type_or_void function_identifier [ ( [ tf_port_list ] ) ] 

I know some tools allow this invalid syntax, but svls check it strictly for interoperability.

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

2 participants