gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

need help with autoinst templates / parameters with (x)emacs & verilog


From: unfrostedpoptart
Subject: need help with autoinst templates / parameters with (x)emacs & verilog mode
Date: Sat, 21 Jun 2008 11:57:11 -0700 (PDT)
User-agent: G2/1.0

Hi all.

I have a question about using (x)emacs verilog-mode. Specifically, I'm
trying to use AUTOINST with templates on a module that has
parametrized port widths.  If I get this working, it will save me an
immense amount of typing (and correcting)! The template works, but it
doesn't seem to pick up the parameter value from the instantiation.

Here's my sub module (actually, just the ports, which is all that
matters):

module  testmux();
   # (parameter WIDTH = 32)
   (
    input wire [2:0]     /* synopsys enum cur_info */ sel,
    input wire [WIDTH-1:0] a, b, c,
    output reg [WIDTH-1:0] out
    );
endmodule // testmux


Here's the module that instantiates it:

module  top_test();

   /*AUTOWIRE*/

   /* testmux AUTO_TEMPLATE "testmux_\(.*\)" (
    .a (@_a[]),
    .b (@_b[]),
    .c (@_c[]),
    .out (@[]),
    );
    */

   testmux #(.WIDTH(16)) testmux_boo (/*AUTOINST*/);

   testmux  testmux_defaultwidth (/*AUTOINST*/);

endmodule // top_test


When I expand autos, it becomes this:

module  top_test();

   /*AUTOWIRE*/
   // Beginning of automatic wires (for undeclared instantiated-module
outputs)
   wire [WIDTH-1:0]     boo;                    // From testmux_boo of testmux.v
   wire [WIDTH-1:0]     defaultwidth;           // From testmux_defaultwidth of
testmux.v
   // End of automatics

   /* testmux AUTO_TEMPLATE "testmux_\(.*\)" (
    .a (@_a[]),
    .b (@_b[]),
    .c (@_c[]),
    .out (@[]),
    );
    */

   testmux #(.WIDTH(16)) testmux_boo (/*AUTOINST*/
                                      // Outputs
                                      .out              (boo[WIDTH-1:0]), // 
Templated
                                      // Inputs
                                      .sel              (sel[2:0]),
                                      .a                (boo_a[WIDTH-1:0]), // 
Templated
                                      .b                (boo_b[WIDTH-1:0]), // 
Templated
                                      .c                (boo_c[WIDTH-1:0])); // 
Templated

   testmux  testmux_defaultwidth (/*AUTOINST*/
                                  // Outputs
                                  .out                  
(defaultwidth[WIDTH-1:0]), // Templated
                                  // Inputs
                                  .sel                  (sel[2:0]),
                                  .a                    
(defaultwidth_a[WIDTH-1:0]), // Templated
                                  .b                    
(defaultwidth_b[WIDTH-1:0]), // Templated
                                  .c                    
(defaultwidth_c[WIDTH-1:0])); // Templated

endmodule // top_test


The problem is that it's not substituting the value of the parameter
WIDTH. I'm so close, yet so far...  Can anyone help with this?

Many thanks in advance!

 David


reply via email to

[Prev in Thread] Current Thread [Next in Thread]