Commit 03448da1 authored by Maciej Lipinski's avatar Maciej Lipinski

wr_streamers: fixed bug that caused flush_p1_i to be missed.

In case the data was received in clk_ref_i domain, the flush_p1_i
was also received in the clk_ref_i domain. However, it was used
in an FSM that works in the clk_sys_i domain. This could cause
problems, for example missing the flash_p1_i pulses, thus frames
not being sent when requested. It was easily seen in the
spec_fixed_latency-demo testbench. In principle, the tx_flush_p1_i
does not need to come with data, can be asynchronous to data.
It should be a pulse, yet it can happen that it is constantly high
(see Tom's testbench of fixed-latency mode). Thus in cross-domain
use case :
1. first the pulse is extended to to cycles
2. thanks to this, the gc_sync_ffs module can be used to
   pass the signal to clk_sys clock domain, whether it is a
   pulse or not.
parent eadd9cca
......@@ -173,6 +173,7 @@ architecture rtl of xtx_streamer is
signal tx_fifo_q_int, tx_fifo_q_reg : std_logic_vector(g_data_width downto 0);
signal tx_fifo_q_valid : std_logic;
signal tx_fifo_q, tx_fifo_d : std_logic_vector(g_data_width downto 0);
signal tx_flush, tx_flush_p2 : std_logic;
signal state : t_tx_state;
signal seq_no, count : unsigned(14 downto 0);
signal ser_count : unsigned(7 downto 0);
......@@ -343,6 +344,7 @@ begin -- rtl
clk_data <= clk_sys_i;
stamper_pulse_a <= fsm_out.sof;
tx_flush <= tx_flush_p1_i;
end generate gen_use_sys_clock_for_data;
......@@ -411,6 +413,22 @@ begin -- rtl
end if;
end process;
U_Extend: entity work.gc_extend_pulse
generic map(
g_width => 2)
port map(
clk_i => clk_ref_i,
rst_n_i => rst_n_ref,
pulse_i => tx_flush_p1_i,
extended_o => tx_flush_p2);
U_Sync: entity work.gc_sync_ffs
port map (
clk_i => clk_sys_i,
rst_n_i => rst_int_n,
data_i => tx_flush_p2,
synced_o => tx_flush);
end generate gen_use_ref_clock_for_data;
-- sys clock domain
......@@ -513,7 +531,7 @@ begin -- rtl
seq_no <= (others => '0');
end if;
if tx_flush_p1_i = '1' or tx_timeout_hit = '1' then
if tx_flush = '1' or tx_timeout_hit = '1' then
tx_flush_latched <= '1';
end if;
......
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