Files of a 5*2^n VHDL entity using Winograd5 and radix2 implementations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

154 lines
5.3KB

  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.ALL;
  3. USE ieee.numeric_std.ALL;
  4. USE work.FIVEn_DFT_PKG.ALL;
  5. USE work.simu_pkg.ALL;
  6. USE work.utils.ALL;
  7. LIBRARY std;
  8. USE std.textio.ALL;
  9. ENTITY fivendft_tb IS
  10. GENERIC (
  11. demi_periode : time := 5 ns;
  12. -- duree de la demi periode des horloges
  13. test_e : string := "D:\Stage\ALMA_OPFB\simu\kx5_DFT - tb_6b\tb_txts_files\input.txt";
  14. -- fichier test contenant les echantillons d'entree
  15. test_s : string := "D:\Stage\ALMA_OPFB\simu\kx5_DFT - tb_6b\tb_txts_files\output.txt"
  16. -- fichier contenant les echantillons de sortie
  17. );
  18. END fivendft_tb;
  19. ARCHITECTURE beh OF fivendft_tb IS
  20. TYPE input_vect IS ARRAY (0 TO 2*cst_nb_samples_in_5ndft-1) OF smpl_in_5ndft;
  21. TYPE output_vect IS ARRAY (0 TO 2*cst_nb_samples_in_5ndft-1) OF std_logic_vector(5 DOWNTO 0); --smpl_out_5ndft;
  22. TYPE verif_vect IS ARRAY (0 TO 2*cst_nb_samples_in_5ndft-1) OF integer;
  23. --TYPE partial_input_vect IS ARRAY (0 TO 9) OF smpl_in_5ndft;
  24. --TYPE partial_output_vect IS ARRAY (0 TO 9) OF smpl_in_5ndft;
  25. --TYPE vect_from_matrix_fir_data_out IS ARRAY (0 TO cst_nb_subfilters*cst_nb_parallel_firs-1) OF smpl_fir_data_out;
  26. FILE fichier_e : text IS IN test_e;
  27. FILE fichier_s : text IS IN test_s;
  28. --FILE fichier_c : text IS IN test_c;
  29. SIGNAL initialisation : std_logic;
  30. SIGNAL h : std_logic;
  31. SIGNAL entree_dft : input_vect := (OTHERS => (OTHERS => '0'));
  32. SIGNAL sortie_dft : output_vect := (OTHERS => (OTHERS => '0'));
  33. SIGNAL sortie_dft_sim : output_vect := (OTHERS => (OTHERS => '0'));
  34. SIGNAL input_vect_re : vect_dft_input;
  35. SIGNAL input_vect_im : vect_dft_input;
  36. SIGNAL output_vect_re : vect_dft_output;
  37. SIGNAL output_vect_im : vect_dft_output;
  38. SIGNAL verif : verif_vect;
  39. BEGIN -- ARCHITECTURE beh
  40. fill_module : FOR i IN 0 TO cst_nb_samples_in_5ndft-1 GENERATE
  41. input_vect_re(i) <= entree_dft(i);
  42. input_vect_im(i) <= entree_dft(i+cst_nb_samples_in_5ndft);
  43. sortie_dft_sim(i) <= output_vect_re(i);
  44. sortie_dft_sim(i+cst_nb_samples_in_5ndft) <= output_vect_im(i);
  45. END GENERATE fill_module;
  46. module_simu : ENTITY work.fft_tree(instanciating_cells)
  47. PORT MAP(h, input_vect_re, input_vect_im, output_vect_re, output_vect_im);
  48. horloge_entree : horloge(h, demi_periode, demi_periode);
  49. --sortie_dft_sim_process : PROCESS(sortie_dft_sim)
  50. -- VARIABLE mots_lignes : natural := 20;
  51. --BEGIN
  52. ----FOR k IN 0 TO mots_lignes-1 LOOP
  53. ---- FOR j IN 0 TO cst_nb_subfilters-1 LOOP
  54. ---- sortie_fir_sim_vect(k*mots_lignes+j) <= sortie_fir_sim(j)(k);
  55. ---- END LOOP;
  56. ----END LOOP;
  57. --END PROCESS;
  58. source : PROCESS
  59. CONSTANT header : natural := 1; -- nombre de ligne d'en tête
  60. CONSTANT nbr_ech : natural := 400000; -- nombre d'echantillons d'entree dans le fichier test
  61. CONSTANT mots_ligne : natural := 2*cst_nb_samples_in_5ndft; -- nombre de mots par ligne dans le ficher
  62. VARIABLE nbr_ligne : natural := 10000; -- nombre de lignes restant à lire dans le fichier
  63. VARIABLE i : natural := 1;
  64. VARIABLE donnee : integer;
  65. VARIABLE tempo : natural := 0;
  66. VARIABLE ligne : line;
  67. VARIABLE head : boolean := false;
  68. BEGIN -- PROCESS source
  69. WAIT UNTIL falling_edge(h);
  70. IF head = true THEN
  71. head := false;
  72. FOR i IN 0 TO header-1 LOOP
  73. readline(fichier_e, ligne);
  74. END LOOP;
  75. END IF;
  76. IF tempo > 0 THEN -- temps de synchro
  77. tempo := tempo -1;
  78. ELSIF nbr_ligne > 0 THEN
  79. readline(fichier_e, ligne);
  80. nbr_ligne := nbr_ligne-1;
  81. FOR k IN 0 TO mots_ligne -1 LOOP
  82. read(ligne, donnee);
  83. entree_dft(k) <= std_logic_vector(to_signed(donnee, cst_w_in_5ndft));
  84. END LOOP; -- k
  85. END IF;
  86. END PROCESS source;
  87. test : PROCESS
  88. CONSTANT header : natural := 1; -- nombre de ligne d'en tête
  89. CONSTANT nbr_ech : natural := 400000; --nombre d'echantillons d'entree dans le fichier test
  90. CONSTANT mots_ligne : natural := 2*cst_nb_samples_in_5ndft; -- nombre de mots par ligne dans le ficher
  91. VARIABLE nbr_ligne : natural := 10000; -- nombre de lignes restant à lire dans le fichier
  92. VARIABLE i : natural;
  93. VARIABLE donnee : donnee_sortie;
  94. VARIABLE ligne : line;
  95. VARIABLE tempo : natural := 14;
  96. VARIABLE sortie : integer;
  97. VARIABLE head : boolean := false;
  98. BEGIN -- PROCESS test
  99. WAIT UNTIL falling_edge(h);
  100. IF tempo > 0 THEN -- temps de synchro
  101. tempo := tempo -1;
  102. ASSERT false REPORT "Attente_2 ... " SEVERITY note;
  103. ELSIF nbr_ligne > 0 THEN
  104. readline(fichier_s, ligne);
  105. nbr_ligne := nbr_ligne-1;
  106. FOR k IN 0 TO mots_ligne-1 LOOP
  107. read(ligne, donnee(k));
  108. sortie := to_integer(signed(sortie_dft_sim(k)));
  109. sortie_dft(k) <= std_logic_vector(to_signed(donnee(k), 6));
  110. verif(k) <= sortie-donnee(k);
  111. ASSERT verif(k) = 0 REPORT "Valeur dft fausse"
  112. SEVERITY error;
  113. --ASSERT sortie /= donnee(k) REPORT "OK"
  114. -- SEVERITY note;
  115. END LOOP; -- k
  116. END IF;
  117. END PROCESS test;
  118. END ARCHITECTURE beh;