LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; USE work.FIVEn_DFT_PKG.ALL; USE work.simu_pkg.ALL; USE work.utils.ALL; LIBRARY std; USE std.textio.ALL; ENTITY fivendft_tb IS GENERIC ( demi_periode : time := 5 ns; -- duree de la demi periode des horloges test_e : string := "D:\Stage\ALMA_OPFB\simu\kx5_DFT - tb_6b\tb_txts_files\input.txt"; -- fichier test contenant les echantillons d'entree test_s : string := "D:\Stage\ALMA_OPFB\simu\kx5_DFT - tb_6b\tb_txts_files\output.txt" -- fichier contenant les echantillons de sortie ); END fivendft_tb; ARCHITECTURE beh OF fivendft_tb IS TYPE input_vect IS ARRAY (0 TO 2*cst_nb_samples_in_5ndft-1) OF smpl_in_5ndft; TYPE output_vect IS ARRAY (0 TO 2*cst_nb_samples_in_5ndft-1) OF std_logic_vector(5 DOWNTO 0); --smpl_out_5ndft; TYPE verif_vect IS ARRAY (0 TO 2*cst_nb_samples_in_5ndft-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_dft : input_vect := (OTHERS => (OTHERS => '0')); SIGNAL sortie_dft : output_vect := (OTHERS => (OTHERS => '0')); SIGNAL sortie_dft_sim : output_vect := (OTHERS => (OTHERS => '0')); SIGNAL input_vect_re : vect_dft_input; SIGNAL input_vect_im : vect_dft_input; SIGNAL output_vect_re : vect_dft_output; SIGNAL output_vect_im : vect_dft_output; SIGNAL verif : verif_vect; BEGIN -- ARCHITECTURE beh fill_module : FOR i IN 0 TO cst_nb_samples_in_5ndft-1 GENERATE input_vect_re(i) <= entree_dft(i); input_vect_im(i) <= entree_dft(i+cst_nb_samples_in_5ndft); sortie_dft_sim(i) <= output_vect_re(i); sortie_dft_sim(i+cst_nb_samples_in_5ndft) <= output_vect_im(i); END GENERATE fill_module; module_simu : ENTITY work.fft_tree(instanciating_cells) PORT MAP(h, input_vect_re, input_vect_im, output_vect_re, output_vect_im); 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 := 400000; -- nombre d'echantillons d'entree dans le fichier test CONSTANT mots_ligne : natural := 2*cst_nb_samples_in_5ndft; -- 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_dft(k) <= std_logic_vector(to_signed(donnee, cst_w_in_5ndft)); 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 := 400000; --nombre d'echantillons d'entree dans le fichier test CONSTANT mots_ligne : natural := 2*cst_nb_samples_in_5ndft; -- 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 := 14; 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_dft_sim(k))); sortie_dft(k) <= std_logic_vector(to_signed(donnee(k), 6)); 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;