I have to implement a counter in VHDL and I realized I do not know the answer to a very simple question.
Suppose we have a signal x
that is written in a process, and read at the same time in another one (i.e. it is assigned to another signal out
):
process(clk, x)
begin
if rising_edge(clk) then
x <= x + 1;
end if;
end process;
process(clk, x)
begin
if rising_edge(clk) then
out <= x;
end if;
end process;
Both assignments seem to happen at the same time since they are conditional on rising_edge(clk)
. So will x
be assigned to out
after or before it is incremented? Or something in between resulting in undefined behaviour?
Cheers