##// END OF EJS Templates
debug lpp_uart and comment lpp_cna
martin -
r40:57b463819bd0 default
parent child
Show More
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -15,7 +15,10
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
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
19 #ifndef APB_CNA_DRIVER_H
22 #ifndef APB_CNA_DRIVER_H
20 #define APB_CNA_DRIVER_H
23 #define APB_CNA_DRIVER_H
21
24
@@ -28,10 +31,11
28 T Y P E S D E F
31 T Y P E S D E F
29 ====================================================*/
32 ====================================================*/
30
33
34 /** Structure repr�sentant le registre du CNA */
31 struct DAC_Driver
35 struct DAC_Driver
32 {
36 {
33 int configReg;
37 int configReg; /**< Registre de configuration: Flag Ready [1] ; Flag Enable [0] */
34 int dataReg;
38 int dataReg; /**< Registre de donn�e sur 16 bits */
35 };
39 };
36
40
37 typedef struct DAC_Driver DAC_Device;
41 typedef struct DAC_Driver DAC_Device;
@@ -40,12 +44,15 typedef struct DAC_Driver DAC_Device;
40 F U N C T I O N S
44 F U N C T I O N S
41 ====================================================*/
45 ====================================================*/
42
46
47 /** Ouvre l'acc� au CNA */
43 DAC_Device* DacOpen(int count);
48 DAC_Device* DacOpen(int count);
44
49
45 //DAC_Device* DacClose(int count);
50 //DAC_Device* DacClose(int count);
46
51
52 /** Les donn�es sont lus a partir d'un tableau pour obtenir le signal de CAL (10Khz + 625hz) */
47 int DacTable();
53 int DacTable();
48
54
55 /** Les donn�es sont entr�e par l'utilisateur, la conversion se fait a chaque nouvelle donn�e */
49 int DacConst();
56 int DacConst();
50
57
51
58
@@ -16,6 +16,9
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 : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
19 #ifndef APB_LCD_DRIVER_H
22 #ifndef APB_LCD_DRIVER_H
20 #define APB_LCD_DRIVER_H
23 #define APB_LCD_DRIVER_H
21
24
@@ -16,6 +16,9
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 : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
19 #ifndef LPP_APB_FUNCTIONS_H
22 #ifndef LPP_APB_FUNCTIONS_H
20 #define LPP_APB_FUNCTIONS_H
23 #define LPP_APB_FUNCTIONS_H
21
24
@@ -15,7 +15,10
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
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
19 #include "apb_dac_Driver.h"
22 #include "apb_dac_Driver.h"
20 #include "lpp_apb_functions.h"
23 #include "lpp_apb_functions.h"
21 #include <stdio.h>
24 #include <stdio.h>
@@ -15,7 +15,10
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
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
19 #ifndef APB_CNA_DRIVER_H
22 #ifndef APB_CNA_DRIVER_H
20 #define APB_CNA_DRIVER_H
23 #define APB_CNA_DRIVER_H
21
24
@@ -28,10 +31,11
28 T Y P E S D E F
31 T Y P E S D E F
29 ====================================================*/
32 ====================================================*/
30
33
34 /** Structure repr�sentant le registre du CNA */
31 struct DAC_Driver
35 struct DAC_Driver
32 {
36 {
33 int configReg;
37 int configReg; /**< Registre de configuration: Flag Ready [1] ; Flag Enable [0] */
34 int dataReg;
38 int dataReg; /**< Registre de donn�e sur 16 bits */
35 };
39 };
36
40
37 typedef struct DAC_Driver DAC_Device;
41 typedef struct DAC_Driver DAC_Device;
@@ -40,12 +44,15 typedef struct DAC_Driver DAC_Device;
40 F U N C T I O N S
44 F U N C T I O N S
41 ====================================================*/
45 ====================================================*/
42
46
47 /** Ouvre l'acc� au CNA */
43 DAC_Device* DacOpen(int count);
48 DAC_Device* DacOpen(int count);
44
49
45 //DAC_Device* DacClose(int count);
50 //DAC_Device* DacClose(int count);
46
51
52 /** Les donn�es sont lus a partir d'un tableau pour obtenir le signal de CAL (10Khz + 625hz) */
47 int DacTable();
53 int DacTable();
48
54
55 /** Les donn�es sont entr�e par l'utilisateur, la conversion se fait a chaque nouvelle donn�e */
49 int DacConst();
56 int DacConst();
50
57
51
58
@@ -1,5 +1,3
1 amba_lcd_16x2_ctrlr.vhd
2 apb_lcd_ctrlr.vhd
3 FRAME_CLK.vhd
1 FRAME_CLK.vhd
4 LCD_16x2_CFG.vhd
2 LCD_16x2_CFG.vhd
5 LCD_16x2_DRVR.vhd
3 LCD_16x2_DRVR.vhd
@@ -7,3 +5,5 LCD_16x2_ENGINE.vhd
7 LCD_2x16_DRIVER.vhd
5 LCD_2x16_DRIVER.vhd
8 LCD_CLK_GENERATOR.vhd
6 LCD_CLK_GENERATOR.vhd
9 Top_LCD.vhd
7 Top_LCD.vhd
8 amba_lcd_16x2_ctrlr.vhd
9 apb_lcd_ctrlr.vhd
@@ -1,12 +1,12
1 APB_IIR_CEL.vhd
1 APB_IIR_CEL.vhd
2 FILTER.vhd
3 FILTER_RAM_CTRLR.vhd
2 FILTERcfg.vhd
4 FILTERcfg.vhd
3 FilterCTRLR.vhd
5 FilterCTRLR.vhd
4 FILTER_RAM_CTRLR.vhd
5 FILTER.vhd
6 IIR_CEL_CTRLR.vhd
6 IIR_CEL_CTRLR.vhd
7 IIR_CEL_FILTER.vhd
7 IIR_CEL_FILTER.vhd
8 iir_filter.vhd
8 RAM.vhd
9 RAM_CEL.vhd
9 RAM_CEL.vhd
10 RAM_CTRLR2.vhd
10 RAM_CTRLR2.vhd
11 RAM.vhd
12 Top_Filtre_IIR.vhd
11 Top_Filtre_IIR.vhd
12 iir_filter.vhd
@@ -1,14 +1,14
1 Adder.vhd
2 ADDRcntr.vhd
1 ADDRcntr.vhd
3 ALU.vhd
2 ALU.vhd
3 Adder.vhd
4 Clk_divider.vhd
4 Clk_divider.vhd
5 general_purpose.vhd
5 MAC.vhd
6 MAC_CONTROLER.vhd
6 MAC_CONTROLER.vhd
7 MAC_MUX2.vhd
8 MAC_MUX.vhd
7 MAC_MUX.vhd
8 MAC_MUX2.vhd
9 MAC_REG.vhd
9 MAC_REG.vhd
10 MAC.vhd
10 MUX2.vhd
11 Multiplier.vhd
11 Multiplier.vhd
12 MUX2.vhd
13 REG.vhd
12 REG.vhd
14 Shifter.vhd
13 Shifter.vhd
14 general_purpose.vhd
@@ -15,7 +15,10
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
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 ------------------------------------------------------------------------------
19 library ieee;
22 library ieee;
20 use ieee.std_logic_1164.all;
23 use ieee.std_logic_1164.all;
21 --use ieee.numeric_std.all;
24 --use ieee.numeric_std.all;
@@ -24,6 +27,7 use grlib.amba.all;
24 use grlib.stdlib.all;
27 use grlib.stdlib.all;
25 use grlib.devices.all;
28 use grlib.devices.all;
26 library lpp;
29 library lpp;
30 use lpp.apb_devices_list.all;
27 use lpp.lpp_amba.all;
31 use lpp.lpp_amba.all;
28
32
29
33
@@ -27,6 +27,7 use grlib.amba.all;
27 use grlib.stdlib.all;
27 use grlib.stdlib.all;
28 use grlib.devices.all;
28 use grlib.devices.all;
29 library lpp;
29 library lpp;
30 use lpp.apb_devices_list.all;
30 use lpp.lpp_amba.all;
31 use lpp.lpp_amba.all;
31
32
32
33
@@ -1,6 +1,4
1 APB_MULTI_DIODE.vhd
2 APB_SIMPLE_DIODE.vhd
1 apb_devices_list.vhd
3 apb_devices_list.vhd
2 APB_MULTI_DIODE.vhd
3 APB_MULTI_DIODE.vhd.orig
4 APB_SIMPLE_DIODE.vhd
5 APB_SIMPLE_DIODE.vhd.orig
6 lpp_amba.vhd
4 lpp_amba.vhd
@@ -15,9 +15,10
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 -- APB_CNA.vhd
19 -- Author : Martin Morlot
20
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 ------------------------------------------------------------------------------
21 library ieee;
22 library ieee;
22 use ieee.std_logic_1164.all;
23 use ieee.std_logic_1164.all;
23 library grlib;
24 library grlib;
@@ -29,6 +30,7 use lpp.lpp_amba.all;
29 use lpp.apb_devices_list.all;
30 use lpp.apb_devices_list.all;
30 use lpp.lpp_cna.all;
31 use lpp.lpp_cna.all;
31
32
33 --! Driver APB, va faire le lien entre l'IP VHDL du convertisseur et le bus Amba
32
34
33 entity APB_CNA is
35 entity APB_CNA is
34 generic (
36 generic (
@@ -38,16 +40,18 entity APB_CNA is
38 pirq : integer := 0;
40 pirq : integer := 0;
39 abits : integer := 8);
41 abits : integer := 8);
40 port (
42 port (
41 clk : in std_logic;
43 clk : in std_logic; --! Horloge du composant
42 rst : in std_logic;
44 rst : in std_logic; --! Reset general du composant
43 apbi : in apb_slv_in_type;
45 apbi : in apb_slv_in_type; --! Registre de gestion des entr�es du bus
44 apbo : out apb_slv_out_type;
46 apbo : out apb_slv_out_type; --! Registre de gestion des sorties du bus
45 SYNC : out std_logic;
47 SYNC : out std_logic; --! Signal de synchronisation du convertisseur
46 SCLK : out std_logic;
48 SCLK : out std_logic; --! Horloge systeme du convertisseur
47 DATA : out std_logic
49 DATA : out std_logic --! Donn�e num�rique s�rialis�
48 );
50 );
49 end APB_CNA;
51 end APB_CNA;
50
52
53 --! @details Les deux registres (apbi,apbo) permettent de g�rer la communication sur le bus
54 --! et les sorties seront cabl�es vers le convertisseur.
51
55
52 architecture ar_APB_CNA of APB_CNA is
56 architecture ar_APB_CNA of APB_CNA is
53
57
@@ -15,28 +15,32
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 -- CNA_TabloC.vhd
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 ------------------------------------------------------------------------------
20 library IEEE;
22 library IEEE;
21 use IEEE.std_logic_1164.all;
23 use IEEE.std_logic_1164.all;
22 use IEEE.numeric_std.all;
24 use IEEE.numeric_std.all;
23 use work.Convertisseur_config.all;
25 use work.Convertisseur_config.all;
24
26
27 --! Programme du Convertisseur Num�rique/Analogique
28
25 entity CNA_TabloC is
29 entity CNA_TabloC is
26 port(
30 port(
27 clock : in std_logic;
31 clock : in std_logic; --! Horloge du composant
28 rst : in std_logic;
32 rst : in std_logic; --! Reset general du composant
29 enable : in std_logic;
33 enable : in std_logic; --! Autorise ou non l'utilisation du composant
30 --bp : in std_logic;
34 Data_C : in std_logic_vector(15 downto 0); --! Donn�e Num�rique d'entr�e sur 16 bits
31 Data_C : in std_logic_vector(15 downto 0);
35 SYNC : out std_logic; --! Signal de synchronisation du convertisseur
32 SYNC : out std_logic;
36 SCLK : out std_logic; --! Horloge systeme du convertisseur
33 SCLK : out std_logic;
37 flag_sd : out std_logic; --! Flag, signale la fin de la s�rialisation d'une donn�e
34 --Rz : out std_logic;
38 Data : out std_logic --! Donn�e num�rique s�rialis�
35 flag_sd : out std_logic;
36 Data : out std_logic
37 );
39 );
38 end CNA_TabloC;
40 end CNA_TabloC;
39
41
42 --! @details Un driver C va permettre de g�nerer un tableau de donn�es sur 16 bits,
43 --! qui seront s�rialis� pour �tre ensuite dirig�es vers le convertisseur.
40
44
41 architecture ar_CNA_TabloC of CNA_TabloC is
45 architecture ar_CNA_TabloC of CNA_TabloC is
42
46
@@ -50,11 +54,9 signal clk : std_logic;
50 signal raz : std_logic;
54 signal raz : std_logic;
51 signal s_SCLK : std_logic;
55 signal s_SCLK : std_logic;
52 signal OKAI_send : std_logic;
56 signal OKAI_send : std_logic;
53 --signal Data_int : std_logic_vector(15 downto 0);
54
57
55 begin
58 begin
56
59
57
58 CLKINT_0 : CLKINT
60 CLKINT_0 : CLKINT
59 port map(A => clock, Y => clk);
61 port map(A => clock, Y => clk);
60
62
@@ -75,11 +77,6 Serial : entity work.serialize
75 port map (clk,raz,s_SCLK,Data_C,OKAI_send,flag_sd,Data);
77 port map (clk,raz,s_SCLK,Data_C,OKAI_send,flag_sd,Data);
76
78
77
79
78 --Rz <= raz;
79 SCLK <= s_SCLK;
80 SCLK <= s_SCLK;
80
81
81 --with bp select
82 -- Data_int <= X"9555" when '1',
83 -- Data_C when others;
84
85 end ar_CNA_TabloC; No newline at end of file
82 end ar_CNA_TabloC;
@@ -15,24 +15,16
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 -- Convertisseur_config.vhd
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 ------------------------------------------------------------------------------
20 library IEEE;
22 library IEEE;
21 use IEEE.std_logic_1164.all;
23 use IEEE.std_logic_1164.all;
22 use IEEE.numeric_std.all;
24 use IEEE.numeric_std.all;
23
25
24 Package Convertisseur_config is
26 Package Convertisseur_config is
25
27
26
27 --===========================================================|
28 --================= Valeurs Sinus 1Khz ======================|
29 --===========================================================|
30 type Tbl is array(natural range <>) of std_logic_vector(11 downto 0);
31 constant Tablo : Tbl (0 to 49):= (X"800",X"901",X"9FD",X"AF2",X"BDB",X"CB4",X"D7A",X"E2A",X"EC1",X"F3D",X"F9C",X"FDC",X"FFC",X"FFC",X"FDC",X"F9C",X"F3D",X"EC1",X"E2A",X"D7A",X"CB4",X"BDB",X"AF2",X"9FD",X"901",X"800",X"6FF",X"603",X"50E",X"425",X"34C",X"286",X"1D6",X"13F",X"0C3",X"064",X"024",X"004",X"004",X"024",X"064",X"0C3",X"13F",X"1D6",X"286",X"34C",X"425",X"50E",X"603",X"6FF");
32
33 --constant Tablo : Tbl (0 to 49):= (X"C00",X"C80",X"CFF",X"D79",X"DED",X"E5A",X"EBD",X"F15",X"F61",X"F9F",X"FCE",X"FEE",X"FFE",X"FFE",X"FEE",X"FCE",X"F9F",X"F61",X"F15",X"EBD",X"E5A",X"DED",X"D79",X"CFF",X"C80",X"C00",X"B80",X"B01",X"A87",X"A13",X"9A6",X"943",X"8EB",X"89F",X"861",X"832",X"812",X"802",X"802",X"812",X"832",X"861",X"89F",X"8EB",X"943",X"9A6",X"A13",X"A87",X"B01",X"B80");
34
35
36 --===========================================================|
28 --===========================================================|
37 --============= Fr�quence de s�rialisation ==================|
29 --============= Fr�quence de s�rialisation ==================|
38 --===========================================================|
30 --===========================================================|
@@ -15,44 +15,42
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 -- Gene_SYNC.vhd
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 ------------------------------------------------------------------------------
20 library IEEE;
22 library IEEE;
21 use IEEE.std_logic_1164.all;
23 use IEEE.std_logic_1164.all;
22 use IEEE.numeric_std.all;
24 use IEEE.numeric_std.all;
23
25
26 --! Programme qui va permettre de g�n�rer le signal SYNC
27
24 entity Gene_SYNC is
28 entity Gene_SYNC is
25
26 port(
29 port(
27 SCLK,raz : in std_logic;
30 SCLK,raz : in std_logic; --! Horloge systeme et Reset du composant
28 enable : in std_logic;
31 enable : in std_logic; --! Autorise ou non l'utilisation du composant
29 -- Sysclk : in std_logic;
32 OKAI_send : out std_logic; --! Flag, Autorise l'envoi (s�rialisation) d'une nouvelle donn�e
30 OKAI_send : out std_logic;
33 SYNC : out std_logic --! Signal de synchronisation du convertisseur g�n�r�
31 SYNC : out std_logic
32 );
34 );
33
34 end Gene_SYNC;
35 end Gene_SYNC;
35
36
37 --! @details NB: Ce programme est uniquement synchronis� sur l'horloge Systeme (sclk)
36
38
37 architecture ar_Gene_SYNC of Gene_SYNC is
39 architecture ar_Gene_SYNC of Gene_SYNC is
38
40
39 --signal Sysclk_reg : std_logic;
40 signal count : integer;
41 signal count : integer;
41
42
42
43 begin
43 begin
44 process (SCLK,raz)
44 process (SCLK,raz)
45 begin
45 begin
46 if(raz='0')then
46 if(raz='0')then
47 SYNC <= '0';
47 SYNC <= '0';
48 -- Sysclk_reg <= '0';
49 count <= 14;
48 count <= 14;
50 OKAI_send <= '0';
49 OKAI_send <= '0';
51
50
52 elsif(SCLK' event and SCLK='1')then
51 elsif(SCLK' event and SCLK='1')then
53 if(enable='1')then
52 if(enable='1')then
54
53
55 -- Sysclk_reg <= Sysclk;
56 if(count=15)then
54 if(count=15)then
57 SYNC <= '1';
55 SYNC <= '1';
58 count <= count+1;
56 count <= count+1;
@@ -64,8 +62,8 begin
64 count <= count+1;
62 count <= count+1;
65 OKAI_send <= '0';
63 OKAI_send <= '0';
66 end if;
64 end if;
65
67 end if;
66 end if;
68 end if;
67 end if;
69 end process;
68 end process;
70
71 end ar_Gene_SYNC; No newline at end of file
69 end ar_Gene_SYNC;
@@ -15,22 +15,25
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 -- Serialize.vhd
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 ------------------------------------------------------------------------------
20 library IEEE;
22 library IEEE;
21 use IEEE.numeric_std.all;
23 use IEEE.numeric_std.all;
22 use IEEE.std_logic_1164.all;
24 use IEEE.std_logic_1164.all;
23
25
26 --! Programme qui permet de s�rialiser un vecteur
27
24 entity Serialize is
28 entity Serialize is
25
26 port(
29 port(
27 clk,raz : in std_logic;
30 clk,raz : in std_logic; --! Horloge et Reset du composant
28 sclk : in std_logic;
31 sclk : in std_logic; --! Horloge Systeme
29 vectin : in std_logic_vector(15 downto 0);
32 vectin : in std_logic_vector(15 downto 0); --! Vecteur d'entr�e
30 send : in std_logic;
33 send : in std_logic; --! Flag, Une nouvelle donn�e est pr�sente
31 sended : out std_logic;
34 sended : out std_logic; --! Flag, La donn�e a �t� s�rialis�e
32 Data : out std_logic);
35 Data : out std_logic --! Donn�e num�rique s�rialis�
33
36 );
34 end Serialize;
37 end Serialize;
35
38
36
39
@@ -15,8 +15,10
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 -- Systeme_Clock.vhd
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 ------------------------------------------------------------------------------
20 library IEEE;
22 library IEEE;
21 use IEEE.std_logic_1164.all;
23 use IEEE.std_logic_1164.all;
22 use IEEE.numeric_std.all;
24 use IEEE.numeric_std.all;
@@ -26,12 +28,13 use IEEE.numeric_std.all;
26 entity Systeme_Clock is
28 entity Systeme_Clock is
27 generic(N :integer := 695); --! G�n�rique contenant le r�sultat de la division clk/sclk
29 generic(N :integer := 695); --! G�n�rique contenant le r�sultat de la division clk/sclk
28 port(
30 port(
29 clk, raz : in std_logic; --! Horloge et Reset globale
31 clk, raz : in std_logic; --! Horloge et Reset globale du composant
30 sclk : out std_logic --! Horloge Systeme g�n�r�e
32 sclk : out std_logic --! Horloge Systeme g�n�r�e
31 );
33 );
32 end Systeme_Clock;
34 end Systeme_Clock;
33
35
34 --! @details Fonctionne a base d'un compteur (countint) qui va permetre de diviser l'horloge N fois
36 --! @details Fonctionne a base d'un compteur (countint) qui va permetre de diviser l'horloge N fois
37
35 architecture ar_Systeme_Clock of Systeme_Clock is
38 architecture ar_Systeme_Clock of Systeme_Clock is
36
39
37 signal clockint : std_logic;
40 signal clockint : std_logic;
@@ -15,17 +15,19
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
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 ------------------------------------------------------------------------------
19 library ieee;
22 library ieee;
20 use ieee.std_logic_1164.all;
23 use ieee.std_logic_1164.all;
21 library grlib;
24 library grlib;
22 use grlib.amba.all;
25 use grlib.amba.all;
23 -- pragma translate_off
24 use std.textio.all;
26 use std.textio.all;
25 -- pragma translate_on
26 library lpp;
27 library lpp;
27 use lpp.lpp_amba.all;
28 use lpp.lpp_amba.all;
28
29
30 --! Package contenant tous les programmes qui forment le composant int�gr� dans le l�on
29
31
30 package lpp_cna is
32 package lpp_cna is
31
33
@@ -15,7 +15,10
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
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 ------------------------------------------------------------------------------
19 library ieee;
22 library ieee;
20 use ieee.std_logic_1164.all;
23 use ieee.std_logic_1164.all;
21 library grlib;
24 library grlib;
@@ -27,6 +30,8 use lpp.lpp_amba.all;
27 use lpp.apb_devices_list.all;
30 use lpp.apb_devices_list.all;
28 use lpp.lpp_uart.all;
31 use lpp.lpp_uart.all;
29
32
33 --! Driver APB, va faire le lien entre l'IP VHDL de l'UART et le bus Amba
34
30 entity APB_UART is
35 entity APB_UART is
31 generic (
36 generic (
32 pindex : integer := 0;
37 pindex : integer := 0;
@@ -36,12 +41,12 entity APB_UART is
36 abits : integer := 8;
41 abits : integer := 8;
37 Data_sz : integer := 8);
42 Data_sz : integer := 8);
38 port (
43 port (
39 clk : in std_logic;
44 clk : in std_logic; --! Horloge du composant
40 rst : in std_logic;
45 rst : in std_logic; --! Reset general du composant
41 apbi : in apb_slv_in_type;
46 apbi : in apb_slv_in_type; --! Registre de gestion des entr�es du bus
42 apbo : out apb_slv_out_type;
47 apbo : out apb_slv_out_type; --! Registre de gestion des sorties du bus
43 TXD : out std_logic;
48 TXD : out std_logic; --! Transmission s�rie, c�t� composant
44 RXD : in std_logic
49 RXD : in std_logic --! Reception s�rie, c�t� composant
45 );
50 );
46 end APB_UART;
51 end APB_UART;
47
52
@@ -61,7 +66,7 signal Send : std_logic;
61 signal Sended : std_logic;
66 signal Sended : std_logic;
62
67
63 type UART_ctrlr_Reg is record
68 type UART_ctrlr_Reg is record
64 UART_Cfg : std_logic_vector(4 downto 0);
69 UART_Cfg : std_logic_vector(2 downto 0);
65 UART_Wdata : std_logic_vector(7 downto 0);
70 UART_Wdata : std_logic_vector(7 downto 0);
66 UART_Rdata : std_logic_vector(7 downto 0);
71 UART_Rdata : std_logic_vector(7 downto 0);
67 UART_BTrig : std_logic_vector(11 downto 0);
72 UART_BTrig : std_logic_vector(11 downto 0);
@@ -69,14 +74,15 end record;
69
74
70 signal Rec : UART_ctrlr_Reg;
75 signal Rec : UART_ctrlr_Reg;
71 signal Rdata : std_logic_vector(31 downto 0);
76 signal Rdata : std_logic_vector(31 downto 0);
77 signal temp_ND : std_logic;
72
78
73 begin
79 begin
74
80
75 Capture <= Rec.UART_Cfg(0);
81 Capture <= Rec.UART_Cfg(0);
76 --ACK <= Rec.UART_Cfg(1);
82 --ACK <= Rec.UART_Cfg(1);
77 --Send <= Rec.UART_Cfg(2);
83 --Send <= Rec.UART_Cfg(1);
78 Rec.UART_Cfg(3) <= Sended;
84 Rec.UART_Cfg(1) <= Sended;
79 Rec.UART_Cfg(4) <= NwData;
85 Rec.UART_Cfg(2) <= NwData;
80
86
81
87
82 COM0 : entity work.UART
88 COM0 : entity work.UART
@@ -91,15 +97,21 Rec.UART_Cfg(4) <= NwData;
91
97
92
98
93 elsif(clk'event and clk='1')then
99 elsif(clk'event and clk='1')then
94
100 temp_ND <= NwData;
101 if(NwData='1' and temp_ND='1')then
102 ACK <= '1';
103 else
104 ACK <= '0';
105 end if;
95
106
96 --APB Write OP
107 --APB Write OP
97 if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then
108 if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then
98 case apbi.paddr(7 downto 2) is
109 case apbi.paddr(7 downto 2) is
99 when "000000" =>
110 when "000000" =>
100 Rec.UART_Cfg(2 downto 0) <= apbi.pwdata(2 downto 0);
111 Rec.UART_Cfg(0) <= apbi.pwdata(0);
112 --Rec.UART_Cfg(1) <= apbi.pwdata(4);
101 when "000001" =>
113 when "000001" =>
102 Rec.UART_Wdata <= apbi.pwdata(7 downto 0);
114 Rec.UART_Wdata(7 downto 0) <= apbi.pwdata(7 downto 0);
103 Send <= '1';
115 Send <= '1';
104 when others =>
116 when others =>
105 null;
117 null;
@@ -112,19 +124,23 Rec.UART_Cfg(4) <= NwData;
112 if (apbi.psel(pindex) and (not apbi.pwrite)) = '1' then
124 if (apbi.psel(pindex) and (not apbi.pwrite)) = '1' then
113 case apbi.paddr(7 downto 2) is
125 case apbi.paddr(7 downto 2) is
114 when "000000" =>
126 when "000000" =>
115 Rdata(4 downto 0) <= Rec.UART_Cfg;
127 Rdata(3 downto 0) <= "000" & Rec.UART_Cfg(0);
116 Rdata(26 downto 12) <= (others => '0');
128 Rdata(7 downto 4) <= "000" & Rec.UART_Cfg(1);
117 Rdata(27 downto 16) <= Rec.UART_BTrig;
129 Rdata(11 downto 8) <= "000" & Rec.UART_Cfg(2);
130 Rdata(19 downto 12) <= X"EE";
131 Rdata(31 downto 20) <= Rec.UART_BTrig;
118 when "000001" =>
132 when "000001" =>
133 Rdata(31 downto 8) <= X"EEEEEE";
119 Rdata(7 downto 0) <= Rec.UART_Wdata;
134 Rdata(7 downto 0) <= Rec.UART_Wdata;
120 when "000010" =>
135 when "000010" =>
136 Rdata(31 downto 8) <= X"EEEEEE";
121 Rdata(7 downto 0) <= Rec.UART_Rdata;
137 Rdata(7 downto 0) <= Rec.UART_Rdata;
122 Ack <= '1';
138 --Ack <= '1';
123 when others =>
139 when others =>
124 Rdata <= (others => '0');
140 Rdata <= (others => '0');
125 end case;
141 end case;
126 else
142 --else
127 Ack <= '0';
143 --Ack <= '0';
128 end if;
144 end if;
129
145
130 end if;
146 end if;
@@ -46,6 +46,7 architecture ar_Shift_REG of Shift_REG i
46 signal REG : std_logic_vector(Data_sz-1 downto 0);
46 signal REG : std_logic_vector(Data_sz-1 downto 0);
47 signal Serialized_int : std_logic;
47 signal Serialized_int : std_logic;
48 signal Serialize_reg : std_logic;
48 signal Serialize_reg : std_logic;
49 signal Serial_reg : std_logic;
49 signal CptBits : std_logic_vector(Data_sz-1 downto 0);
50 signal CptBits : std_logic_vector(Data_sz-1 downto 0);
50 constant CptBits_trig : std_logic_vector(Data_sz-1 downto 0) := (others => '1');
51 constant CptBits_trig : std_logic_vector(Data_sz-1 downto 0) := (others => '1');
51 signal CptBits_flag : std_logic;
52 signal CptBits_flag : std_logic;
@@ -61,14 +62,16 begin
61 if reset = '0' then
62 if reset = '0' then
62 Serialized_int <= '1';
63 Serialized_int <= '1';
63 CptBits_flag_reg <= '0';
64 CptBits_flag_reg <= '0';
65 Serial_reg <= '0';
64 Q <= (others => '0');
66 Q <= (others => '0');
65 elsif clk'event and clk = '1' then
67 elsif clk'event and clk = '1' then
66 CptBits_flag_reg <= CptBits_flag;
68 CptBits_flag_reg <= CptBits_flag;
69 Serial_reg <= Serialize;
67
70
68 if CptBits_flag = '1' and CptBits_flag_reg = '0' then
71 if CptBits_flag = '1' and CptBits_flag_reg = '0' then
69 Serialized_int <= '1';
72 Serialized_int <= '1';
70 Q <= REG;
73 Q <= REG;
71 elsif Serialize = '1' then
74 elsif(Serial_reg='0' and Serialize='1')then
72 Serialized_int <= '0';
75 Serialized_int <= '0';
73 end if;
76 end if;
74 end if;
77 end if;
@@ -45,9 +45,9 port(
45 );
45 );
46 end entity;
46 end entity;
47
47
48
49 --! @details Gestion de la Reception/Transmission donc de la Vectorisation/Serialisation
48 --! @details Gestion de la Reception/Transmission donc de la Vectorisation/Serialisation
50 --! ainsi que la detection et le reglage de le frequence de transmission optimale sur le bus (Generateur de Bauds)
49 --! ainsi que la detection et le reglage de le frequence de transmission optimale sur le bus (Generateur de Bauds)
50
51 architecture ar_UART of UART is
51 architecture ar_UART of UART is
52 signal Bclk : std_logic;
52 signal Bclk : std_logic;
53
53
General Comments 0
You need to be logged in to leave comments. Login now