Forum: FPGA, VHDL & Co. VHDL why is my process not sequential


von Kus A. (Firma: 2s) (jennyzuh)


Lesenswert?

Question about *VHDL*:

When i run this it shows to synchronous clk signals:
1
process 
2
begin
3
4
tb_CLK <= '1';
5
tb_SPI_CLK <='1';
6
wait for 1 ns;
7
tb_CLK <= '0' ;
8
tb_SPI_CLK <='0';
9
wait for 1 ns;
10
11
end process;
------------
When I run this:
 it shows both signals but tb_SPI_CLK is 1 clock tick shifted :(
Why doesnt it work sequentially in the process ?
1
process 
2
begin
3
4
tb_CLK <= '1';
5
tb_SPI_CLK <=tb_CLK ;
6
wait for 1 ns;
7
tb_CLK <= '0' ;
8
tb_SPI_CLK <=tb_CLK ;
9
wait for 1 ns;
10
11
end process;


Thank you :D

: Bearbeitet durch User
von Markus F. (mfro)


Lesenswert?

Kus A. schrieb:
> Why doesnt it work sequentially in the process ?

Because that's the way how signal assignments in VHDL processes work.

Welcome to the world of VHDL.

Best imagine that signal assignments get "collected" and not executed 
until the next wait statement (or the 'end' of the process, if there is 
no wait).

Thus you are - contrary to what you assumed - not assigning the value 
just 'written' to tb_SPI_CLK (because that 'write' does not occur any 
earlier than at the wait statement), but its previous value.

VHDL variables work like you would expect, but have other implications 
you still need to discover.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.