veripool / verilog-mode

Verilog-Mode for Emacs with Indentation, Hightlighting and AUTOs. Master repository for pushing to GNU, verilog.com and veripool.org.
http://veripool.org/verilog-mode
GNU General Public License v3.0
247 stars 90 forks source link

AUTOINST with packed array of typedef's breaks #1718

Closed sjalloq closed 3 years ago

sjalloq commented 3 years ago

I'm opening this after finding an old issue that matches, #1485. I've got the same issue and your suggestion of adding the regex hint works for a simple test case but not for our main RTL.

The testcase I've got is:

typedef logic unsigned vector_t;

module test (
  output vector_t car_o,
  output vector_t [1:0] vec_o
);

endmodule

module top ();

  output vector_t       car_o;
  output vector_t [1:0] vec_o;

  test u_test (/*AUTOINST*/
               // Outputs
               .car_o                   (car_o),
               .vec_o                   (vec_o[1:0]));

endmodule

// Local Variables:
// verilog-typedef-regexp: "_t$"
// End:

but in our real RTL I effectively have the following snippets in a larger module. Any thoughts on what could be wrong?

typedef      logic unsigned     [AFE_NUMBER_CHANNELS-1:0]         afe_channel_vector_t;

module child_module (
  output afe_channel_vector_t     [1:0]                         afe_sc_o
);
//blah
endmodule

module parent_module();
  child_module u_child (/*AUTOINST*/);
           .afe_channel_vector_t        (afe_channel_vector_t/*.[1:0]*/),
           .afe_sc_o                    (afe_sc_o),
);
//blah
endmodule

// Local Variables:
// verilog-typedef-regexp: "_t$"
// End:
sjalloq commented 3 years ago

D'oh! You have to define the verilog-typedef-regexp in the child module.