P
Paulo Dutra
Guest
A colleage challenged that the below code will work
correctly in HW, but randomly in simulation. In HW,
A and B will exchange values on each clock cycle. In
simulation, both A and B may get A's initial value.
The simulation working or not is a matter of simulator
process scheduling, so failure is random. Is this true
that it is impossible to garauntee the results in
simulation?
Code example:
clk1 <= clk0;
process pcs1(clk0)
begin
if clk0'event and clk0='1' then
A<=B;
end if;
end process pcs1;
process pcs2(clk1)
begin
if clk1'event and clk1='1' then
B<=A;
end if;
end process pcs2;
correctly in HW, but randomly in simulation. In HW,
A and B will exchange values on each clock cycle. In
simulation, both A and B may get A's initial value.
The simulation working or not is a matter of simulator
process scheduling, so failure is random. Is this true
that it is impossible to garauntee the results in
simulation?
Code example:
clk1 <= clk0;
process pcs1(clk0)
begin
if clk0'event and clk0='1' then
A<=B;
end if;
end process pcs1;
process pcs2(clk1)
begin
if clk1'event and clk1='1' then
B<=A;
end if;
end process pcs2;