Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
21618 Discussions

parametrized bufif

Altera_Forum
Honored Contributor II
1,416 Views

Hi, 

 

I would like to parametrized a module in verilog that will instantiate a "x" number of modules.. below is and example of what I am trying to do.. 

 

Could someone show me the right way of doing this.. you could edit the example below and send me the corrected module if you can.. 

 

module tri_stat_param 

#( 

parameter ffsize = 8 

 

 

in,  

oe, 

out 

); 

 

input oe; 

input [(ffsize-1):0] in; 

output [(ffsize-1):0] out; 

tri [(ffsize-1):0] out; 

 

bufif1 b1(out, in, oe); /* need to instantiate this keyword 'ffsize' */ 

 

 

endmodule
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
355 Views

Use a generate. 

genvar n; generator for(n = 0; n < ffisze; n = n+1) begin : gen_buffer bufif1 b1(out, in oe); end endgenerate 

 

That said.. this should do the same thing. 

assign out = oe ? in : {ffsize{1'bz}};
0 Kudos
Reply