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

Functions with port lists can't be parsed #100

Open
noloerino opened this issue Mar 29, 2022 · 0 comments
Open

Functions with port lists can't be parsed #100

noloerino opened this issue Mar 29, 2022 · 0 comments

Comments

@noloerino
Copy link

The most recent version of pyverilog (commit 2a42539) does not support parsing function definitions where a port list is provided, like the following example:

module TOP(CLK, RST_X);
  input CLK;
  input RST_X;
  reg [3:0] cnt;

  function [3:0] inc(input [3:0] in); // <-- The input port is declared here, instead of on a separate line.
    if(&inc) begin
      inc = 0;
    end else begin
      inc = in + 1;
    end
  endfunction
  
  always @(posedge CLK or negedge RST_X) begin
    if(!RST_X) begin
      cnt <= 0;
    end else begin
      cnt <= inc(cnt);
    end
  end
endmodule

Running the dataflow analyzer raises this error message: pyverilog.vparser.parser.ParseError: line:3: before: "("

I have a PR ready that adds support for this (will link here after I make it), as well as a minimal test case.

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