Skip to content

Replacing instance port parameters with it's values in parent module ports - An issue with usage of verilog-auto-inst-param-value #1667

@engrvns

Description

@engrvns

Hi Wilson,
I am finding an issue with the verilog-mode where the parent module port definitions inherit the child parameter names.

This is inefficient and forces the user to -

  1. redefine the instance parameters at the instance level which is redundant
    2)Difficult to keep updating as ExampInst could be owned by another owner
    3)Difficult to maintain if there are lots of parameters and multiple instances...

In the example below, the ports of ExampInst are defined in terms of W.
Which would mean ExampInst wont's compile unless parameter W is re-defined.

This behavior happens due to requirements of verilog-auto-inst-param-value:t
How can we avoid this issue?

Example:

module InstModule 
  #(parameter W = 2)
  (
   input [W-1:0] i, 
   output[W-1:0] o 
   );
endmodule

module ExampInst 
  (
   /*AUTOINPUT*/
   // Beginning of automatic inputs (from unused autoinst inputs)
   input [W-1:0]	i,			// To instName of InstModule.v
   // End of automatics
   /*AUTOOUTPUT*/
   // Beginning of automatic outputs (from unused autoinst outputs)
   output [W-1:0]	o			// From instName of InstModule.v
   // End of automatics
   );
  InstModule
    instName (/*AUTOINST*/
	      // Outputs
	      .o			(o[W-1:0]),
	      // Inputs
	      .i			(i[W-1:0]));
endmodule // ExampInst

// Local variables:
// verilog-auto-sense-defines-constant:t
// verilog-auto-inst-param-value:t
// End:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions