@@ -0,0 +1,125 | |||||
|
1 | ------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the LPP VHDL IP LIBRARY | |||
|
3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | ------------------------------------------------------------------------------ | |||
|
19 | -- Author : Martin Morlot | |||
|
20 | -- Mail : martin.morlot@lpp.polytechnique.fr | |||
|
21 | ------------------------------------------------------------------------------ | |||
|
22 | library ieee; | |||
|
23 | use ieee.std_logic_1164.all; | |||
|
24 | library grlib; | |||
|
25 | use grlib.amba.all; | |||
|
26 | use grlib.stdlib.all; | |||
|
27 | use grlib.devices.all; | |||
|
28 | library lpp; | |||
|
29 | use lpp.lpp_amba.all; | |||
|
30 | use lpp.apb_devices_list.all; | |||
|
31 | use lpp.lpp_cna.all; | |||
|
32 | ||||
|
33 | --! Driver APB, va faire le lien entre l'IP VHDL du convertisseur et le bus Amba | |||
|
34 | ||||
|
35 | entity APB_DAC is | |||
|
36 | generic ( | |||
|
37 | pindex : integer := 0; | |||
|
38 | paddr : integer := 0; | |||
|
39 | pmask : integer := 16#fff#; | |||
|
40 | pirq : integer := 0; | |||
|
41 | abits : integer := 8); | |||
|
42 | port ( | |||
|
43 | clk : in std_logic; --! Horloge du composant | |||
|
44 | rst : in std_logic; --! Reset general du composant | |||
|
45 | apbi : in apb_slv_in_type; --! Registre de gestion des entr�es du bus | |||
|
46 | apbo : out apb_slv_out_type; --! Registre de gestion des sorties du bus | |||
|
47 | Cal_EN : out std_logic; --! Signal Enable du multiplex pour la CAL | |||
|
48 | SYNC : out std_logic; --! Signal de synchronisation du convertisseur | |||
|
49 | SCLK : out std_logic; --! Horloge systeme du convertisseur | |||
|
50 | DATA : out std_logic --! Donn�e num�rique s�rialis� | |||
|
51 | ); | |||
|
52 | end entity; | |||
|
53 | ||||
|
54 | --! @details Les deux registres (apbi,apbo) permettent de g�rer la communication sur le bus | |||
|
55 | --! et les sorties seront cabl�es vers le convertisseur. | |||
|
56 | ||||
|
57 | architecture ar_APB_DAC of APB_DAC is | |||
|
58 | ||||
|
59 | constant REVISION : integer := 1; | |||
|
60 | ||||
|
61 | constant pconfig : apb_config_type := ( | |||
|
62 | 0 => ahb_device_reg (VENDOR_LPP, LPP_CNA, 0, REVISION, 0), | |||
|
63 | 1 => apb_iobar(paddr, pmask)); | |||
|
64 | ||||
|
65 | signal enable : std_logic; | |||
|
66 | signal flag_sd : std_logic; | |||
|
67 | ||||
|
68 | type DAC_ctrlr_Reg is record | |||
|
69 | DAC_Cfg : std_logic_vector(1 downto 0); | |||
|
70 | DAC_Data : std_logic_vector(15 downto 0); | |||
|
71 | end record; | |||
|
72 | ||||
|
73 | signal Rec : DAC_ctrlr_Reg; | |||
|
74 | signal Rdata : std_logic_vector(31 downto 0); | |||
|
75 | ||||
|
76 | begin | |||
|
77 | ||||
|
78 | enable <= Rec.DAC_Cfg(0); | |||
|
79 | Rec.DAC_Cfg(1) <= flag_sd; | |||
|
80 | ||||
|
81 | CONV0 : DacDriver | |||
|
82 | port map(clk,rst,enable,Rec.CNA_Data,SYNC,SCLK,flag_sd,Data); | |||
|
83 | ||||
|
84 | ||||
|
85 | process(rst,clk) | |||
|
86 | begin | |||
|
87 | if(rst='0')then | |||
|
88 | Rec.DAC_Data <= (others => '0'); | |||
|
89 | ||||
|
90 | elsif(clk'event and clk='1')then | |||
|
91 | ||||
|
92 | ||||
|
93 | --APB Write OP | |||
|
94 | if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then | |||
|
95 | case apbi.paddr(abits-1 downto 2) is | |||
|
96 | when "000000" => | |||
|
97 | Rec.DAC_Cfg(0) <= apbi.pwdata(0); | |||
|
98 | when "000001" => | |||
|
99 | Rec.DAC_Data <= apbi.pwdata(15 downto 0); | |||
|
100 | when others => | |||
|
101 | null; | |||
|
102 | end case; | |||
|
103 | end if; | |||
|
104 | ||||
|
105 | --APB Read OP | |||
|
106 | if (apbi.psel(pindex) and (not apbi.pwrite)) = '1' then | |||
|
107 | case apbi.paddr(abits-1 downto 2) is | |||
|
108 | when "000000" => | |||
|
109 | Rdata(31 downto 2) <= X"ABCDEF5" & "00"; | |||
|
110 | Rdata(1 downto 0) <= Rec.DAC_Cfg; | |||
|
111 | when "000001" => | |||
|
112 | Rdata(31 downto 16) <= X"FD18"; | |||
|
113 | Rdata(15 downto 0) <= Rec.DAC_Data; | |||
|
114 | when others => | |||
|
115 | Rdata <= (others => '0'); | |||
|
116 | end case; | |||
|
117 | end if; | |||
|
118 | ||||
|
119 | end if; | |||
|
120 | apbo.pconfig <= pconfig; | |||
|
121 | end process; | |||
|
122 | ||||
|
123 | apbo.prdata <= Rdata when apbi.penable = '1'; | |||
|
124 | Cal_EN <= enable; | |||
|
125 | end architecture; |
@@ -0,0 +1,68 | |||||
|
1 | ------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the LPP VHDL IP LIBRARY | |||
|
3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | ------------------------------------------------------------------------------ | |||
|
19 | -- Author : Martin Morlot | |||
|
20 | -- Mail : martin.morlot@lpp.polytechnique.fr | |||
|
21 | ------------------------------------------------------------------------------ | |||
|
22 | library IEEE; | |||
|
23 | use IEEE.std_logic_1164.all; | |||
|
24 | use IEEE.numeric_std.all; | |||
|
25 | use work.Convertisseur_config.all; | |||
|
26 | use lpp.lpp_cna.all; | |||
|
27 | ||||
|
28 | --! Programme du Convertisseur Num�rique/Analogique | |||
|
29 | ||||
|
30 | entity DacDriver is | |||
|
31 | port( | |||
|
32 | clk : in std_logic; --! Horloge du composant | |||
|
33 | rst : in std_logic; --! Reset general du composant | |||
|
34 | enable : in std_logic; --! Autorise ou non l'utilisation du composant | |||
|
35 | Data_C : in std_logic_vector(15 downto 0); --! Donn�e Num�rique d'entr�e sur 16 bits | |||
|
36 | SYNC : out std_logic; --! Signal de synchronisation du convertisseur | |||
|
37 | SCLK : out std_logic; --! Horloge systeme du convertisseur | |||
|
38 | flag_sd : out std_logic; --! Flag, signale la fin de la s�rialisation d'une donn�e | |||
|
39 | Data : out std_logic --! Donn�e num�rique s�rialis� | |||
|
40 | ); | |||
|
41 | end entity; | |||
|
42 | ||||
|
43 | --! @details Un driver C va permettre de g�nerer un tableau de donn�es sur 16 bits, | |||
|
44 | --! qui seront s�rialis� pour �tre ensuite dirig�es vers le convertisseur. | |||
|
45 | ||||
|
46 | architecture ar_DacDriver of DacDriver is | |||
|
47 | ||||
|
48 | signal s_SCLK : std_logic; | |||
|
49 | signal OKAI_send : std_logic; | |||
|
50 | ||||
|
51 | begin | |||
|
52 | ||||
|
53 | SystemCLK : Systeme_Clock | |||
|
54 | generic map (nb_serial) | |||
|
55 | port map (clk,rst,s_SCLK); | |||
|
56 | ||||
|
57 | ||||
|
58 | Signal_sync : Gene_SYNC | |||
|
59 | port map (s_SCLK,rst,enable,OKAI_send,SYNC); | |||
|
60 | ||||
|
61 | ||||
|
62 | Serial : serialize | |||
|
63 | port map (clk,rst,s_SCLK,Data_C,OKAI_send,flag_sd,Data); | |||
|
64 | ||||
|
65 | ||||
|
66 | SCLK <= s_SCLK; | |||
|
67 | ||||
|
68 | end architecture; No newline at end of file |
@@ -1,96 +1,96 | |||||
1 | ------------------------------------------------------------------------------ |
|
1 | ------------------------------------------------------------------------------ | |
2 | -- This file is a part of the LPP VHDL IP LIBRARY |
|
2 | -- This file is a part of the LPP VHDL IP LIBRARY | |
3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS |
|
3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 3 of the License, or |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | ------------------------------------------------------------------------------ |
|
18 | ------------------------------------------------------------------------------ | |
19 | -- Author : Martin Morlot |
|
19 | -- Author : Martin Morlot | |
20 | -- Mail : martin.morlot@lpp.polytechnique.fr |
|
20 | -- Mail : martin.morlot@lpp.polytechnique.fr | |
21 | ------------------------------------------------------------------------------ |
|
21 | ------------------------------------------------------------------------------ | |
22 | library ieee; |
|
22 | library ieee; | |
23 | use ieee.std_logic_1164.all; |
|
23 | use ieee.std_logic_1164.all; | |
24 | library grlib; |
|
24 | library grlib; | |
25 | use grlib.amba.all; |
|
25 | use grlib.amba.all; | |
26 | use std.textio.all; |
|
26 | use std.textio.all; | |
27 | library lpp; |
|
27 | library lpp; | |
28 | use lpp.lpp_amba.all; |
|
28 | use lpp.lpp_amba.all; | |
29 |
|
29 | |||
30 | --! Package contenant tous les programmes qui forment le composant int�gr� dans le l�on |
|
30 | --! Package contenant tous les programmes qui forment le composant int�gr� dans le l�on | |
31 |
|
31 | |||
32 | package lpp_cna is |
|
32 | package lpp_cna is | |
33 |
|
33 | |||
34 |
component APB_ |
|
34 | component APB_DAC is | |
35 | generic ( |
|
35 | generic ( | |
36 | pindex : integer := 0; |
|
36 | pindex : integer := 0; | |
37 | paddr : integer := 0; |
|
37 | paddr : integer := 0; | |
38 | pmask : integer := 16#fff#; |
|
38 | pmask : integer := 16#fff#; | |
39 | pirq : integer := 0; |
|
39 | pirq : integer := 0; | |
40 | abits : integer := 8); |
|
40 | abits : integer := 8); | |
41 | port ( |
|
41 | port ( | |
42 | clk : in std_logic; |
|
42 | clk : in std_logic; | |
43 | rst : in std_logic; |
|
43 | rst : in std_logic; | |
44 | apbi : in apb_slv_in_type; |
|
44 | apbi : in apb_slv_in_type; | |
45 | apbo : out apb_slv_out_type; |
|
45 | apbo : out apb_slv_out_type; | |
46 | Cal_EN : out std_logic; |
|
46 | Cal_EN : out std_logic; | |
47 | SYNC : out std_logic; |
|
47 | SYNC : out std_logic; | |
48 | SCLK : out std_logic; |
|
48 | SCLK : out std_logic; | |
49 | DATA : out std_logic |
|
49 | DATA : out std_logic | |
50 | ); |
|
50 | ); | |
51 | end component; |
|
51 | end component; | |
52 |
|
52 | |||
53 |
|
53 | |||
54 |
component |
|
54 | component DacDriver is | |
55 | port( |
|
55 | port( | |
56 | clk : in std_logic; |
|
56 | clk : in std_logic; | |
57 | rst : in std_logic; |
|
57 | rst : in std_logic; | |
58 | enable : in std_logic; |
|
58 | enable : in std_logic; | |
59 | Data_C : in std_logic_vector(15 downto 0); |
|
59 | Data_C : in std_logic_vector(15 downto 0); | |
60 | SYNC : out std_logic; |
|
60 | SYNC : out std_logic; | |
61 | SCLK : out std_logic; |
|
61 | SCLK : out std_logic; | |
62 | flag_sd : out std_logic; |
|
62 | flag_sd : out std_logic; | |
63 | Data : out std_logic |
|
63 | Data : out std_logic | |
64 | ); |
|
64 | ); | |
65 | end component; |
|
65 | end component; | |
66 |
|
66 | |||
67 |
|
67 | |||
68 | component Systeme_Clock is |
|
68 | component Systeme_Clock is | |
69 | generic(N :integer := 695); |
|
69 | generic(N :integer := 695); | |
70 | port( |
|
70 | port( | |
71 | clk, raz : in std_logic ; |
|
71 | clk, raz : in std_logic ; | |
72 | clock : out std_logic); |
|
72 | clock : out std_logic); | |
73 | end component; |
|
73 | end component; | |
74 |
|
74 | |||
75 |
|
75 | |||
76 | component Gene_SYNC is |
|
76 | component Gene_SYNC is | |
77 | port( |
|
77 | port( | |
78 | clk,raz : in std_logic; |
|
78 | clk,raz : in std_logic; | |
79 | send : in std_logic; |
|
79 | send : in std_logic; | |
80 | Sysclk : in std_logic; |
|
80 | Sysclk : in std_logic; | |
81 | OKAI_send : out std_logic; |
|
81 | OKAI_send : out std_logic; | |
82 | SYNC : out std_logic); |
|
82 | SYNC : out std_logic); | |
83 | end component; |
|
83 | end component; | |
84 |
|
84 | |||
85 |
|
85 | |||
86 | component Serialize is |
|
86 | component Serialize is | |
87 | port( |
|
87 | port( | |
88 | clk,raz : in std_logic; |
|
88 | clk,raz : in std_logic; | |
89 | sclk : in std_logic; |
|
89 | sclk : in std_logic; | |
90 | vectin : in std_logic_vector(15 downto 0); |
|
90 | vectin : in std_logic_vector(15 downto 0); | |
91 | send : in std_logic; |
|
91 | send : in std_logic; | |
92 | sended : out std_logic; |
|
92 | sended : out std_logic; | |
93 | Data : out std_logic); |
|
93 | Data : out std_logic); | |
94 | end component; |
|
94 | end component; | |
95 |
|
95 | |||
96 | end; |
|
96 | end; |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now