|
- LIBRARY ieee;
- USE ieee.std_logic_1164.ALL;
- USE ieee.numeric_std.ALL;
- USE work.POLY_FIR_PKG.ALL;
- USE work.simu_pkg.ALL;
- USE work.utils.ALL;
- LIBRARY std;
- USE std.textio.ALL;
- USE work.coeff.ALL;
-
- ENTITY poly_fir_tb IS
-
- GENERIC (
- demi_periode : time := 5 ns;
- -- duree de la demi periode des horloges
- test_e : string := "D:\Stage\ALMA_OPFB\simu\polyphase_fir - v0.2\tb_txts_files\input.txt";
- -- fichier test contenant les echantillons d'entree
-
- test_s : string := "D:\Stage\ALMA_OPFB\simu\polyphase_fir - v0.2\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))
-
- -- coeff de décimation
- );
-
- END poly_fir_tb;
-
- ARCHITECTURE beh OF poly_fir_tb IS
- 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_fir : vect_adc_data_out := (OTHERS => (OTHERS => '0'));
- SIGNAL sortie_fir : vect_from_matrix_fir_data_out := (OTHERS => (OTHERS => '0'));
- SIGNAL sortie_fir_sim : matrix_fir_data_out := (OTHERS => (OTHERS => (OTHERS => '0')));
- --SIGNAL coeffs_fir : vect_fir_coeffs_in := ;
- SIGNAL sortie_fir_sim_vect : vect_from_matrix_fir_data_out := (OTHERS => (OTHERS => '0'));
- SIGNAL verif : donnee_sortie;
-
-
- BEGIN -- ARCHITECTURE beh
- module_simu : ENTITY work.poly_fir_blk(polyphase)
- PORT MAP(h, fir_coeffs_generated, entree_fir, sortie_fir_sim);
-
- horloge_entree : horloge(h, demi_periode, demi_periode);
-
- sortie_fir_sim_process : PROCESS(sortie_fir_sim)
- VARIABLE mots_lignes : natural := cst_nb_parallel_firs;
- 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*cst_nb_subfilters+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 := cst_nb_samples_adc_in; -- nombre de mots par ligne dans le ficher
- VARIABLE nbr_ligne : natural := 10000; --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 := 2000000; --nombre d'echantillons d'entree dans le fichier test
- CONSTANT mots_ligne : natural := 200; -- 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 := 8;
- 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_vect(k)));
- sortie_fir(k) <= std_logic_vector(to_signed(donnee(k), cst_w_out));
- verif(k) <= sortie - donnee(k);
- ASSERT verif(k) = 0 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;
|