Commit 560fc342 authored by Tristan Gingold's avatar Tristan Gingold

Fix data formatting (incorrect timestamp).

From Tom's dma branch.
parent aa0db067
...@@ -94,6 +94,7 @@ entity data_formatting is ...@@ -94,6 +94,7 @@ entity data_formatting is
clk_i_cycles_offset_i : in std_logic_vector(31 downto 0); clk_i_cycles_offset_i : in std_logic_vector(31 downto 0);
roll_over_nb_i : in std_logic_vector(31 downto 0); roll_over_nb_i : in std_logic_vector(31 downto 0);
retrig_nb_offset_i : in std_logic_vector(31 downto 0); retrig_nb_offset_i : in std_logic_vector(31 downto 0);
current_retrig_nb_i : in std_logic_vector(31 downto 0);
-- Signal from the WRabbit core or the one_hz_generator unit -- Signal from the WRabbit core or the one_hz_generator unit
utc_p_i : in std_logic; utc_p_i : in std_logic;
...@@ -200,13 +201,13 @@ begin ...@@ -200,13 +201,13 @@ begin
acam_channel <= "0" & acam_tstamp1_i(27 downto 26); acam_channel <= "0" & acam_tstamp1_i(27 downto 26);
acam_fine_timestamp <= acam_tstamp1_i(16 downto 0); acam_fine_timestamp <= acam_tstamp1_i(16 downto 0);
acam_slope <= acam_tstamp1_i(17); acam_slope <= acam_tstamp1_i(17);
acam_start_nb <= unsigned(acam_tstamp1_i(25 downto 18))-1; acam_start_nb <= unsigned(acam_tstamp1_i(25 downto 18));
elsif acam_tstamp2_ok_p_i = '1' then elsif acam_tstamp2_ok_p_i = '1' then
acam_channel <= "1" & acam_tstamp2_i(27 downto 26); acam_channel <= "1" & acam_tstamp2_i(27 downto 26);
acam_fine_timestamp <= acam_tstamp2_i(16 downto 0); acam_fine_timestamp <= acam_tstamp2_i(16 downto 0);
acam_slope <= acam_tstamp2_i(17); acam_slope <= acam_tstamp2_i(17);
acam_start_nb <= unsigned(acam_tstamp2_i(25 downto 18))-1; acam_start_nb <= unsigned(acam_tstamp2_i(25 downto 18));
end if; end if;
end if; end if;
end process; end process;
...@@ -290,7 +291,7 @@ begin ...@@ -290,7 +291,7 @@ begin
un_retrig_nb_offset <= unsigned(retrig_nb_offset_i); un_retrig_nb_offset <= unsigned(retrig_nb_offset_i);
utc <= utc_i; utc <= utc_i;
coarse_zero <= '0'; coarse_zero <= '0';
if roll_over_incr_recent_i = '1' and un_acam_start_nb > 192 then if acam_start_nb = 255 and unsigned(current_retrig_nb_i) = 0 then
un_retrig_from_roll_over <= shift_left(unsigned(roll_over_nb_i)-1, 8); un_retrig_from_roll_over <= shift_left(unsigned(roll_over_nb_i)-1, 8);
else else
un_retrig_from_roll_over <= shift_left(unsigned(roll_over_nb_i), 8); un_retrig_from_roll_over <= shift_left(unsigned(roll_over_nb_i), 8);
......
...@@ -509,6 +509,7 @@ begin ...@@ -509,6 +509,7 @@ begin
clk_i_cycles_offset_i => clk_i_cycles_offset, clk_i_cycles_offset_i => clk_i_cycles_offset,
roll_over_nb_i => roll_over_nb, roll_over_nb_i => roll_over_nb,
retrig_nb_offset_i => retrig_nb_offset, retrig_nb_offset_i => retrig_nb_offset,
current_retrig_nb_i => current_retrig_nb,
utc_p_i => utc_p, utc_p_i => utc_p,
utc_i => utc, utc_i => utc,
timestamp_o => timestamp, timestamp_o => timestamp,
......
...@@ -718,6 +718,7 @@ package tdc_core_pkg is ...@@ -718,6 +718,7 @@ package tdc_core_pkg is
clk_i_cycles_offset_i : in std_logic_vector(31 downto 0); clk_i_cycles_offset_i : in std_logic_vector(31 downto 0);
roll_over_nb_i : in std_logic_vector(31 downto 0); roll_over_nb_i : in std_logic_vector(31 downto 0);
retrig_nb_offset_i : in std_logic_vector(31 downto 0); retrig_nb_offset_i : in std_logic_vector(31 downto 0);
current_retrig_nb_i : in std_logic_vector(31 downto 0);
utc_p_i : in std_logic; utc_p_i : in std_logic;
timestamp_o : out std_logic_vector(127 downto 0); timestamp_o : out std_logic_vector(127 downto 0);
timestamp_valid_o : out std_logic); timestamp_valid_o : out std_logic);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment