-- TITLE : memory access and dibits to IQ for DATV pattern generation -- Auteur : Alexandre CASTELLANE (F5SFU) -- révisions : -- 0.0 24 mai 2004 creation -- 2.1 added 2 selection bits SEL + end of adresse counting -- 2.11 rename entity in 2_1 for MAX+II -- 2.2 tested with EPM7128, cleaning buffer_adress -- 3.0 Nov 6th 2004 test to fit with 7064 (reset (GC) & SEL removed) -- 3.1 same as 3.0 with a cristal at 16 MHz (33 becomes 16) -- 3.11 is the phaser alone(test generator) -- 3.12 concatenates phaser + reader 3.1 -- 19 adresses + 8 data + clk(1) + IQ(2) + reset(or GC) = 31 I/O (remains eventually 1 sel available) -- 7064 has 28 I/O + 4 shared inputs (we loose 4 JTAG lost I/O) -- 1ère version à publier -- débit : 2 Mbits/s (horloge principale @ 16 MHz) -- EPROM 512 koctets chargée avec résultat du programme F5OEO avec TS bouclé, -- attention l'adresse de fin de memoire est à ajuster en fonction du resultat du flux obtenu -- Il peut y avoir des adresses de fin de mémoire qui génèrent un code qui ne rentrent pas ds le 7064 -- (Amélioration à venir : coder les butées dans l'EPROM pour éviter les grosses conso de portes) -- 3.13b from 3.12 with 1 MHz instead of 941 kHz library ieee; use ieee.std_logic_1164.all; Use ieee.std_logic_unsigned.all; entity mire_digitale3_13 is port( clk_16: in STD_LOGIC; -- horloge d'entrée principale data : in STD_LOGIC_VECTOR (7 downto 0); -- données de la mémoire adresse: out STD_LOGIC_VECTOR (18 downto 0) ; -- adresses memoire I,Q : out STD_LOGIC; -- Sortie des voies en phase et en quad test_enb: in STD_LOGIC ; -- bit de sélection du mode de test sel_phase: in STD_LOGIC -- bit de sélection de phase ); end mire_digitale3_13; -- ------------------------------------------------------------------------------------- architecture behavior of mire_digitale3_13 is Signal clk_dibit : STD_LOGIC := '0'; Signal Buffer_data : STD_LOGIC_VECTOR (7 downto 0) ; -- Buffer pour les 4 dibits Signal nx_Buffer_data : STD_LOGIC_VECTOR (7 downto 0); Signal Buffer_adress : STD_LOGIC_VECTOR (18 downto 0) := "0000000000000000001"; Signal nx_Buffer_adress : STD_LOGIC_VECTOR (18 downto 0) := (others => '0'); Signal last_EPROM_adress_to_read : STD_LOGIC_VECTOR (18 downto 0); Signal first_EPROM_adress_to_read : STD_LOGIC_VECTOR (18 downto 0); signal compteur : integer range 0 to 3 ; signal nx_compteur : integer range 0 to 3; Signal compteur_clk_in :STD_LOGIC_VECTOR (5 downto 0) := (others => '0');-- compteur horloge principale Signal SEL : STD_LOGIC_VECTOR (1 downto 0); -- test mode signals Signal compteur_clk_in_test :STD_LOGIC_VECTOR (5 downto 0) := (others => '0');-- compteur horloge principale signal compteur_Q :STD_LOGIC_VECTOR (5 downto 0) := (others => '0');-- compteur horloge principale signal clk_I : STD_LOGIC; signal clk_Q : STD_LOGIC; signal I_out : STD_LOGIC; signal Q_out : STD_LOGIC; -- ---------------------------------------------------------------------------------- begin clk_dibit <=compteur_clk_in(3); -- MSB of compteur_clk_in is raised at 1 Mhz and provides a top nx_Buffer_data <= Buffer_data; nx_compteur <= compteur; -- définition des sorties IQ qui sont les poids forts chaque decalage (4 fois par octet) with test_enb select I <= Buffer_data(7) when '0', I_out when '1'; with test_enb select Q <= Buffer_data(6) when '0', Q_out when '1'; with sel_phase select I_out <= clk_I when '0', clk_Q when others; with sel_phase select Q_out <= clk_Q when '0', clk_I when others; compteur_Q <= compteur_clk_in_test + 8; -- insures quadrature clk_I <=compteur_clk_in_test(4); -- MSB of compteur_clk_in is raised at 512 kHz and provides a top clk_Q <=compteur_Q(4); -- MSB of compteur_Q is raised at 512 kHz and provides a top in quadrature SEL <= "00"; -- c'est pour rentrer dans le 7064, car je ne sais pas gérer plusieurs pages de mires avec ce principe ! with SEL select first_EPROM_adress_to_read <= (others => '0') when "00", "1000101010110010000" when "01", --0x45590 "1000110001010010000" when "10", --0x46290 "1000101010100111110" when "11", --d283966 avant derniere -- first_EPROM_adress_to_read <= (others => '0') when "00", -- "1000101010110010000" when "01", --0x45590 -- "1000110001010010000" when "10", --0x46290 -- "1000110111101000001" when "11", --0x46F41 (others => '0') when others; with SEL select last_EPROM_adress_to_read <= "1000101010100111111" when "00", --d283967 last OEO "1000110001001001111" when "01", --0x4624F "1000110111101000000" when "10", --0x46F40 "1000101010101000000" when "11", --d283968 = last OEO + 1 -- last_EPROM_adress_to_read <= "1000101010100111111" when "00", --d283967 -- "1000110001001001111" when "01", --0x4624F -- "1000110111101000000" when "10", --0x46F40 -- "1111111111111111111" when "11", --0x7FFFF (others => '0') when others; nx_Buffer_adress <= first_EPROM_adress_to_read when (Buffer_adress = last_EPROM_adress_to_read + 1) else Buffer_adress; process (clk_16) begin if (clk_16='1' and clk_16'event) then if (compteur_clk_in = 15) then compteur_clk_in <= (others =>'0'); -- generates tops at 1 MHz else compteur_clk_in <= compteur_clk_in + 1; end if; end if; end process; process (clk_16) begin if (clk_16='1' and clk_16'event) then if (compteur_clk_in_test = 31) then compteur_clk_in_test <= (others =>'0'); -- defines the 1 MHz else compteur_clk_in_test <= compteur_clk_in_test + 1; end if; end if; end process; process (clk_dibit) begin if (clk_dibit='1' and clk_dibit'event) then if nx_compteur =3 then compteur <= 0; -- 4 steps defined else compteur <= nx_compteur + 1; end if; end if; end process; -- Sauf à la Premiere etape ou on lit data de memoire, -- dans toutes les autres etapes : decalage pour sortie IQ process (clk_dibit) begin if (clk_dibit='1' and clk_dibit'event) then case compteur is when 0 => Buffer_data(7 downto 0) <= data(7 downto 0); Buffer_adress <= nx_Buffer_adress; when 1 => Buffer_data <= nx_Buffer_data(5 downto 0) & "00"; Buffer_adress <= nx_Buffer_adress +1; when 2 => Buffer_data <= nx_Buffer_data(5 downto 0) & "00"; Buffer_adress <= nx_Buffer_adress; when 3 => Buffer_data <= nx_Buffer_data(5 downto 0) & "00"; Buffer_adress <= nx_Buffer_adress; adresse <= nx_Buffer_adress; when others => Buffer_data <= (others => '0'); Buffer_adress <= (others => '0'); end case; end if; end process; -- 2eme etape mise en place future adresse -- 4eme etape, presentation de l'adresse End behavior;