Commit 28cd7560 authored by Dimitris Lampridis's avatar Dimitris Lampridis

genrams: conditionally generate CDC synchronisers for async_fifos.

This is beneficial because the gc_sync_ffs has a Xilinx "keep" attribute, which prevents the tools
from trimming out unused logic, even when the user has set the relevant generics to "FALSE".
parent 67d353ad
...@@ -124,11 +124,11 @@ architecture syn of inferred_async_fifo is ...@@ -124,11 +124,11 @@ architecture syn of inferred_async_fifo is
signal wr_count, rd_count : t_counter; signal wr_count, rd_count : t_counter;
signal rd_int, we_int : std_logic; signal rd_int, we_int : std_logic;
signal wr_empty_x : std_logic; signal wr_empty_x : std_logic := '0';
signal rd_full_x : std_logic; signal rd_full_x : std_logic := '0';
signal almost_full_x : std_logic; signal almost_full_x : std_logic := '0';
signal almost_empty_x : std_logic; signal almost_empty_x : std_logic := '0';
signal q_int : std_logic_vector(g_data_width-1 downto 0) := (others => '0'); signal q_int : std_logic_vector(g_data_width-1 downto 0) := (others => '0');
...@@ -225,6 +225,7 @@ begin -- syn ...@@ -225,6 +225,7 @@ begin -- syn
end if; end if;
end process p_gen_empty; end process p_gen_empty;
gen_with_wr_empty : if g_with_wr_empty = TRUE generate
U_Sync_Empty : gc_sync_ffs U_Sync_Empty : gc_sync_ffs
generic map ( generic map (
g_sync_edge => "positive") g_sync_edge => "positive")
...@@ -233,7 +234,9 @@ begin -- syn ...@@ -233,7 +234,9 @@ begin -- syn
rst_n_i => rst_n_i, rst_n_i => rst_n_i,
data_i => empty_int, data_i => empty_int,
synced_o => wr_empty_x); synced_o => wr_empty_x);
end generate gen_with_wr_empty;
gen_with_rd_full : if g_with_rd_full = TRUE generate
U_Sync_Full : gc_sync_ffs U_Sync_Full : gc_sync_ffs
generic map ( generic map (
g_sync_edge => "positive") g_sync_edge => "positive")
...@@ -242,6 +245,7 @@ begin -- syn ...@@ -242,6 +245,7 @@ begin -- syn
rst_n_i => rst_n_i, rst_n_i => rst_n_i,
data_i => full_int, data_i => full_int,
synced_o => rd_full_x); synced_o => rd_full_x);
end generate gen_with_rd_full;
rd_empty_o <= empty_int; rd_empty_o <= empty_int;
wr_empty_o <= wr_empty_x; wr_empty_o <= wr_empty_x;
...@@ -286,6 +290,7 @@ begin -- syn ...@@ -286,6 +290,7 @@ begin -- syn
end if; end if;
end process p_reg_almost_full; end process p_reg_almost_full;
gen_with_rd_almost_full : if g_with_rd_almost_full = TRUE generate
U_Sync_AlmostFull : gc_sync_ffs U_Sync_AlmostFull : gc_sync_ffs
generic map ( generic map (
g_sync_edge => "positive") g_sync_edge => "positive")
...@@ -294,6 +299,7 @@ begin -- syn ...@@ -294,6 +299,7 @@ begin -- syn
rst_n_i => rst_n_i, rst_n_i => rst_n_i,
data_i => almost_full_int, data_i => almost_full_int,
synced_o => almost_full_x); synced_o => almost_full_x);
end generate gen_with_rd_almost_full;
wr_almost_full_o <= almost_full_int; wr_almost_full_o <= almost_full_int;
rd_almost_full_o <= almost_full_x; rd_almost_full_o <= almost_full_x;
...@@ -312,6 +318,7 @@ begin -- syn ...@@ -312,6 +318,7 @@ begin -- syn
end if; end if;
end process p_reg_almost_empty; end process p_reg_almost_empty;
gen_with_wr_almost_empty : if g_with_wr_almost_empty = TRUE generate
U_Sync_AlmostEmpty : gc_sync_ffs U_Sync_AlmostEmpty : gc_sync_ffs
generic map ( generic map (
g_sync_edge => "positive") g_sync_edge => "positive")
...@@ -320,6 +327,7 @@ begin -- syn ...@@ -320,6 +327,7 @@ begin -- syn
rst_n_i => rst_n_i, rst_n_i => rst_n_i,
data_i => almost_empty_int, data_i => almost_empty_int,
synced_o => almost_empty_x); synced_o => almost_empty_x);
end generate gen_with_wr_almost_empty;
rd_almost_empty_o <= almost_empty_int; rd_almost_empty_o <= almost_empty_int;
wr_almost_empty_o <= almost_empty_x; wr_almost_empty_o <= almost_empty_x;
......
...@@ -114,11 +114,11 @@ architecture arch of inferred_async_fifo_dual_rst is ...@@ -114,11 +114,11 @@ architecture arch of inferred_async_fifo_dual_rst is
signal wr_count, rd_count : t_counter; signal wr_count, rd_count : t_counter;
signal rd_int, we_int : std_logic; signal rd_int, we_int : std_logic;
signal wr_empty_x : std_logic; signal wr_empty_x : std_logic := '0';
signal rd_full_x : std_logic; signal rd_full_x : std_logic := '0';
signal almost_full_x : std_logic; signal almost_full_x : std_logic := '0';
signal almost_empty_x : std_logic; signal almost_empty_x : std_logic := '0';
signal q_int : std_logic_vector(g_data_width-1 downto 0) := (others => '0'); signal q_int : std_logic_vector(g_data_width-1 downto 0) := (others => '0');
...@@ -215,6 +215,7 @@ begin -- arch ...@@ -215,6 +215,7 @@ begin -- arch
end if; end if;
end process p_gen_empty; end process p_gen_empty;
gen_with_wr_empty : if g_with_wr_empty = TRUE generate
U_Sync_Empty : gc_sync_ffs U_Sync_Empty : gc_sync_ffs
generic map ( generic map (
g_sync_edge => "positive") g_sync_edge => "positive")
...@@ -223,7 +224,10 @@ begin -- arch ...@@ -223,7 +224,10 @@ begin -- arch
rst_n_i => '1', rst_n_i => '1',
data_i => empty_int, data_i => empty_int,
synced_o => wr_empty_x); synced_o => wr_empty_x);
end generate gen_with_wr_empty;
gen_with_rd_full : if g_with_rd_full = TRUE generate
U_Sync_Full : gc_sync_ffs U_Sync_Full : gc_sync_ffs
generic map ( generic map (
g_sync_edge => "positive") g_sync_edge => "positive")
...@@ -232,6 +236,7 @@ begin -- arch ...@@ -232,6 +236,7 @@ begin -- arch
rst_n_i => '1', rst_n_i => '1',
data_i => full_int, data_i => full_int,
synced_o => rd_full_x); synced_o => rd_full_x);
end generate gen_with_rd_full;
rd_empty_o <= empty_int; rd_empty_o <= empty_int;
wr_empty_o <= wr_empty_x; wr_empty_o <= wr_empty_x;
...@@ -280,6 +285,7 @@ begin -- arch ...@@ -280,6 +285,7 @@ begin -- arch
end if; end if;
end process p_reg_almost_full; end process p_reg_almost_full;
gen_with_rd_almost_full : if g_with_rd_almost_full = TRUE generate
U_Sync_AlmostFull : gc_sync_ffs U_Sync_AlmostFull : gc_sync_ffs
generic map ( generic map (
g_sync_edge => "positive") g_sync_edge => "positive")
...@@ -288,6 +294,7 @@ begin -- arch ...@@ -288,6 +294,7 @@ begin -- arch
rst_n_i => '1', rst_n_i => '1',
data_i => almost_full_int, data_i => almost_full_int,
synced_o => almost_full_x); synced_o => almost_full_x);
end generate gen_with_rd_almost_full;
wr_almost_full_o <= almost_full_int; wr_almost_full_o <= almost_full_int;
rd_almost_full_o <= almost_full_x; rd_almost_full_o <= almost_full_x;
...@@ -308,6 +315,7 @@ begin -- arch ...@@ -308,6 +315,7 @@ begin -- arch
end if; end if;
end process p_reg_almost_empty; end process p_reg_almost_empty;
gen_with_wr_almost_empty : if g_with_wr_almost_empty = TRUE generate
U_Sync_AlmostEmpty : gc_sync_ffs U_Sync_AlmostEmpty : gc_sync_ffs
generic map ( generic map (
g_sync_edge => "positive") g_sync_edge => "positive")
...@@ -316,6 +324,7 @@ begin -- arch ...@@ -316,6 +324,7 @@ begin -- arch
rst_n_i => '1', rst_n_i => '1',
data_i => almost_empty_int, data_i => almost_empty_int,
synced_o => almost_empty_x); synced_o => almost_empty_x);
end generate gen_with_wr_almost_empty;
rd_almost_empty_o <= almost_empty_int; rd_almost_empty_o <= almost_empty_int;
wr_almost_empty_o <= almost_empty_x; wr_almost_empty_o <= almost_empty_x;
......
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