LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; USE work.general_includes.ALL; USE work.simu_pkg.ALL; USE work.utils.ALL; LIBRARY std; USE std.textio.ALL; USE work.coeff.ALL; ENTITY simple_fir_tb IS GENERIC ( demi_periode : time := 5 ns; -- duree de la demi periode des horloges test_e : string := "D:\Stage\ALMA_OPFB\simu\simple_fir\tb_txts_files\input.txt"; -- fichier test contenant les echantillons d'entree test_s : string := "D:\Stage\ALMA_OPFB\simu\simple_fir\tb_txts_files\output.txt" -- fichier contenant les echantillons de sortie --fir_addr : std_logic_vector(band5a_w_fc-1 DOWNTO 0) := std_logic_vector(unsigned(band5a_fc_index, band5a_w_fc)) -- coef de décimation ); END simple_fir_tb; ARCHITECTURE beh OF simple_fir_tb IS FILE fichier_e : text IS IN test_e; FILE fichier_s : text IS IN test_s; --FILE fichier_c : text IS IN test_c; SIGNAL initialisation : std_logic; SIGNAL h : std_logic; SIGNAL entree_fir : vect_adc_data_out := (OTHERS => (OTHERS => '0')); SIGNAL sortie_fir : vect_fir_data_out := (OTHERS => (OTHERS => '0')); SIGNAL sortie_fir_sim : vect_fir_data_out := (OTHERS => (OTHERS => '0')); --SIGNAL coeffs_fir : vect_fir_coeffs_in := ; BEGIN -- ARCHITECTURE beh module_simu : ENTITY work.Tree_Fir(Shift_Reg_Fir) PORT MAP (h, fir_coeffs_generated, entree_fir, sortie_fir_sim); horloge_entree : horloge(h, demi_periode, demi_periode); source : PROCESS CONSTANT header : natural := 1; -- nombre de ligne d'en tête CONSTANT nbr_ech : natural := 249870; -- nombre d'echantillons d'entree dans le fichier test CONSTANT mots_ligne : natural := cst_nb_samples_adc_in; -- nombre de mots par ligne dans le ficher VARIABLE nbr_ligne : natural := 24987; --2750; --15625; -- nombre de lignes restant à lire dans le fichier VARIABLE i : natural := 1; VARIABLE donnee : integer; VARIABLE tempo : natural := 0; VARIABLE ligne : line; VARIABLE head : boolean := false; BEGIN -- PROCESS source WAIT UNTIL falling_edge(h); IF head = true THEN head := false; FOR i IN 0 TO header-1 LOOP readline(fichier_e, ligne); END LOOP; END IF; IF tempo > 0 THEN -- temps de synchro tempo := tempo -1; ELSIF nbr_ligne > 0 THEN readline(fichier_e, ligne); nbr_ligne := nbr_ligne-1; FOR k IN 0 TO mots_ligne -1 LOOP read(ligne, donnee); entree_fir(k) <= std_logic_vector(to_signed(donnee, cst_w_in)); END LOOP; -- k END IF; END PROCESS source; test : PROCESS CONSTANT header : natural := 1; -- nombre de ligne d'en tête CONSTANT nbr_ech : natural := 249870;--nombre d'echantillons d'entree dans le fichier test CONSTANT mots_ligne : natural := 10; -- nombre de mots par ligne dans le ficher VARIABLE nbr_ligne : natural := 24987; -- nombre de lignes restant à lire dans le fichier VARIABLE i : natural; VARIABLE donnee : donnee_sortie; VARIABLE ligne : line; VARIABLE tempo : natural := 6; VARIABLE sortie : integer; VARIABLE head : boolean := false; BEGIN -- PROCESS test WAIT UNTIL falling_edge(h); IF tempo > 0 THEN -- temps de synchro tempo := tempo -1; ASSERT false REPORT "Attente_2 ... " SEVERITY note; ELSIF nbr_ligne > 0 THEN readline(fichier_s, ligne); nbr_ligne := nbr_ligne-1; FOR k IN 0 TO mots_ligne -1 LOOP read(ligne, donnee(k)); sortie := to_integer(signed(sortie_fir_sim(k))); sortie_fir(k) <= std_logic_vector(to_signed(donnee(k), cst_w_out)); ASSERT sortie = donnee(k) REPORT "Valeur fir FAUSSE" SEVERITY error; --ASSERT sortie /= donnee(k) REPORT "OK" -- SEVERITY note; END LOOP; -- k END IF; END PROCESS test; END ARCHITECTURE beh;