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

Module mis-indent within generate statement #1163

Open
veripoolbot opened this issue May 16, 2017 · 5 comments
Open

Module mis-indent within generate statement #1163

veripoolbot opened this issue May 16, 2017 · 5 comments
Labels

Comments

@veripoolbot
Copy link
Collaborator

@veripoolbot veripoolbot commented May 16, 2017


Author Name: Brad Dobbie
Original Redmine Issue: 1163 from https://www.veripool.org


I've encountered an indentation problem, shown below. verilog-mode-version is "2017-04-28-6b4fc78-vpo". I'm pretty sure this problem wasn't present in previous versions, but I can't say for sure.

Notice the opening parenthesis of the instance port connections is indented way too far. If I remove the "=0" on the generate for (...), the indentation works correctly (but obviously that isn't valid syntax).

module indent;

    // Here, AUTOINST line indents incorrectly indents way too far the the right
    generate for (genvar i=0; i<4; i++) begin : gen_inst0
       subindent s
                           (/*AUTOINST*/
                            // Outputs
                            .y                           (y),
                            // Inputs
                            .a                           (a));
    end endgenerate

    // Without the '=0', the AUTOINST line indents properly
    generate for (genvar i; i<4; i++) begin : gen_inst1
       subindent s
         (/*AUTOINST*/
          // Outputs
          .y                             (y),
          // Inputs
          .a                             (a));
    end endgenerate

endmodule

module subindent (input a, output y);
endmodule

@veripoolbot
Copy link
Collaborator Author

@veripoolbot veripoolbot commented May 16, 2017


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2017-05-16T17:55:20Z


FYI I looked at old revisions and didn't find any that work with the last 2 years.

@veripoolbot
Copy link
Collaborator Author

@veripoolbot veripoolbot commented May 16, 2017


Original Redmine Comment
Author Name: Kaushal Modi
Original Date: 2017-05-16T18:40:52Z


I confirm this issue too.

I never saw this issue earlier though as my coding style is a bit different.

Below indents fine.

module indent;

    genvar i;
    generate
       for (i=0; i<4; i++) begin : gen_inst0
          subindent s
              (/*AUTOINST*/
               // Outputs
               .y                           (y),
               // Inputs
               .a                           (a));
       end 
    endgenerate

endmodule

module subindent (input a, output y);
endmodule

@veripoolbot
Copy link
Collaborator Author

@veripoolbot veripoolbot commented May 16, 2017


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2017-05-16T18:53:25Z


Test committed as indent_genmod.v. Kaushal, perhaps you could take a look when you get a chance?

@veripoolbot
Copy link
Collaborator Author

@veripoolbot veripoolbot commented May 22, 2017


Original Redmine Comment
Author Name: Brad Dobbie
Original Date: 2017-05-22T16:03:49Z


Kaushal Modi wrote:

I confirm this issue too.

I never saw this issue earlier though as my coding style is a bit different.

Below indents fine.
[...]

Kashul, the issue is still present in your coding style but it is harder to see. If I space out the for statement, you can see the open parenthesis getting aligned with the = sign.

    genvar i;
    generate
       for                          (i=0; i<4; i++) begin : gen_inst0
          subindent s
                                       (/*AUTOINST*/
                                        // Outputs
                                        .y                           (y),
                                        // Inputs
                                        .a                           (a));
       end 
    endgenerate

@veripoolbot
Copy link
Collaborator Author

@veripoolbot veripoolbot commented May 22, 2017


Original Redmine Comment
Author Name: Kaushal Modi
Original Date: 2017-05-22T17:42:32Z


@wilson: I cannot promise when, but I am putting this on my list to investigate. My long term goal is to document all the regexp defvars. That exercise should help fix issues like these :)

@brad: You're right. I'll have a look at this when I get chance. Debugging indentation logic is a bit involved.

@veripoolbot veripoolbot added the indents label Mar 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.