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.

differences between for...loop and for...generate

Status
Not open for further replies.

Binome

Full Member level 3
Full Member level 3
Joined
Nov 16, 2009
Messages
153
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Location
Lyon, France
Visit site
Activity points
2,412
Please tell me what difference there is between these 2 kinds of loop:
Code:
init1 : process(clk,rst)
begin
	init_loop : for j in 0 to N-1 loop
	if rst='1' then	
		sigtmp_I(0,j) <= (others => '0');
		sigtmp_Q(0,j) <= (others => '0');
	elsif rising_edge(clk) then
		sigtmp_I(0,j) <= in_ifft_I(j);
		sigtmp_Q(0,j) <= in_ifft_Q(j);
	end if;
	end loop init_loop;
end process init1;

init2 : for j in 0 to N-1 generate
	if rst='1' then	
		sigtmp_I(0,j) <= (others => '0');
		sigtmp_Q(0,j) <= (others => '0');
	elsif rising_edge(clk) then
		sigtmp_I(0,j) <= in_ifft_I(j);
		sigtmp_Q(0,j) <= in_ifft_Q(j);
	end if;
end generate init2;
Thank you.
 

Only the first one (with the process) is legal VHDL syntax. You can't use sequential statements outside a process.

Do you own any VHDL text books?
 

A process is for runtime decisions: "what should we do if this signal goes high?"

A generate structure is for compile-time decisions: "what modules should be included in the design and how should they be connected?"
 

Ok, and what about a component written to be simulated then synthesized? Shoul I make the runtime or compile-time decisions easier?
 

If it's supposed to be both simulated and synthesized, then all the limitations for synthesis apply. For synthesis everything has to be determined compile-time.
 

A process is for runtime decisions: "what should we do if this signal goes high?"
Nicely put,
But I think this statement tricked Binome into thinking that processes are meant for synthesizable logic only - which isn't true...processes can be used in simulation also...

Binome, think of "runtime" as everything that's "ticking" in your code and isn't associated with logic generation.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top