Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16614 Discussions

Always block within always block

Altera_Forum
Honored Contributor II
999 Views

Hi guys, 

 

Is it possible to use always@block within always block? The reason I want to do that is I try to construct multiple synchronised blocks using For loop, and you need to put loop statement in a always/initial block. My code is like: 

always begin for(i=0;i<5;i=i+1)begin always@(posedge clk) begin ... end end end  

I'm not sure whether this is synthesizable or not, please give some advice. 

Cheers.
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
239 Views

You'll want a generate statement 

 

In this example: http://www.asic-world.com/verilog/verilog2k2.html 

You can replace memory U with your always structure 

 

Just be sure you don't generate multiple drivers for whatever reg you are writing
0 Kudos
Altera_Forum
Honored Contributor II
239 Views

 

--- Quote Start ---  

You'll want a generate statement 

 

In this example: http://www.asic-world.com/verilog/verilog2k2.html 

You can replace memory U with your always structure 

 

Just be sure you don't generate multiple drivers for whatever reg you are writing 

--- Quote End ---  

 

 

Can this example be synthesized?
0 Kudos
Altera_Forum
Honored Contributor II
239 Views

generate-for loops are synthesizable.

0 Kudos
Altera_Forum
Honored Contributor II
239 Views

It does not make sense for an always block within an always block 

yes, generate if is better choice
0 Kudos
Reply