Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Is it legal to use always block inside verilog "generate for" ?

Status
Not open for further replies.

mr_vasanth

Member level 5
Member level 5
Joined
Mar 12, 2007
Messages
86
Helped
5
Reputation
10
Reaction score
7
Trophy points
1,288
Location
Bangalore, India, India
Visit site
Activity points
1,906

Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
parameter SIZE = 3;
 
reg [31:0] reg_name [0:(SIZE-1)];
 
generate 
    for (i=0; i<SIZE; i=i+1)
    begin : MULTI_REG
      always @(posedge clk_i)
        reg_name[i] <= data_in;
    end
 endgenerate



is it legal to have always block inside a "generate for" statement as shown above ? is this synthesizable ? what will be the synthesis result ?

Don't mind about functionality of this circuit !!
 
Last edited by a moderator:

Yes. Anything listed in the BNF under module_or_generate_item or module_common_item can put put inside a generate block. You will need a declaration genvar i;. The loop will be unrolled and i will be replaced by the appropriate constant. Synthesis will proceed just as if you had manually written each individual always block.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top