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

body of modules is not indented #14

Open
ry opened this issue Oct 17, 2019 · 6 comments
Open

body of modules is not indented #14

ry opened this issue Oct 17, 2019 · 6 comments

Comments

@ry
Copy link

ry commented Oct 17, 2019

Is there a way to force iStyle to indent the body of modules rather than putting it in column zero?

Example:

module picosoc_mem #(
  parameter integer WORDS = 256
) (
  input clk,
  input [3:0] wen,
  input [21:0] addr,
  input [31:0] wdata,
  output reg [31:0] rdata
);
  reg [31:0] mem [0:WORDS-1];

  always @(posedge clk) begin
    rdata <= mem[addr];
    if (wen[0]) mem[addr][ 7: 0] <= wdata[ 7: 0];
    if (wen[1]) mem[addr][15: 8] <= wdata[15: 8];
    if (wen[2]) mem[addr][23:16] <= wdata[23:16];
    if (wen[3]) mem[addr][31:24] <= wdata[31:24];
  end
endmodule
@thomasrussellmurphy
Copy link
Owner

Will you please provide before/after examples for your desired format and which existing iStyle formatting options you've tried using?

@ry
Copy link
Author

ry commented Oct 29, 2019

If I have this file

module top();
reg a = 1;
endmodule;

And I run it through iStyle: iStyle -n foo.v. I want the body of the module to be indented two spaces:

module top();
  reg a = 1;
endmodule;

but that is not the what I get from iStyle

@thomasrussellmurphy
Copy link
Owner

Please ensure that the existing, documented features do not meet your current needs. Custom formatting is provided by additional flags: https://github.com/thomasrussellmurphy/istyle-verilog-formatter#indentation-options

@ry
Copy link
Author

ry commented Oct 29, 2019

Are you saying this is already supported? I went through many combinations of flags but was not able to get that result.

@thomasrussellmurphy
Copy link
Owner

Please keep in mind that, despite being the repository owner, I am not the original author of this. Since your initial request did not mention your test cases and I am insufficiently familiar with the formatting capabilities, I wanted to check.

I would recommend checking the implementation of --indent-blocks and --indent-brackets to see if that logic could be conditionally applied to the module body as a whole. Pull requests welcomed.

@thomasrussellmurphy
Copy link
Owner

Has the January change helped with this?

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