LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; USE work.PFB_PKG.ALL; USE work.POLY_FIR_PKG.ALL; USE work.FIVEn_DFT_PKG.ALL; USE work.simu_pkg.ALL; USE work.utils.ALL; LIBRARY std; USE std.textio.ALL; USE work.coeff_fir.ALL; ENTITY pfb_tb IS GENERIC ( demi_periode : time := 5 ns; -- duree de la demi periode des horloges test_e : string := "D:\Stage\ALMA_OPFB\simu\v0.1 - PFB\tb_txts_files\input.txt"; -- fichier test contenant les echantillons d'entree test_s : string := "D:\Stage\ALMA_OPFB\simu\v0.1 - PFB\tb_txts_files\output.txt" -- fichier contenant les echantillons de sortie ); END pfb_tb; ARCHITECTURE beh OF pfb_tb IS TYPE verif_vect IS ARRAY (0 TO 2*cst_nb_parallel_firs_dfts_pfb*cst_nb_subfilters_pfb-1) OF integer; --TYPE partial_input_vect IS ARRAY (0 TO 9) OF smpl_in_5ndft; --TYPE partial_output_vect IS ARRAY (0 TO 9) OF smpl_in_5ndft; --TYPE vect_from_matrix_fir_data_out IS ARRAY (0 TO cst_nb_subfilters*cst_nb_parallel_firs-1) OF smpl_fir_data_out; 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_pfb : vect_adc_data_out_pfb := (OTHERS => (OTHERS => '0')); SIGNAL sortie_pfb : vect_dft_output_pfb := (OTHERS => (OTHERS => '0')); SIGNAL sortie_pfb_sim : vect_dft_output_pfb := (OTHERS => (OTHERS => '0')); SIGNAL verif : verif_vect; BEGIN -- ARCHITECTURE beh module_simu : ENTITY work.pfb_blk(polyfir_dft) PORT MAP(h, entree_pfb, fir_coeffs_generated, sortie_pfb_sim); horloge_entree : horloge(h, demi_periode, demi_periode); --sortie_dft_sim_process : PROCESS(sortie_dft_sim) -- VARIABLE mots_lignes : natural := 20; --BEGIN ----FOR k IN 0 TO mots_lignes-1 LOOP ---- FOR j IN 0 TO cst_nb_subfilters-1 LOOP ---- sortie_fir_sim_vect(k*mots_lignes+j) <= sortie_fir_sim(j)(k); ---- END LOOP; ----END LOOP; --END PROCESS; source : PROCESS CONSTANT header : natural := 1; -- nombre de ligne d'en tête CONSTANT nbr_ech : natural := 800000; -- nombre d'echantillons d'entree dans le fichier test CONSTANT mots_ligne : natural := 2*cst_nb_samples_adc_in_pfb; -- nombre de mots par ligne dans le ficher VARIABLE nbr_ligne : natural := 10000; -- 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_pfb(k) <= std_logic_vector(to_signed(donnee, cst_w_in_pfb)); 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 := 1000000; --nombre d'echantillons d'entree dans le fichier test CONSTANT mots_ligne : natural := 2*cst_nb_parallel_firs_dfts_pfb*cst_nb_subfilters_pfb; -- nombre de mots par ligne dans le ficher VARIABLE nbr_ligne : natural := 10000; -- nombre de lignes restant à lire dans le fichier VARIABLE i : natural; VARIABLE donnee : donnee_sortie; VARIABLE ligne : line; VARIABLE tempo : natural := 17; 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_pfb_sim(k))); sortie_pfb(k) <= std_logic_vector(to_signed(donnee(k), cst_w_out_pfb)); verif(k) <= sortie-donnee(k); ASSERT verif(k) = 0 REPORT "Valeur dft fausse" SEVERITY error; --ASSERT sortie /= donnee(k) REPORT "OK" -- SEVERITY note; END LOOP; -- k END IF; END PROCESS test; END ARCHITECTURE beh;