O
o pere o
Guest
Hi,
I am not an FPGA expert although this is not my first design. The
problem that I am having for two days now, is that I am observing
different results when simulating a design in GHDL and in Modelsim
ALTERA starter edition.
The design includes a shift register. The significant code is:
read_sro : process(s_sample)
begin
if rising_edge(s_sample) then
if ... --irrelevant here
end if;
if ...
end if;
if sr_burst_ena = '1' then --First phase: store data in shift_reg
new_data <= sr_sro_wave & new_data(c_burst_no-1 downto 1);
elsif dec_shift_ena = '1' then --Second phase: rotate data
new_data <= new_data(0) & new_data(c_burst_no-1 downto 1);
--irrelevant, but included for completeness
max_cnt <= max_cnt + 1;
if usum > max then
max <= usum;
max_pos <= max_cnt;
end if;
end if;
end if;
end process read_sro;
the clock signal s_sample is obtained from the main 50 MHz clock with
the following process:
sr_signals : process(clk)
begin
if rising_edge(clk) then
if sr_clear = '1' or sr_burst_ena = '1' or dec_shift_ena ='1' then
s_sample <= not s_sample;
end if;
...
end if;
end process sr_signals;
I have uploaded some screenshots here:
1- ghdl+gtkwave result http://tinypic.com/r/wklimq/6
2- simulink http://tinypic.com/r/2le743t/6
It may be seen that the input signal (top signal in the GHDL result and
third from the top in SIMULINK) is zero during the first 5 s_sample
clocks, then is at one during 10 clocks and zero again for the rest of
the (up to 20) clocks.
The GHDL simulation shows up ok, with the register correctly loaded with
0000011111111110000 after the 20 clocks, however Altera's quartus gives
00000111110000011111.
Exactly the same file is being fed to to Quartus II for synthesis!! But
Alteras RTL (and gate level) simulations do not behave as intended.
Is there something with the coding style than can make Quartus infer an
absolutely different behaviour? Any help is very much appreciated!!
Pere
I am not an FPGA expert although this is not my first design. The
problem that I am having for two days now, is that I am observing
different results when simulating a design in GHDL and in Modelsim
ALTERA starter edition.
The design includes a shift register. The significant code is:
read_sro : process(s_sample)
begin
if rising_edge(s_sample) then
if ... --irrelevant here
end if;
if ...
end if;
if sr_burst_ena = '1' then --First phase: store data in shift_reg
new_data <= sr_sro_wave & new_data(c_burst_no-1 downto 1);
elsif dec_shift_ena = '1' then --Second phase: rotate data
new_data <= new_data(0) & new_data(c_burst_no-1 downto 1);
--irrelevant, but included for completeness
max_cnt <= max_cnt + 1;
if usum > max then
max <= usum;
max_pos <= max_cnt;
end if;
end if;
end if;
end process read_sro;
the clock signal s_sample is obtained from the main 50 MHz clock with
the following process:
sr_signals : process(clk)
begin
if rising_edge(clk) then
if sr_clear = '1' or sr_burst_ena = '1' or dec_shift_ena ='1' then
s_sample <= not s_sample;
end if;
...
end if;
end process sr_signals;
I have uploaded some screenshots here:
1- ghdl+gtkwave result http://tinypic.com/r/wklimq/6
2- simulink http://tinypic.com/r/2le743t/6
It may be seen that the input signal (top signal in the GHDL result and
third from the top in SIMULINK) is zero during the first 5 s_sample
clocks, then is at one during 10 clocks and zero again for the rest of
the (up to 20) clocks.
The GHDL simulation shows up ok, with the register correctly loaded with
0000011111111110000 after the 20 clocks, however Altera's quartus gives
00000111110000011111.
Exactly the same file is being fed to to Quartus II for synthesis!! But
Alteras RTL (and gate level) simulations do not behave as intended.
Is there something with the coding style than can make Quartus infer an
absolutely different behaviour? Any help is very much appreciated!!
Pere