Professional Documents
Culture Documents
Count Coincidence
Count Coincidence
USE IEEE.std_logic_1164.ALL;
ENTITY count_coincidence IS
PORT (
CLOCK_50
SW2
SW
RST
COMPA1
COMPA2
COMPA3
COMPA4
COMPB1
COMPB2
COMPB3
COMPB4
COMPGR1
COMPGR2
: IN STD_LOGIC ;
: IN STD_LOGIC_VECTOR (3 DOWNTO 0);
: IN STD_LOGIC_VECTOR (2 DOWNTO 0);
: IN STD_LOGIC ;
: IN STD_LOGIC ;
: IN STD_LOGIC ;
: IN STD_LOGIC ;
: IN STD_LOGIC ;
: IN STD_LOGIC ;
: IN STD_LOGIC ;
: IN STD_LOGIC ;
: IN STD_LOGIC ;
: IN STD_LOGIC ;
: IN STD_LOGIC ;
: std_logic;
: std_logic;
low
: std_logic;
high : std_logic;
rst_test : std_logic;
reset_cnt : std_logic_vector (31 downto 0);
nb_test_cnt : std_logic_vector (31 downto 0);
rst_reset_cnt : std_logic;
flag_reset : std_logic;
Count_affout1_int : std_logic_vector(31 downto 0);
Count_affout2_int : std_logic_vector(31 downto 0);
Count_affout3_int : std_logic_vector(31 downto 0);
BEGIN
low <= '0';
high <= '1';
------------------------------------------------------------------------------------------------ Gestion du switch SW2 pour le choix des signaux d'entre
----------------------------------------------------------------------------------------------p_Choix_input : process (SW2, COMPA1, COMPA2, COMPA3, COMPA4, COMPB1, COMPB2, C
OMPB3, COMPB4)
begin
case SW2 is
when "0000"
when "0001"
when "0010"
when "0011"
=>
=>
=>
=>
Signal_A
Signal_A
Signal_A
Signal_A
<=
<=
<=
<=
COMPA1
COMPA2
COMPA3
COMPA4
;
;
;
;
Signal_B
Signal_B
Signal_B
Signal_B
<=
<=
<=
<=
COMPB1;
COMPB2;
COMPB3;
COMPB4;
-----
A1
A2
A3
A4
et
et
et
et
B1
B2
B3
B4
when "0100"
when "0101"
when "0110"
A4
when "0111"
when "1000"
et A3
et A4
when "1001"
when
when
when
when
when
B2
B3
B4
B3
B4
-- B3
et B4
end case;
end process p_Choix_input;
------------------------------------------------------------------------------------------------ Gestion du switch SW pour la determination de la taille de la fenetre de coin
cidence
----------------------------------------------------------------------------------------------p_SW : process (SW)
begin
case SW is
when
0"; -- 1s
when
0"; -- 2s
when
0"; -- 5s
when
0"; -- 10s
-when
0"; -- 20s
when
0"; -- 30s
when
0"; -- 50s
when
00"; -- 1ms
end case;
begin
if (RST = '1') then
Signal_A_d1 <= '0';
---------------Signal_A_d2 <= '0';
s de front si -Signal_B_d1 <= '0';
-Signal_B_d2 <= '0';
---------------elsif (CLOCK_50'event and CLOCK_50= '1') then
Signal_A_d1 <= Signal_A;
---------------Signal_A_d2 <= Signal_A_d1;
eux tats en -Signal_B_d1 <= Signal_B;
pour chacun des signaux -Signal_B_d2 <= Signal_B_d1;
---------------end if;
end process r_edge_signal;
-- Detection de front
-- les deux signaux A
----------------------
----------------------
-----------------------
----------------------
-----------------------
Compteur pour le
--
fenetre de coinci
----------------------
-----------------------
Compteur t
----------------------
-- - rst_fenetre_cnt
-- - fenetre_enable
---------------------------------------------------------------------------------------------p_cnt_coincidence : process (CLOCK_50, freq_cnt_Signal_A, cnt_coincidence, fen
etre_out, posedge_Signal_A)
begin
if(posedge_Signal_A='1') then
cnt_coincidence_enable <= '1';
------------------
-fenetre_enable <='1';
elsif(fenetre_out='1') then
------------------
-- Si fenetre fini
rst_fenetre_cnt <='1';
------------------
-----fenetre_enable <='0';
elsif(cnt_coincidence/=cnt_coincidence_old) then
--------cnt_coincidence_enable <='0';
compt -rst_fenetre_cnt <='1';
--------fenetre_enable <='0';
------------------- Si coincidence
else
cnt_coincidence_enable <= cnt_coincidence_enable;
rst_fenetre_cnt <='0';
fenetre_enable <= fenetre_enable;
------------------
end if;
cnt_coincidence_old <= cnt_coincidence;
end process p_cnt_coincidence;
--
le soft
-----------------------