axi_spdif_tx: CDC overhaul
Use common prefix for CDC elements and add the proper constraints to the XDC file. And add a missing stage to the toggle synchronizers. Also drop a some unnecessary resets. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>main
parent
9183f2287a
commit
8289262807
|
@ -1,4 +1,11 @@
|
|||
set_property ASYNC_REG TRUE \
|
||||
[get_cells -hier cdc_sync_stage1_*_reg] \
|
||||
[get_cells -hier cdc_sync_stage2_*_reg]
|
||||
|
||||
set_false_path \
|
||||
-from [get_cells -hier cdc_sync_stage0_*_reg -filter {PRIMITIVE_SUBGROUP == flop}] \
|
||||
-to [get_cells -hier cdc_sync_stage1_*_reg -filter {PRIMITIVE_SUBGROUP == flop}]
|
||||
|
||||
|
||||
|
||||
set_false_path \
|
||||
-from [get_cells -hier spdif_out_reg -filter {PRIMITIVE_SUBGROUP == flop}] \
|
||||
-to [get_cells -hier spdif_tx_o_reg -filter {PRIMITIVE_SUBGROUP == flop}]
|
||||
|
|
|
@ -92,9 +92,11 @@ architecture rtl of tx_encoder is
|
|||
signal par_vector : std_logic_vector(26 downto 0);
|
||||
signal send_audio : std_logic;
|
||||
|
||||
signal cdc_sync_stage0_tick_counter : std_logic := '0';
|
||||
signal cdc_sync_stage1_tick_counter : std_logic := '0';
|
||||
signal cdc_sync_stage2_tick_counter : std_logic := '0';
|
||||
signal cdc_sync_stage3_tick_counter : std_logic := '0';
|
||||
signal tick_counter : std_logic;
|
||||
signal tick_counter_d1 : std_logic;
|
||||
signal tick_counter_d2 : std_logic;
|
||||
|
||||
constant X_PREAMBLE : std_logic_vector(0 to 7) := "11100010";
|
||||
constant Y_PREAMBLE : std_logic_vector(0 to 7) := "11100100";
|
||||
|
@ -149,24 +151,30 @@ begin
|
|||
DCLK : process (data_clk)
|
||||
begin
|
||||
if rising_edge(data_clk) then
|
||||
tick_counter <= not tick_counter;
|
||||
cdc_sync_stage0_tick_counter <= not cdc_sync_stage0_tick_counter;
|
||||
end if;
|
||||
end process DCLK;
|
||||
|
||||
process (up_clk) begin
|
||||
if rising_edge(up_clk) then
|
||||
cdc_sync_stage1_tick_counter <= cdc_sync_stage0_tick_counter;
|
||||
cdc_sync_stage2_tick_counter <= cdc_sync_stage1_tick_counter;
|
||||
cdc_sync_stage3_tick_counter <= cdc_sync_stage2_tick_counter;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
tick_counter <= cdc_sync_stage3_tick_counter xor cdc_sync_stage2_tick_counter;
|
||||
|
||||
CGEN: process (up_clk)
|
||||
begin
|
||||
if rising_edge(up_clk) then
|
||||
if resetn = '0' or conf_txen = '0' then
|
||||
clk_cnt <= 0;
|
||||
tick_counter_d1 <= '0';
|
||||
tick_counter_d2 <= '0';
|
||||
spdif_clk_en <= '0';
|
||||
else
|
||||
tick_counter_d1 <= tick_counter;
|
||||
tick_counter_d2 <= tick_counter_d1;
|
||||
spdif_clk_en <= '0';
|
||||
|
||||
if (tick_counter_d1 xor tick_counter_d2) = '1' then
|
||||
if tick_counter = '1' then
|
||||
if clk_cnt < to_integer(unsigned(conf_ratio)) then
|
||||
clk_cnt <= clk_cnt + 1;
|
||||
else
|
||||
|
@ -221,12 +229,8 @@ begin
|
|||
TXSYNC: process (data_clk)
|
||||
begin
|
||||
if (rising_edge(data_clk)) then
|
||||
if resetn = '0' then
|
||||
spdif_tx_o <= '0';
|
||||
else
|
||||
spdif_tx_o <= spdif_out;
|
||||
end if;
|
||||
end if;
|
||||
end process TXSYNC;
|
||||
|
||||
-- State machine that generates sub-frames and blocks
|
||||
|
|
Loading…
Reference in New Issue