FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-21-2008, 08:57 PM
unfrostedpoptart
Guest
 
Posts: n/a
Default need help with autoinst templates / parameters with (x)emacs &verilog mode

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 With Quote
  #2 (permalink)  
Old 06-28-2008, 12:40 AM
weber
Guest
 
Posts: n/a
Default Re: need help with autoinst templates / parameters with (x)emacs &verilog mode

On Jun 21, 3:57*pm, unfrostedpoptart <[email protected]> wrote:
> 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; * * * * * // Fromtestmux_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


While I can't help you with your problem, I'm very happy using
yasnippet for saving typing on situations like you described.
http://code.google.com/p/yasnippet/

HTH,
weber
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
(x)emacs verilog-mode / slow indenting unfrostedpoptart Verilog 3 02-03-2008 05:02 AM
emacs crashes with the latest verilog-mode on WinXP. Any idea? Jim Wu Verilog 1 09-07-2006 07:58 PM
System Verilog mode on Emacs! agape Verilog 1 12-03-2004 05:39 PM
verilog-mode AUTOINST problem allanwe Verilog 2 07-01-2004 03:20 AM
Bug in AUTOSENSE with Emacs + Verilog Mode Srinivasan Venkataramanan Verilog 1 06-10-2004 02:44 PM


All times are GMT +1. The time now is 09:47 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved