------------------------------------------------------------------------------- -- Titre : test de la fifo du coregen xilinx -- Projet : ------------------------------------------------------------------------------- -- Fichier : test_mafifo.vhd -- Auteur : NOUEL Patrice -- Compagnie : -- Mise a jour : 2000/09/29 -- Platform : ------------------------------------------------------------------------------- -- Description : -- ------------------------------------------------------------------------------- -- Modification history : -- 2000/09/29 : creation ------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.std_logic_1164.ALL; USE work.utils.ALL; ENTITY test_fifogen IS END test_fifogen ; ARCHITECTURE pour_e2 OF test_fifogen IS COMPONENT fifo_gen GENERIC( port_width : integer := 8 ; -- nombre de bits du mot address_width : integer := 6); -- nombre de bits adresses memoire interne -- depth = capacite en mots = 2**address_width PORT( d : IN std_logic_vector(port_width-1 DOWNTO 0);-- entree reset_b : IN std_logic; -- actif au niveau bas wclk : IN std_logic; -- horloge d'ecriture we : IN std_logic; -- autorise l'ecriture sur front montant de wclk load : IN std_logic; -- prioritaire pour l'entree des deux seuils rclk : IN std_logic; -- horloge de lecture re : IN std_logic; -- autorise la lecture sur front montant de rclk oe_b : IN std_logic; -- Si '0' rend le bus actif, sinon bus = "zzzz..." q : OUT std_logic_vector(port_width-1 DOWNTO 0);-- sortie trois etats empty : OUT std_logic; -- fifo vide pae : OUT std_logic; -- fifo presque vide ( selon le niveau programmable) paf : OUT std_logic; -- fifo presque pleine ( selon le niveau programmable) full : OUT std_logic); -- fifo pleine END COMPONENT; -- les constantes CONSTANT periode : time := 100 ns; -- 10 megaH CONSTANT address_width : natural := 2; -- profondeur 4 CONSTANT port_width : natural := 8; CONSTANT depth : natural := 2**address_width; SIGNAL d : std_logic_vector(port_width-1 DOWNTO 0); SIGNAL we : std_logic; SIGNAL re : std_logic; SIGNAL load : std_logic; SIGNAL reset_b, oe_b : std_logic; SIGNAL wclk, rclk, rclk_n : std_logic; SIGNAL full : std_logic; SIGNAL empty : std_logic; SIGNAL pae, paf : std_ulogic; SIGNAL q : std_logic_vector(port_width-1 DOWNTO 0) ; -- SIGNAL remplissage : natural; -- nombre de mots en memoire BEGIN -- pour_e2 f1 : fifo_gen GENERIC MAP ( port_width => port_width, address_width => address_width) PORT MAP ( d => d, we => we, re => re, reset_b => reset_b, wclk => wclk, load => '0', full => full, empty => empty, oe_b => oe_b, pae => open, paf => open, rclk => rclk_n, q => q); he: horloge( wclk, periode/2, periode/2); hr: horloge(rclk, periode/2, periode/2 ); rclk_n <= NOT rclk; reset_b <= '0', '1' AFTER periode + 12 ns ; oe_b <= '0', '1' AFTER 50 * periode; p2: PROCESS BEGIN -- PROCESS re <= '0'; we <= '0'; WAIT UNTIL front_montant(reset_b); WAIT FOR periode /4 ; -- pour decaler we <= '1'; -- ecriture seule WAIT FOR (depth + 1) * periode ; we <= '0'; WAIT FOR periode ; re <= '1'; -- lecture seule WAIT FOR (depth + 1) * periode ; re <= '0'; WAIT FOR periode ; we <= '1'; -- ecriture et lecture WAIT FOR periode ; re <= '1'; WAIT FOR (depth + 1) * periode ; END PROCESS; p1 : PROCESS BEGIN -- PROCESS p1 d <= (OTHERS => '0'); WAIT UNTIL reset_b = '1'; LOOP WAIT UNTIL front_descendant(wclk); d <= d((d'left -1) DOWNTO 0) & NOT d(d'left) ; END LOOP; END PROCESS p1; -- compteur: PROCESS -- BEGIN -- PROCESS -- WAIT UNTIL front_montant(c); -- IF bufctr_ce = '1' THEN -- une operation -- IF bufctr_updn = '1' THEN -- remplissage <= remplissage + 1; -- c'est une ecrirure -- ELSE -- remplissage <= remplissage -1; -- c'est une lecture -- END IF; -- END IF; -- END PROCESS; -- ASSERT remplissage < 33 REPORT "Il y a debordement" SEVERITY note; END pour_e2;