Forum: Mikrocontroller und Digitale Elektronik vhdl process synchronous clocks


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

von Forist (Gast)


Lesenswert?

Kus A. schrieb:
> Question about *VHDL*:

This sound like a question about VHDL.

Perhaps https://www.mikrocontroller.net/forum/fpga-vhdl-cpld is a better 
place to ask ... ;-)

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


Lesenswert?

omg i am really sorry,
i just registered here with the intention of posting it into this 
category ! now it is here xD

Thank you for your advice i will put it there

von Dussel (Gast)


Lesenswert?

Signals are assigned at the end of a block 'same-time-assignments'.
1
tb_CLK <= '1';
2
tb_SPI_CLK <=tb_CLK ;
Assume, both signals are '0' at first. Then, at the 'wait', tb_SPI_CLK 
takes the value of tb_CLK, which is still '0' and tb_CLK is set to '1'.
The order of assignments which happen at the same time does not matter.

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.