VHDL why is my process not sequential

OP (Firma: 2s) #6121322
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
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.

Antwort schreiben

Eine eigene Frage? Dieser Thread ist über 6 Jahre alt. Stell sie in einem eigenen Thread – dort lesen mehr Leute mit, und sie wird öfter und schneller beantwortet.

Neuen Thread starten

Eine Lösung, Ergänzung oder Rückmeldung zu diesem Thread? Dann antworte hier.

Formatierung
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]Code in anderen Sprachen, ASCII-Zeichnungen[/code]
  • [math]Formel in LaTeX-Syntax[/math]
  • [[Titel]] – Link zu einem Artikel
  • Verweis auf einen anderen Beitrag: Rechtsklick auf dessen Beitrags-ID (#8078628), „Adresse kopieren“, in den Text einfügen

Mehr zur Formatierung

Längeren Sourcecode als Anhang, nicht in den Text. JPG nur für Fotos und Scans; Zeichnungen und Screenshots als PNG oder GIF. Siehe Bildformate.

Schon registriert? Anmelden

Wird nicht angezeigt. Wir schicken dir einen Link; sobald du damit bestätigst, erscheint dein Beitrag.

Mit dem Abschicken legst du einen kostenlosen Account an und erkennst die Nutzungsbedingungen und die Datenschutzerklärung an.