Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  IPC::Locker
  Parallel::Forker
  Voneline
General Info
  Papers

Issue #1272

alignment and indentation issue with import and "=" for localparam

Added by Enzo Chi almost 2 years ago. Updated almost 2 years ago.

Status:
Confirmed
Priority:
Normal
Assignee:
-
Category:
Indents
% Done:

0%


Description

I am using verilog-mode from commit "c579c46" and set "verilog-auto-lineup" to "all"

Example code:

module alignment_test
import bar_pkg::*;
    import foo_pkg::*;
    #(
      parameter DATA_WIDTH = 8,
      parameter ADDR_WIDTH = 4
      )
    (
     input wire                  clk,
     input wire                  res_n,
     input wire                  valid,
     input wire [DATA_WIDHT-1:0] data_in,
     input wire [ADDR_WIDTH-1:0] addr,
     output logic                accept
     );

    localparam LP_BAR_0 = 1;
    localparam LP_BAR_100 = 100;
    localparam logic [3:0]       LP_BAR_5 = 5;

endmodule

1. The first "import" right after the module name is not indent and not aligned with the second one. 2. The local parameter names are not aligned. 3. The "=" of local parameters are not aligned. 4. It looks like the LP_BAR_5 is tried to aligned with the port list. What I think the aligned should be inside scope: {}, (), begin/end, etc

Here is the expected code:

module alignment_test
    import bar_pkg::*;
    import foo_pkg::*;
    #(
        parameter DATA_WIDTH = 8,
        parameter ADDR_WIDTH = 4
    )
    (
        input wire                  clk,
        input wire                  res_n,
        input wire                  valid,
        input wire [DATA_WIDHT-1:0] data_in,
        input wire [ADDR_WIDTH-1:0] addr,
        output logic                accept
     );

    localparam             LP_BAR_0   = 1;
    localparam             LP_BAR_100 = 100;
    localparam logic [3:0] LP_BAR_5   = 5;

endmodule

expected_alignment.sv - Expected format (562 Bytes) Enzo Chi, 02/01/2018 10:57 PM

mis-aligned.sv - Mis-aligned format (516 Bytes) Enzo Chi, 02/01/2018 10:58 PM

History

#1 Updated by Wilson Snyder almost 2 years ago

  • Category set to Indents
  • Status changed from New to Confirmed

I agree this isn't what's expected. Please note the indent code is mostly fixed by contributions, so there may be a long wait for a fix unless you can contribute a parch.

Also available in: Atom