@@ -22,7 +22,7 @@ use ieee.numeric_std.all;
2222entity psi_common_pulse_cc is
2323 generic (num_pulses_g : positive := 1 ; -- fifo width
2424 a_rst_pol_g : std_logic := '1' ; -- rst polarity port A
25- b_rst_pol_g : std_logic := '1' ); -- rst polarity port B
25+ b_rst_pol_g : std_logic := '1' ); -- rst polarity port B
2626 port ( a_clk_i : in std_logic ; -- clock port a input
2727 a_rst_i : in std_logic ; -- rst input port a
2828 a_rst_o : out std_logic ; -- Clock domain A reset output, active if *a_rst_i* or *b_rst_i* is asserted, de-asserted synchronously to *a_clk_i*
@@ -40,76 +40,104 @@ architecture rtl of psi_common_pulse_cc is
4040
4141 -- Domain A signals
4242 signal RstSyncB2A : std_logic_vector (3 downto 0 );
43- signal RstAI : std_logic ;
43+ signal RstAI : std_logic := a_rst_pol_g ;
4444 -- Domain B signals
4545 signal RstSyncA2B : std_logic_vector (3 downto 0 );
46- signal RstBI : std_logic ;
46+ signal RstBI : std_logic := b_rst_pol_g ;
4747 -- Data transmit side
4848 signal ToggleA : std_logic_vector (num_pulses_g - 1 downto 0 );
4949 -- Data receive side
5050 signal ToggleSyncB : Pulse_t(2 downto 0 );
5151
52- attribute syn_srlstyle : string ;
53- attribute syn_srlstyle of RstSyncB2A : signal is " registers" ;
54- attribute syn_srlstyle of RstSyncA2B : signal is " registers" ;
55- attribute syn_srlstyle of ToggleA : signal is " registers" ;
52+ attribute syn_srlstyle : string ;
53+ attribute syn_srlstyle of RstSyncB2A : signal is " registers" ;
54+ attribute syn_srlstyle of RstSyncA2B : signal is " registers" ;
55+ attribute syn_srlstyle of ToggleA : signal is " registers" ;
5656 attribute syn_srlstyle of ToggleSyncB : signal is " registers" ;
5757
58- attribute shreg_extract : string ;
58+ attribute shreg_extract : string ;
5959 attribute shreg_extract of RstSyncB2A : signal is " no" ;
6060 attribute shreg_extract of RstSyncA2B : signal is " no" ;
61- attribute shreg_extract of ToggleA : signal is " no" ;
62- attribute shreg_extract of ToggleSyncB : signal is " no" ;
61+ attribute shreg_extract of ToggleA : signal is " no" ;
62+ attribute shreg_extract of ToggleSyncB: signal is " no" ;
6363
64- attribute ASYNC_REG : string ;
65- attribute ASYNC_REG of RstSyncB2A : signal is " TRUE" ;
66- attribute ASYNC_REG of RstSyncA2B : signal is " TRUE" ;
67- attribute ASYNC_REG of ToggleA : signal is " TRUE" ;
68- attribute ASYNC_REG of ToggleSyncB : signal is " TRUE" ;
64+ attribute ASYNC_REG : string ;
65+ attribute ASYNC_REG of RstSyncB2A : signal is " TRUE" ;
66+ attribute ASYNC_REG of RstSyncA2B : signal is " TRUE" ;
67+ attribute ASYNC_REG of ToggleA : signal is " TRUE" ;
68+ attribute ASYNC_REG of ToggleSyncB : signal is " TRUE" ;
6969
7070begin
7171
7272 -- Domain A reset sync
7373 ARstSync_p : process (a_clk_i, b_rst_i)
7474 begin
7575 if b_rst_i = b_rst_pol_g then
76- RstSyncB2A <= (others => '1' );
76+ RstSyncB2A <= (others => b_rst_pol_g );
7777 elsif rising_edge (a_clk_i) then
78- RstSyncB2A <= RstSyncB2A(RstSyncB2A'left - 1 downto 0 ) & '0' ;
78+ RstSyncB2A <= RstSyncB2A(RstSyncB2A'left - 1 downto 0 ) & not b_rst_pol_g ;
7979 end if ;
8080 end process ;
81+
8182 ARst_p : process (a_clk_i)
8283 begin
8384 if rising_edge (a_clk_i) then
8485 if a_rst_pol_g = '1' then
85- RstAI <= RstSyncB2A(RstSyncB2A'left ) or a_rst_i;
86+ if b_rst_pol_g = '1' then
87+ RstAI <= RstSyncB2A(RstSyncB2A'left ) or a_rst_i;
88+ else
89+ RstAI <= RstSyncB2A(RstSyncB2A'left ) and a_rst_i;
90+ end if ;
8691 else
87- RstAI <= RstSyncB2A(RstSyncB2A'left ) and a_rst_i;
92+ if b_rst_pol_g = '1' then
93+ RstAI <= RstSyncB2A(RstSyncB2A'left ) or a_rst_i;
94+ else
95+ RstAI <= RstSyncB2A(RstSyncB2A'left ) and a_rst_i;
96+ end if ;
8897 end if ;
8998 end if ;
9099 end process ;
91- a_rst_o <= RstAI;
100+ gene_a_rst_o : if a_rst_pol_g = '1' generate
101+ a_rst_o <= RstAI or a_rst_i;
102+ end generate ;
103+ gene_a_rst_o_neg : if a_rst_pol_g = '0' generate
104+ a_rst_o <= RstAI and a_rst_i;
105+ end generate ;
92106
93107 -- Domain B reset sync
94108 BRstSync_p : process (b_clk_i, a_rst_i)
95109 begin
96110 if a_rst_i = a_rst_pol_g then
97- RstSyncA2B <= (others => '1' );
111+ RstSyncA2B <= (others => a_rst_pol_g );
98112 elsif rising_edge (b_clk_i) then
99- RstSyncA2B <= RstSyncA2B(RstSyncA2B'left - 1 downto 0 ) & '0' ;
113+ RstSyncA2B <= RstSyncA2B(RstSyncA2B'left - 1 downto 0 ) & not a_rst_pol_g ;
100114 end if ;
101115 end process ;
116+
102117 BRst_p : process (b_clk_i)
103118 begin
104119 if rising_edge (b_clk_i) then
105120 if b_rst_pol_g = '1' then
106- RstBI <= RstSyncA2B(RstSyncA2B'left ) or b_rst_i;
121+ if a_rst_pol_g = '1' then
122+ RstBI <= RstSyncA2B(RstSyncA2B'left ) or b_rst_i;
123+ else
124+ RstBI <= RstSyncA2B(RstSyncA2B'left ) and b_rst_i;
125+ end if ;
107126 else
108- RstBI <= RstSyncA2B(RstSyncA2B'left ) and b_rst_i;
127+ if a_rst_pol_g = '1' then
128+ RstBI <= RstSyncA2B(RstSyncA2B'left ) or b_rst_i;
129+ else
130+ RstBI <= RstSyncA2B(RstSyncA2B'left ) and b_rst_i;
131+ end if ;
109132 end if ;
110133 end if ;
111134 end process ;
112- b_rst_o <= RstBI;
135+ gene_b_rst_o : if b_rst_pol_g = '1' generate
136+ b_rst_o <= RstBI or b_rst_i;
137+ end generate ;
138+ gene_b_rst_o_neg : if b_rst_pol_g = '0' generate
139+ b_rst_o <= RstBI and b_rst_i;
140+ end generate ;
113141
114142 -- Pulse transmit side (A)
115143 PulseA_p : process (a_clk_i)
@@ -136,5 +164,5 @@ begin
136164 end if ;
137165 end if ;
138166 end process ;
167+
139168end architecture ;
140-
0 commit comments