@@ -0,0 +1,105 | |||||
|
1 | -- APB_CNA.vhd | |||
|
2 | ||||
|
3 | library ieee; | |||
|
4 | use ieee.std_logic_1164.all; | |||
|
5 | library grlib; | |||
|
6 | use grlib.amba.all; | |||
|
7 | use grlib.stdlib.all; | |||
|
8 | use grlib.devices.all; | |||
|
9 | library lpp; | |||
|
10 | use lpp.lpp_amba.all; | |||
|
11 | use lpp.lpp_cna.all; | |||
|
12 | ||||
|
13 | ||||
|
14 | entity APB_CNA is | |||
|
15 | generic ( | |||
|
16 | pindex : integer := 0; | |||
|
17 | paddr : integer := 0; | |||
|
18 | pmask : integer := 16#fff#; | |||
|
19 | pirq : integer := 0; | |||
|
20 | abits : integer := 8); | |||
|
21 | port ( | |||
|
22 | clk : in std_logic; | |||
|
23 | rst : in std_logic; | |||
|
24 | apbi : in apb_slv_in_type; | |||
|
25 | apbo : out apb_slv_out_type; | |||
|
26 | SYNC : out std_logic; | |||
|
27 | SCLK : out std_logic; | |||
|
28 | DATA : out std_logic | |||
|
29 | ); | |||
|
30 | end APB_CNA; | |||
|
31 | ||||
|
32 | ||||
|
33 | architecture ar_APB_CNA of APB_CNA is | |||
|
34 | ||||
|
35 | constant REVISION : integer := 1; | |||
|
36 | ||||
|
37 | constant pconfig : apb_config_type := ( | |||
|
38 | 0 => ahb_device_reg (VENDOR_LPP, LPP_CNA, 0, REVISION, 0), | |||
|
39 | 1 => apb_iobar(paddr, pmask)); | |||
|
40 | ||||
|
41 | signal flag_nw : std_logic; | |||
|
42 | signal bp : std_logic; | |||
|
43 | signal Rz : std_logic; | |||
|
44 | signal flag_sd : std_logic; | |||
|
45 | ||||
|
46 | type CNA_ctrlr_Reg is record | |||
|
47 | CNA_Cfg : std_logic_vector(3 downto 0); | |||
|
48 | CNA_Data : std_logic_vector(15 downto 0); | |||
|
49 | end record; | |||
|
50 | ||||
|
51 | signal Rec : CNA_ctrlr_Reg; | |||
|
52 | signal Rdata : std_logic_vector(31 downto 0); | |||
|
53 | ||||
|
54 | begin | |||
|
55 | ||||
|
56 | bp <= Rec.CNA_Cfg(0); | |||
|
57 | flag_nw <= Rec.CNA_Cfg(1); | |||
|
58 | Rec.CNA_Cfg(2) <= flag_sd; | |||
|
59 | Rec.CNA_Cfg(3) <= Rz; | |||
|
60 | ||||
|
61 | ||||
|
62 | CONVERTER : entity Work.CNA_TabloC | |||
|
63 | port map(clk,rst,flag_nw,bp,Rec.CNA_Data,SYNC,SCLK,Rz,flag_sd,Data); | |||
|
64 | ||||
|
65 | ||||
|
66 | process(rst,clk) | |||
|
67 | begin | |||
|
68 | if(rst='0')then | |||
|
69 | Rec.CNA_Data <= (others => '0'); | |||
|
70 | ||||
|
71 | elsif(clk'event and clk='1')then | |||
|
72 | ||||
|
73 | ||||
|
74 | --APB Write OP | |||
|
75 | if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then | |||
|
76 | case apbi.paddr(abits-1 downto 2) is | |||
|
77 | when "000000" => | |||
|
78 | Rec.CNA_Cfg(1 downto 0) <= apbi.pwdata(1 downto 0); | |||
|
79 | when "000001" => | |||
|
80 | Rec.CNA_Data <= apbi.pwdata(15 downto 0); | |||
|
81 | when others => | |||
|
82 | null; | |||
|
83 | end case; | |||
|
84 | end if; | |||
|
85 | ||||
|
86 | --APB READ OP | |||
|
87 | if (apbi.psel(pindex) and (not apbi.pwrite)) = '1' then | |||
|
88 | case apbi.paddr(abits-1 downto 2) is | |||
|
89 | when "000000" => | |||
|
90 | Rdata(31 downto 4) <= X"ABCDEF5"; | |||
|
91 | Rdata(3 downto 0) <= Rec.CNA_Cfg; | |||
|
92 | when "000001" => | |||
|
93 | Rdata(31 downto 16) <= X"FD18"; | |||
|
94 | Rdata(15 downto 0) <= Rec.CNA_Data; | |||
|
95 | when others => | |||
|
96 | Rdata <= (others => '0'); | |||
|
97 | end case; | |||
|
98 | end if; | |||
|
99 | ||||
|
100 | end if; | |||
|
101 | apbo.pconfig <= pconfig; | |||
|
102 | end process; | |||
|
103 | ||||
|
104 | apbo.prdata <= Rdata when apbi.penable = '1'; | |||
|
105 | end ar_APB_CNA; No newline at end of file |
@@ -0,0 +1,71 | |||||
|
1 | -- CNA_TabloC.vhd | |||
|
2 | library IEEE; | |||
|
3 | use IEEE.std_logic_1164.all; | |||
|
4 | use IEEE.numeric_std.all; | |||
|
5 | use work.Convertisseur_config.all; | |||
|
6 | ||||
|
7 | entity CNA_TabloC is | |||
|
8 | port( | |||
|
9 | clock : in std_logic; | |||
|
10 | rst : in std_logic; | |||
|
11 | flag_nw : in std_logic; | |||
|
12 | bp : in std_logic; | |||
|
13 | Data_C : in std_logic_vector(15 downto 0); | |||
|
14 | SYNC : out std_logic; | |||
|
15 | SCLK : out std_logic; | |||
|
16 | Rz : out std_logic; | |||
|
17 | flag_sd : out std_logic; | |||
|
18 | Data : out std_logic | |||
|
19 | ); | |||
|
20 | end CNA_TabloC; | |||
|
21 | ||||
|
22 | ||||
|
23 | architecture ar_CNA_TabloC of CNA_TabloC is | |||
|
24 | ||||
|
25 | component CLKINT | |||
|
26 | port( A : in std_logic := 'U'; | |||
|
27 | Y : out std_logic); | |||
|
28 | end component; | |||
|
29 | ||||
|
30 | signal clk : std_logic; | |||
|
31 | --signal reset : std_logic; | |||
|
32 | ||||
|
33 | signal raz : std_logic; | |||
|
34 | signal sys_clk : std_logic; | |||
|
35 | signal Data_int : std_logic_vector(15 downto 0); | |||
|
36 | signal OKAI_send : std_logic; | |||
|
37 | ||||
|
38 | begin | |||
|
39 | ||||
|
40 | ||||
|
41 | CLKINT_0 : CLKINT | |||
|
42 | port map(A => clock, Y => clk); | |||
|
43 | ||||
|
44 | CLKINT_1 : CLKINT | |||
|
45 | port map(A => rst, Y => raz); | |||
|
46 | ||||
|
47 | ||||
|
48 | SystemCLK : entity work.Clock_Serie | |||
|
49 | generic map (nb_serial) | |||
|
50 | port map (clk,raz,sys_clk); | |||
|
51 | ||||
|
52 | ||||
|
53 | Signal_sync : entity work.GeneSYNC_flag | |||
|
54 | port map (clk,raz,flag_nw,sys_clk,OKAI_send,SYNC); | |||
|
55 | ||||
|
56 | ||||
|
57 | Serial : entity work.serialize | |||
|
58 | port map (clk,raz,sys_clk,Data_int,OKAI_send,flag_sd,Data); | |||
|
59 | ||||
|
60 | ||||
|
61 | --raz <= not reset; | |||
|
62 | Rz <= raz; | |||
|
63 | SCLK <= not sys_clk; | |||
|
64 | --Data_Cvec <= std_logic_vector(to_unsigned(Data_C,12)); | |||
|
65 | --Data_TOT <= "0001" & Data_Cvec; | |||
|
66 | ||||
|
67 | with bp select | |||
|
68 | Data_int <= X"9555" when '1', | |||
|
69 | Data_C when others; | |||
|
70 | ||||
|
71 | end ar_CNA_TabloC; No newline at end of file |
@@ -0,0 +1,24 | |||||
|
1 | -- Convertisseur_config.vhd | |||
|
2 | library IEEE; | |||
|
3 | use IEEE.std_logic_1164.all; | |||
|
4 | use IEEE.numeric_std.all; | |||
|
5 | ||||
|
6 | Package Convertisseur_config is | |||
|
7 | ||||
|
8 | ||||
|
9 | --===========================================================| | |||
|
10 | --================= Valeurs Sinus 1Khz ======================| | |||
|
11 | --===========================================================| | |||
|
12 | type Tbl is array(natural range <>) of std_logic_vector(11 downto 0); | |||
|
13 | 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"); | |||
|
14 | ||||
|
15 | --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"); | |||
|
16 | ||||
|
17 | ||||
|
18 | --===========================================================| | |||
|
19 | --============= Fr�quence de s�rialisation ==================| | |||
|
20 | --===========================================================| | |||
|
21 | constant Freq_serial : integer := 1_000_000; | |||
|
22 | constant nb_serial : integer := 40_000_000 / Freq_serial; | |||
|
23 | ||||
|
24 | end; No newline at end of file |
@@ -0,0 +1,94 | |||||
|
1 | -- GeneSYNC_flag.vhd | |||
|
2 | library IEEE; | |||
|
3 | use IEEE.std_logic_1164.all; | |||
|
4 | use IEEE.numeric_std.all; | |||
|
5 | ||||
|
6 | entity GeneSYNC_flag is | |||
|
7 | ||||
|
8 | port( | |||
|
9 | clk,raz : in std_logic; | |||
|
10 | flag_nw : in std_logic; | |||
|
11 | Sysclk : in std_logic; | |||
|
12 | OKAI_send : out std_logic; | |||
|
13 | SYNC : out std_logic | |||
|
14 | ); | |||
|
15 | ||||
|
16 | end GeneSYNC_flag; | |||
|
17 | ||||
|
18 | ||||
|
19 | architecture ar_GeneSYNC_flag of GeneSYNC_flag is | |||
|
20 | ||||
|
21 | signal Sysclk_reg : std_logic; | |||
|
22 | signal flag_nw_reg : std_logic; | |||
|
23 | signal count : integer; | |||
|
24 | ||||
|
25 | type etat is (e0,e1,e2,eX); | |||
|
26 | signal ect : etat; | |||
|
27 | ||||
|
28 | begin | |||
|
29 | process (clk,raz) | |||
|
30 | begin | |||
|
31 | if(raz='0')then | |||
|
32 | SYNC <= '0'; | |||
|
33 | Sysclk_reg <= '0'; | |||
|
34 | flag_nw_reg <= '0'; | |||
|
35 | count <= 14; | |||
|
36 | OKAI_send <= '0'; | |||
|
37 | ect <= e0; | |||
|
38 | ||||
|
39 | elsif(clk' event and clk='1')then | |||
|
40 | Sysclk_reg <= Sysclk; | |||
|
41 | flag_nw_reg <= flag_nw; | |||
|
42 | ||||
|
43 | case ect is | |||
|
44 | when e0 => | |||
|
45 | if(flag_nw_reg='0' and flag_nw='1')then | |||
|
46 | ect <= e1; | |||
|
47 | else | |||
|
48 | count <= 14; | |||
|
49 | ect <= e0; | |||
|
50 | end if; | |||
|
51 | ||||
|
52 | ||||
|
53 | when e1 => | |||
|
54 | if(Sysclk_reg='1' and Sysclk='0')then | |||
|
55 | if(count=15)then | |||
|
56 | SYNC <= '1'; | |||
|
57 | count <= count+1; | |||
|
58 | ect <= e2; | |||
|
59 | elsif(count=16)then | |||
|
60 | count <= 0; | |||
|
61 | OKAI_send <= '1'; | |||
|
62 | ect <= eX; | |||
|
63 | else | |||
|
64 | count <= count+1; | |||
|
65 | OKAI_send <= '0'; | |||
|
66 | ect <= e1; | |||
|
67 | end if; | |||
|
68 | end if; | |||
|
69 | ||||
|
70 | ||||
|
71 | when e2 => | |||
|
72 | if(Sysclk_reg='0' and Sysclk='1')then | |||
|
73 | if(count=16)then | |||
|
74 | SYNC <= '0'; | |||
|
75 | ect <= e1; | |||
|
76 | end if; | |||
|
77 | end if; | |||
|
78 | ||||
|
79 | when eX => | |||
|
80 | if(Sysclk_reg='0' and Sysclk='1')then | |||
|
81 | if(count=15)then | |||
|
82 | OKAI_send <= '0'; | |||
|
83 | ect <= e0; | |||
|
84 | else | |||
|
85 | count <= count+1; | |||
|
86 | ect <= eX; | |||
|
87 | end if; | |||
|
88 | end if; | |||
|
89 | ||||
|
90 | end case; | |||
|
91 | end if; | |||
|
92 | ||||
|
93 | end process; | |||
|
94 | end ar_GeneSYNC_flag; No newline at end of file |
@@ -0,0 +1,86 | |||||
|
1 | -- Serialize.vhd | |||
|
2 | library IEEE; | |||
|
3 | use IEEE.numeric_std.all; | |||
|
4 | use IEEE.std_logic_1164.all; | |||
|
5 | ||||
|
6 | entity Serialize is | |||
|
7 | ||||
|
8 | port( | |||
|
9 | clk,raz : in std_logic; | |||
|
10 | sclk : in std_logic; | |||
|
11 | vectin : in std_logic_vector(15 downto 0); | |||
|
12 | send : in std_logic; | |||
|
13 | sended : out std_logic; | |||
|
14 | Data : out std_logic); | |||
|
15 | ||||
|
16 | end Serialize; | |||
|
17 | ||||
|
18 | ||||
|
19 | architecture ar_Serialize of Serialize is | |||
|
20 | ||||
|
21 | type etat is (attente,serialize); | |||
|
22 | signal ect : etat; | |||
|
23 | ||||
|
24 | signal vector_int : std_logic_vector(16 downto 0); | |||
|
25 | signal vectin_reg : std_logic_vector(15 downto 0); | |||
|
26 | signal load : std_logic; | |||
|
27 | signal N : integer range 0 to 16; | |||
|
28 | signal CPT_ended : std_logic:='0'; | |||
|
29 | ||||
|
30 | begin | |||
|
31 | process(clk,raz) | |||
|
32 | begin | |||
|
33 | if(raz='0')then | |||
|
34 | ect <= attente; | |||
|
35 | vectin_reg <= (others=> '0'); | |||
|
36 | load <= '0'; | |||
|
37 | sended <= '1'; | |||
|
38 | ||||
|
39 | elsif(clk'event and clk='1')then | |||
|
40 | vectin_reg <= vectin; | |||
|
41 | ||||
|
42 | case ect is | |||
|
43 | when attente => | |||
|
44 | if (send='1') then | |||
|
45 | sended <= '0'; | |||
|
46 | load <= '1'; | |||
|
47 | ect <= serialize; | |||
|
48 | else | |||
|
49 | ect <= attente; | |||
|
50 | end if; | |||
|
51 | ||||
|
52 | when serialize => | |||
|
53 | load <= '0'; | |||
|
54 | if(CPT_ended='1')then | |||
|
55 | ect <= attente; | |||
|
56 | sended <= '1'; | |||
|
57 | end if; | |||
|
58 | ||||
|
59 | end case; | |||
|
60 | end if; | |||
|
61 | end process; | |||
|
62 | ||||
|
63 | process(sclk,load,raz) | |||
|
64 | begin | |||
|
65 | if (raz='0')then | |||
|
66 | vector_int <= (others=> '0'); | |||
|
67 | N <= 16; | |||
|
68 | elsif(load='1')then | |||
|
69 | vector_int <= vectin & '0'; | |||
|
70 | N <= 0; | |||
|
71 | elsif(sclk'event and sclk='0')then | |||
|
72 | if (CPT_ended='0') then | |||
|
73 | vector_int <= vector_int(15 downto 0) & '0'; | |||
|
74 | N <= N+1; | |||
|
75 | end if; | |||
|
76 | end if; | |||
|
77 | end process; | |||
|
78 | ||||
|
79 | CPT_ended <= '1' when N = 16 else '0'; | |||
|
80 | ||||
|
81 | with ect select | |||
|
82 | Data <= vector_int(16) when serialize, | |||
|
83 | '0' when others; | |||
|
84 | ||||
|
85 | end ar_Serialize; | |||
|
86 |
@@ -0,0 +1,41 | |||||
|
1 | -- clock.vhd | |||
|
2 | library IEEE; | |||
|
3 | use IEEE.std_logic_1164.all; | |||
|
4 | use IEEE.numeric_std.all; | |||
|
5 | ||||
|
6 | ||||
|
7 | entity Clock_Serie is | |||
|
8 | ||||
|
9 | generic(N :integer := 695); | |||
|
10 | ||||
|
11 | port( | |||
|
12 | clk, raz : in std_logic ; | |||
|
13 | clock : out std_logic); | |||
|
14 | ||||
|
15 | end Clock_Serie; | |||
|
16 | ||||
|
17 | ||||
|
18 | architecture ar_Clock_Serie of Clock_Serie is | |||
|
19 | ||||
|
20 | signal clockint : std_logic; | |||
|
21 | signal countint : integer range 0 to N/2-1; | |||
|
22 | ||||
|
23 | begin | |||
|
24 | process (clk,raz) | |||
|
25 | begin | |||
|
26 | if(raz = '0') then | |||
|
27 | countint <= 0; | |||
|
28 | clockint <= '0'; | |||
|
29 | elsif (clk' event and clk='1') then | |||
|
30 | if (countint = N/2-1) then | |||
|
31 | countint <= 0; | |||
|
32 | clockint <= not clockint; | |||
|
33 | else | |||
|
34 | countint <= countint+1; | |||
|
35 | end if; | |||
|
36 | end if; | |||
|
37 | end process; | |||
|
38 | ||||
|
39 | clock <= clockint; | |||
|
40 | ||||
|
41 | end ar_Clock_Serie; No newline at end of file |
@@ -0,0 +1,77 | |||||
|
1 | library ieee; | |||
|
2 | use ieee.std_logic_1164.all; | |||
|
3 | library grlib; | |||
|
4 | use grlib.amba.all; | |||
|
5 | -- pragma translate_off | |||
|
6 | use std.textio.all; | |||
|
7 | -- pragma translate_on | |||
|
8 | library lpp; | |||
|
9 | use lpp.lpp_amba.all; | |||
|
10 | ||||
|
11 | ||||
|
12 | package lpp_cna is | |||
|
13 | ||||
|
14 | component APB_CNA is | |||
|
15 | generic ( | |||
|
16 | pindex : integer := 0; | |||
|
17 | paddr : integer := 0; | |||
|
18 | pmask : integer := 16#fff#; | |||
|
19 | pirq : integer := 0; | |||
|
20 | abits : integer := 8); | |||
|
21 | port ( | |||
|
22 | clk : in std_logic; | |||
|
23 | rst : in std_logic; | |||
|
24 | apbi : in apb_slv_in_type; | |||
|
25 | apbo : out apb_slv_out_type; | |||
|
26 | SYNC : out std_logic; | |||
|
27 | SCLK : out std_logic; | |||
|
28 | DATA : out std_logic | |||
|
29 | ); | |||
|
30 | end component; | |||
|
31 | ||||
|
32 | ||||
|
33 | component CNA_TabloC is | |||
|
34 | port( | |||
|
35 | clock : in std_logic; | |||
|
36 | rst : in std_logic; | |||
|
37 | flag_nw : in std_logic; | |||
|
38 | bp : in std_logic; | |||
|
39 | Data_C : in std_logic_vector(15 downto 0); | |||
|
40 | SYNC : out std_logic; | |||
|
41 | SCLK : out std_logic; | |||
|
42 | Rz : out std_logic; | |||
|
43 | flag_sd : out std_logic; | |||
|
44 | Data : out std_logic | |||
|
45 | ); | |||
|
46 | end component; | |||
|
47 | ||||
|
48 | ||||
|
49 | component Clock_Serie is | |||
|
50 | generic(N :integer := 695); | |||
|
51 | port( | |||
|
52 | clk, raz : in std_logic ; | |||
|
53 | clock : out std_logic); | |||
|
54 | end component; | |||
|
55 | ||||
|
56 | ||||
|
57 | component GeneSYNC_flag is | |||
|
58 | port( | |||
|
59 | clk,raz : in std_logic; | |||
|
60 | flag_nw : in std_logic; | |||
|
61 | Sysclk : in std_logic; | |||
|
62 | OKAI_send : out std_logic; | |||
|
63 | SYNC : out std_logic); | |||
|
64 | end component; | |||
|
65 | ||||
|
66 | ||||
|
67 | component Serialize is | |||
|
68 | port( | |||
|
69 | clk,raz : in std_logic; | |||
|
70 | sclk : in std_logic; | |||
|
71 | vectin : in std_logic_vector(15 downto 0); | |||
|
72 | send : in std_logic; | |||
|
73 | sended : out std_logic; | |||
|
74 | Data : out std_logic); | |||
|
75 | end component; | |||
|
76 | ||||
|
77 | end; |
@@ -1,47 +1,47 | |||||
1 | SCRIPTSDIR=scripts/ |
|
1 | SCRIPTSDIR=scripts/ | |
2 | LIBDIR=lib/ |
|
2 | LIBDIR=lib/ | |
3 | BOARDSDIR=boards/ |
|
3 | BOARDSDIR=boards/ | |
4 | DESIGNSDIR=designs/ |
|
4 | DESIGNSDIR=designs/ | |
5 |
|
5 | |||
6 |
|
6 | |||
7 |
|
7 | |||
8 |
|
8 | |||
9 |
|
9 | |||
10 |
|
10 | |||
11 | all: help |
|
11 | all: help | |
12 |
|
12 | |||
13 | help: |
|
13 | help: | |
14 | @echo |
|
14 | @echo | |
15 | @echo " batch targets:" |
|
15 | @echo " batch targets:" | |
16 | @echo |
|
16 | @echo | |
17 | @echo " make Patch-GRLIB : install library into GRLIB at : $(GRLIB)" |
|
17 | @echo " make Patch-GRLIB : install library into GRLIB at : $(GRLIB)" | |
18 | @echo " make dist : create a tar file for using into an other computer" |
|
18 | @echo " make dist : create a tar file for using into an other computer" | |
19 | @echo " make Patched-dist : create a tar file for with a patched grlib for using into an other computer" |
|
19 | @echo " make Patched-dist : create a tar file for with a patched grlib for using into an other computer" | |
20 | @echo " make allGPL : add a GPL HEADER in all vhdl Files" |
|
20 | @echo " make allGPL : add a GPL HEADER in all vhdl Files" | |
21 | @echo " make init : add a GPL HEADER in all vhdl Files, init all files" |
|
21 | @echo " make init : add a GPL HEADER in all vhdl Files, init all files" | |
22 | @echo " make doc : make documentation for VHDL IPs" |
|
22 | @echo " make doc : make documentation for VHDL IPs" | |
23 | @echo |
|
23 | @echo | |
24 |
|
24 | |||
25 | allGPL: |
|
25 | allGPL: | |
26 | sh $(SCRIPTSDIR)/GPL_Patcher.sh -R |
|
26 | sh $(SCRIPTSDIR)/GPL_Patcher.sh -R | |
27 |
|
27 | |||
28 | init: allGPL |
|
28 | init: allGPL | |
29 | sh $(SCRIPTSDIR)/vhdlsynPatcher.sh |
|
29 | sh $(SCRIPTSDIR)/vhdlsynPatcher.sh | |
30 | sh $(SCRIPTSDIR)/makeDirs.sh lib/lpp |
|
30 | sh $(SCRIPTSDIR)/makeDirs.sh lib/lpp | |
31 |
|
31 | |||
32 |
|
32 | |||
33 | Patch-GRLIB: init doc |
|
33 | Patch-GRLIB: init doc | |
34 | sh $(SCRIPTSDIR)/patch.sh $(GRLIB) |
|
34 | sh $(SCRIPTSDIR)/patch.sh $(GRLIB) | |
35 |
|
35 | |||
36 |
|
36 | |||
37 | dist: init |
|
37 | dist: init | |
38 | tar -cvzf ./../lpp-lib.tgz ./../VHD_Lib/* |
|
38 | tar -cvzf ./../lpp-lib.tgz ./../VHD_Lib/* | |
39 |
|
39 | |||
40 | Patched-dist: Patch-GRLIB |
|
40 | Patched-dist: Patch-GRLIB | |
41 | tar -cvzf ./../lpp-patched-GRLIB.tgz $(GRLIB)/* |
|
41 | tar -cvzf ./../lpp-patched-GRLIB.tgz $(GRLIB)/* | |
42 |
|
42 | |||
43 |
|
43 | |||
44 | doc: |
|
44 | doc: | |
45 | doxygen lib/lpp/Doxyfile |
|
45 | doxygen lib/lpp/Doxyfile | |
46 |
|
|
46 | #make lib/lpp/doc/latex | |
47 |
|
|
47 | #cp lib/lpp/doc/latex/refman.pdf lib/lpp/doc/VHD_lib.pdf |
@@ -1,9 +1,9 | |||||
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 | |
6 | LCD_16x2_ENGINE.vhd |
|
4 | 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,4 +1,6 | |||||
|
1 | ./amba_lcd_16x2_ctrlr | |||
|
2 | ./dsp/iir_filter | |||
1 | ./general_purpose |
|
3 | ./general_purpose | |
2 | ./lpp_amba |
|
4 | ./lpp_amba | |
3 | ./dsp/iir_filter |
|
5 | ./lpp_cna | |
4 | ./amba_lcd_16x2_ctrlr |
|
6 | ./lpp_uart |
@@ -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,13 +1,13 | |||||
1 | Adder.vhd |
|
|||
2 | ADDRcntr.vhd |
|
1 | ADDRcntr.vhd | |
3 | ALU.vhd |
|
2 | ALU.vhd | |
4 | general_purpose.vhd |
|
3 | Adder.vhd | |
|
4 | MAC.vhd | |||
5 | MAC_CONTROLER.vhd |
|
5 | MAC_CONTROLER.vhd | |
6 | MAC_MUX2.vhd |
|
|||
7 | MAC_MUX.vhd |
|
6 | MAC_MUX.vhd | |
|
7 | MAC_MUX2.vhd | |||
8 | MAC_REG.vhd |
|
8 | MAC_REG.vhd | |
9 |
M |
|
9 | MUX2.vhd | |
10 | Multiplier.vhd |
|
10 | Multiplier.vhd | |
11 | MUX2.vhd |
|
|||
12 | REG.vhd |
|
11 | REG.vhd | |
13 | Shifter.vhd |
|
12 | Shifter.vhd | |
|
13 | general_purpose.vhd |
@@ -1,106 +1,106 | |||||
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 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 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 | -- APB_MULTI_DIODE.vhd |
|
19 | -- APB_MULTI_DIODE.vhd | |
20 |
|
20 | |||
21 | library ieee; |
|
21 | library ieee; | |
22 | use ieee.std_logic_1164.all; |
|
22 | use ieee.std_logic_1164.all; | |
23 | --use ieee.numeric_std.all; |
|
23 | --use ieee.numeric_std.all; | |
24 | library grlib; |
|
24 | library grlib; | |
25 | use grlib.amba.all; |
|
25 | use grlib.amba.all; | |
26 | use grlib.stdlib.all; |
|
26 | use grlib.stdlib.all; | |
27 | use grlib.devices.all; |
|
27 | use grlib.devices.all; | |
28 | library lpp; |
|
28 | library lpp; | |
29 | use lpp.lpp_amba.all; |
|
29 | use lpp.lpp_amba.all; | |
30 |
|
30 | |||
31 |
|
31 | |||
32 | entity APB_MULTI_DIODE is |
|
32 | entity APB_MULTI_DIODE is | |
33 | generic ( |
|
33 | generic ( | |
34 | pindex : integer := 0; |
|
34 | pindex : integer := 0; | |
35 | paddr : integer := 0; |
|
35 | paddr : integer := 0; | |
36 | pmask : integer := 16#fff#; |
|
36 | pmask : integer := 16#fff#; | |
37 | pirq : integer := 0; |
|
37 | pirq : integer := 0; | |
38 | abits : integer := 8); |
|
38 | abits : integer := 8); | |
39 | port ( |
|
39 | port ( | |
40 | rst : in std_ulogic; |
|
40 | rst : in std_ulogic; | |
41 | clk : in std_ulogic; |
|
41 | clk : in std_ulogic; | |
42 | apbi : in apb_slv_in_type; |
|
42 | apbi : in apb_slv_in_type; | |
43 | apbo : out apb_slv_out_type; |
|
43 | apbo : out apb_slv_out_type; | |
44 | LED : out std_logic_vector(2 downto 0) |
|
44 | LED : out std_logic_vector(2 downto 0) | |
45 | ); |
|
45 | ); | |
46 | end; |
|
46 | end; | |
47 |
|
47 | |||
48 |
|
48 | |||
49 | architecture AR_APB_MULTI_DIODE of APB_MULTI_DIODE is |
|
49 | architecture AR_APB_MULTI_DIODE of APB_MULTI_DIODE is | |
50 |
|
50 | |||
51 | constant REVISION : integer := 1; |
|
51 | constant REVISION : integer := 1; | |
52 |
|
52 | |||
53 | constant pconfig : apb_config_type := ( |
|
53 | constant pconfig : apb_config_type := ( | |
54 | 0 => ahb_device_reg (VENDOR_LPP, LPP_MULTI_DIODE, 0, REVISION, 0), |
|
54 | 0 => ahb_device_reg (VENDOR_LPP, LPP_MULTI_DIODE, 0, REVISION, 0), | |
55 | 1 => apb_iobar(paddr, pmask)); |
|
55 | 1 => apb_iobar(paddr, pmask)); | |
56 |
|
56 | |||
57 |
|
57 | |||
58 |
|
58 | |||
59 | type LEDregs is record |
|
59 | type LEDregs is record | |
60 | DATAin : std_logic_vector(31 downto 0); |
|
60 | DATAin : std_logic_vector(31 downto 0); | |
61 | DATAout : std_logic_vector(31 downto 0); |
|
61 | DATAout : std_logic_vector(31 downto 0); | |
62 | end record; |
|
62 | end record; | |
63 |
|
63 | |||
64 | signal r : LEDregs; |
|
64 | signal r : LEDregs; | |
|
65 | signal Rdata : std_logic_vector(31 downto 0); | |||
65 |
|
66 | |||
66 |
|
67 | |||
67 | begin |
|
68 | begin | |
68 |
|
69 | |||
69 | r.DATAout <= r.DATAin xor X"FFFFFFFF"; |
|
70 | r.DATAout <= r.DATAin xor X"FFFFFFFF"; | |
70 |
|
71 | |||
71 | process(rst,clk) |
|
72 | process(rst,clk) | |
72 | begin |
|
73 | begin | |
73 | if rst = '0' then |
|
74 | if rst = '0' then | |
74 | LED <= "000"; |
|
75 | LED <= "000"; | |
75 | r.DATAin <= (others => '0'); |
|
76 | r.DATAin <= (others => '0'); | |
76 | apbo.prdata <= (others => '0'); |
|
|||
77 | elsif clk'event and clk = '1' then |
|
77 | elsif clk'event and clk = '1' then | |
78 |
|
78 | |||
79 | LED <= r.DATAin(2 downto 0); |
|
79 | LED <= r.DATAin(2 downto 0); | |
80 |
|
80 | |||
81 | --APB Write OP |
|
81 | --APB Write OP | |
82 | if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then |
|
82 | if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then | |
83 | case apbi.paddr(abits-1 downto 2) is |
|
83 | case apbi.paddr(abits-1 downto 2) is | |
84 | when "000000" => |
|
84 | when "000000" => | |
85 | r.DATAin <= apbi.pwdata; |
|
85 | r.DATAin <= apbi.pwdata; | |
86 | when others => |
|
86 | when others => | |
87 | null; |
|
87 | null; | |
88 | end case; |
|
88 | end case; | |
89 | end if; |
|
89 | end if; | |
90 |
|
90 | |||
91 | --APB READ OP |
|
91 | --APB READ OP | |
92 | if (apbi.psel(pindex) and apbi.penable and (not apbi.pwrite)) = '1' then |
|
92 | if (apbi.psel(pindex) and apbi.penable and (not apbi.pwrite)) = '1' then | |
93 | case apbi.paddr(abits-1 downto 2) is |
|
93 | case apbi.paddr(abits-1 downto 2) is | |
94 | when "000000" => |
|
94 | when "000000" => | |
95 |
|
|
95 | Rdata <= r.DATAin; | |
96 | when others => |
|
96 | when others => | |
97 |
|
|
97 | Rdata <= r.DATAout; | |
98 | end case; |
|
98 | end case; | |
99 | end if; |
|
99 | end if; | |
100 |
|
100 | |||
101 | end if; |
|
101 | end if; | |
102 | apbo.pconfig <= pconfig; |
|
102 | apbo.pconfig <= pconfig; | |
103 | end process; |
|
103 | end process; | |
104 |
|
104 | |||
105 |
|
105 | apbo.prdata <= Rdata when apbi.penable = '1'; | ||
106 | end ar_APB_MULTI_DIODE; No newline at end of file |
|
106 | end ar_APB_MULTI_DIODE; |
@@ -1,129 +1,129 | |||||
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 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 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 | -- APB_SIMPLE_DIODE.vhd |
|
19 | -- APB_SIMPLE_DIODE.vhd | |
20 |
|
20 | |||
21 | library ieee; |
|
21 | library ieee; | |
22 | use ieee.std_logic_1164.all; |
|
22 | use ieee.std_logic_1164.all; | |
23 | --use ieee.numeric_std.all; |
|
23 | --use ieee.numeric_std.all; | |
24 | library grlib; |
|
24 | library grlib; | |
25 | use grlib.amba.all; |
|
25 | use grlib.amba.all; | |
26 | use grlib.stdlib.all; |
|
26 | use grlib.stdlib.all; | |
27 | use grlib.devices.all; |
|
27 | use grlib.devices.all; | |
28 | library lpp; |
|
28 | library lpp; | |
29 | use lpp.lpp_amba.all; |
|
29 | use lpp.lpp_amba.all; | |
30 |
|
30 | |||
31 |
|
31 | |||
32 | entity APB_SIMPLE_DIODE is |
|
32 | entity APB_SIMPLE_DIODE is | |
33 | generic ( |
|
33 | generic ( | |
34 | pindex : integer := 0; |
|
34 | pindex : integer := 0; | |
35 | paddr : integer := 0; |
|
35 | paddr : integer := 0; | |
36 | pmask : integer := 16#fff#; |
|
36 | pmask : integer := 16#fff#; | |
37 | pirq : integer := 0; |
|
37 | pirq : integer := 0; | |
38 | abits : integer := 8); |
|
38 | abits : integer := 8); | |
39 | port ( |
|
39 | port ( | |
40 | rst : in std_ulogic; |
|
40 | rst : in std_ulogic; | |
41 | clk : in std_ulogic; |
|
41 | clk : in std_ulogic; | |
42 | apbi : in apb_slv_in_type; |
|
42 | apbi : in apb_slv_in_type; | |
43 | apbo : out apb_slv_out_type; |
|
43 | apbo : out apb_slv_out_type; | |
44 | LED : out std_ulogic |
|
44 | LED : out std_ulogic | |
45 | ); |
|
45 | ); | |
46 | end; |
|
46 | end; | |
47 |
|
47 | |||
48 |
|
48 | |||
49 | architecture AR_APB_SIMPLE_DIODE of APB_SIMPLE_DIODE is |
|
49 | architecture AR_APB_SIMPLE_DIODE of APB_SIMPLE_DIODE is | |
50 |
|
50 | |||
51 | constant REVISION : integer := 1; |
|
51 | constant REVISION : integer := 1; | |
52 |
|
52 | |||
53 | constant pconfig : apb_config_type := ( |
|
53 | constant pconfig : apb_config_type := ( | |
54 | 0 => ahb_device_reg (VENDOR_LPP, LPP_SIMPLE_DIODE, 0, REVISION, 0), |
|
54 | 0 => ahb_device_reg (VENDOR_LPP, LPP_SIMPLE_DIODE, 0, REVISION, 0), | |
55 | 1 => apb_iobar(paddr, pmask)); |
|
55 | 1 => apb_iobar(paddr, pmask)); | |
56 |
|
56 | |||
57 |
|
57 | |||
58 |
|
58 | |||
59 | type LEDregs is record |
|
59 | type LEDregs is record | |
60 | DATAin : std_logic_vector(31 downto 0); |
|
60 | DATAin : std_logic_vector(31 downto 0); | |
61 | DATAout : std_logic_vector(31 downto 0); |
|
61 | DATAout : std_logic_vector(31 downto 0); | |
62 | end record; |
|
62 | end record; | |
63 |
|
63 | |||
64 | signal r : LEDregs; |
|
64 | signal r : LEDregs; | |
|
65 | signal Rdata : std_logic_vector(31 downto 0); | |||
65 |
|
66 | |||
66 |
|
67 | |||
67 | begin |
|
68 | begin | |
68 |
|
69 | |||
69 | r.DATAout <= r.DATAin xor X"FFFFFFFF"; |
|
70 | r.DATAout <= r.DATAin xor X"FFFFFFFF"; | |
70 |
|
71 | |||
71 | process(rst,clk) |
|
72 | process(rst,clk) | |
72 | begin |
|
73 | begin | |
73 | if rst = '0' then |
|
74 | if rst = '0' then | |
74 | LED <= '0'; |
|
75 | LED <= '0'; | |
75 | r.DATAin <= (others => '0'); |
|
76 | r.DATAin <= (others => '0'); | |
76 | apbo.prdata <= (others => '0'); |
|
|||
77 | elsif clk'event and clk = '1' then |
|
77 | elsif clk'event and clk = '1' then | |
78 |
|
78 | |||
79 | LED <= r.DATAin(0); |
|
79 | LED <= r.DATAin(0); | |
80 |
|
80 | |||
81 | --APB Write OP |
|
81 | --APB Write OP | |
82 | if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then |
|
82 | if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then | |
83 | case apbi.paddr(abits-1 downto 2) is |
|
83 | case apbi.paddr(abits-1 downto 2) is | |
84 | when "000000" => |
|
84 | when "000000" => | |
85 | r.DATAin <= apbi.pwdata; |
|
85 | r.DATAin <= apbi.pwdata; | |
86 | when others => |
|
86 | when others => | |
87 | null; |
|
87 | null; | |
88 | end case; |
|
88 | end case; | |
89 | end if; |
|
89 | end if; | |
90 |
|
90 | |||
91 | --APB READ OP |
|
91 | --APB READ OP | |
92 | if (apbi.psel(pindex) and apbi.penable and (not apbi.pwrite)) = '1' then |
|
92 | if (apbi.psel(pindex) and apbi.penable and (not apbi.pwrite)) = '1' then | |
93 | case apbi.paddr(abits-1 downto 2) is |
|
93 | case apbi.paddr(abits-1 downto 2) is | |
94 | when "000000" => |
|
94 | when "000000" => | |
95 |
|
|
95 | Rdata <= r.DATAin; | |
96 | when others => |
|
96 | when others => | |
97 |
|
|
97 | Rdata <= r.DATAout; | |
98 | end case; |
|
98 | end case; | |
99 | end if; |
|
99 | end if; | |
100 |
|
100 | |||
101 | end if; |
|
101 | end if; | |
102 | apbo.pconfig <= pconfig; |
|
102 | apbo.pconfig <= pconfig; | |
103 | end process; |
|
103 | end process; | |
104 |
|
104 | |||
105 |
|
105 | apbo.prdata <= Rdata when apbi.penable = '1'; | ||
106 |
|
106 | |||
107 | -- pragma translate_off |
|
107 | -- pragma translate_off | |
108 | -- bootmsg : report_version |
|
108 | -- bootmsg : report_version | |
109 | -- generic map ("apbuart" & tost(pindex) & |
|
109 | -- generic map ("apbuart" & tost(pindex) & | |
110 | -- ": Generic UART rev " & tost(REVISION) & ", fifo " & tost(fifosize) & |
|
110 | -- ": Generic UART rev " & tost(REVISION) & ", fifo " & tost(fifosize) & | |
111 | -- ", irq " & tost(pirq)); |
|
111 | -- ", irq " & tost(pirq)); | |
112 | -- pragma translate_on |
|
112 | -- pragma translate_on | |
113 |
|
113 | |||
114 |
|
114 | |||
115 |
|
115 | |||
116 | end ar_APB_SIMPLE_DIODE; |
|
116 | end ar_APB_SIMPLE_DIODE; | |
117 |
|
117 | |||
118 |
|
118 | |||
119 |
|
119 | |||
120 |
|
120 | |||
121 |
|
121 | |||
122 |
|
122 | |||
123 |
|
123 | |||
124 |
|
124 | |||
125 |
|
125 | |||
126 |
|
126 | |||
127 |
|
127 | |||
128 |
|
128 | |||
129 |
|
129 |
@@ -1,128 +1,129 | |||||
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 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 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 | -- APB_UART.vhd |
|
19 | -- APB_UART.vhd | |
20 |
|
20 | |||
21 | library ieee; |
|
21 | library ieee; | |
22 | use ieee.std_logic_1164.all; |
|
22 | use ieee.std_logic_1164.all; | |
23 | library grlib; |
|
23 | library grlib; | |
24 | use grlib.amba.all; |
|
24 | use grlib.amba.all; | |
25 | use grlib.stdlib.all; |
|
25 | use grlib.stdlib.all; | |
26 | use grlib.devices.all; |
|
26 | use grlib.devices.all; | |
27 | library lpp; |
|
27 | library lpp; | |
28 | use lpp.lpp_amba.all; |
|
28 | use lpp.lpp_amba.all; | |
29 | use lpp.lpp_uart.all; |
|
29 | use lpp.lpp_uart.all; | |
30 |
|
30 | |||
31 | entity APB_UART is |
|
31 | entity APB_UART is | |
32 | generic ( |
|
32 | generic ( | |
33 | pindex : integer := 0; |
|
33 | pindex : integer := 0; | |
34 | paddr : integer := 0; |
|
34 | paddr : integer := 0; | |
35 | pmask : integer := 16#fff#; |
|
35 | pmask : integer := 16#fff#; | |
36 | pirq : integer := 0; |
|
36 | pirq : integer := 0; | |
37 | abits : integer := 8; |
|
37 | abits : integer := 8; | |
38 | Data_sz : integer := 8); |
|
38 | Data_sz : integer := 8); | |
39 | port ( |
|
39 | port ( | |
40 | clk : in std_logic; |
|
40 | clk : in std_logic; | |
41 | rst : in std_logic; |
|
41 | rst : in std_logic; | |
42 | apbi : in apb_slv_in_type; |
|
42 | apbi : in apb_slv_in_type; | |
43 | apbo : out apb_slv_out_type; |
|
43 | apbo : out apb_slv_out_type; | |
44 | TXD : out std_logic; |
|
44 | TXD : out std_logic; | |
45 | RXD : in std_logic |
|
45 | RXD : in std_logic | |
46 | ); |
|
46 | ); | |
47 | end APB_UART; |
|
47 | end APB_UART; | |
48 |
|
48 | |||
49 |
|
49 | |||
50 | architecture ar_APB_UART of APB_UART is |
|
50 | architecture ar_APB_UART of APB_UART is | |
51 |
|
51 | |||
52 | constant REVISION : integer := 1; |
|
52 | constant REVISION : integer := 1; | |
53 |
|
53 | |||
54 | constant pconfig : apb_config_type := ( |
|
54 | constant pconfig : apb_config_type := ( | |
55 | 0 => ahb_device_reg (VENDOR_LPP, LPP_UART, 0, REVISION, 0), |
|
55 | 0 => ahb_device_reg (VENDOR_LPP, LPP_UART, 0, REVISION, 0), | |
56 | 1 => apb_iobar(paddr, pmask)); |
|
56 | 1 => apb_iobar(paddr, pmask)); | |
57 |
|
57 | |||
58 | signal NwData : std_logic; |
|
58 | signal NwData : std_logic; | |
59 | signal ACK : std_logic; |
|
59 | signal ACK : std_logic; | |
60 | signal Capture : std_logic; |
|
60 | signal Capture : std_logic; | |
61 | signal Send : std_logic; |
|
61 | signal Send : std_logic; | |
62 | signal Sended : std_logic; |
|
62 | signal Sended : std_logic; | |
63 |
|
63 | |||
64 | type UART_ctrlr_Reg is record |
|
64 | type UART_ctrlr_Reg is record | |
65 | UART_Cfg : std_logic_vector(4 downto 0); |
|
65 | UART_Cfg : std_logic_vector(4 downto 0); | |
66 | UART_Wdata : std_logic_vector(7 downto 0); |
|
66 | UART_Wdata : std_logic_vector(7 downto 0); | |
67 | UART_Rdata : std_logic_vector(7 downto 0); |
|
67 | UART_Rdata : std_logic_vector(7 downto 0); | |
68 | UART_BTrig : std_logic_vector(11 downto 0); |
|
68 | UART_BTrig : std_logic_vector(11 downto 0); | |
69 | end record; |
|
69 | end record; | |
70 |
|
70 | |||
71 | signal Rec : UART_ctrlr_Reg; |
|
71 | signal Rec : UART_ctrlr_Reg; | |
|
72 | signal Rdata : std_logic_vector(31 downto 0); | |||
72 |
|
73 | |||
73 | begin |
|
74 | begin | |
74 |
|
75 | |||
75 | Capture <= Rec.UART_Cfg(0); |
|
76 | Capture <= Rec.UART_Cfg(0); | |
76 | ACK <= Rec.UART_Cfg(1); |
|
77 | ACK <= Rec.UART_Cfg(1); | |
77 | Send <= Rec.UART_Cfg(2); |
|
78 | Send <= Rec.UART_Cfg(2); | |
78 | Rec.UART_Cfg(3) <= Sended; |
|
79 | Rec.UART_Cfg(3) <= Sended; | |
79 | Rec.UART_Cfg(4) <= NwData; |
|
80 | Rec.UART_Cfg(4) <= NwData; | |
80 |
|
81 | |||
81 |
|
82 | |||
82 | COM0 : entity work.UART |
|
83 | COM0 : entity work.UART | |
83 | generic map (Data_sz) |
|
84 | generic map (Data_sz) | |
84 | port map (clk,rst,TXD,RXD,Capture,NwData,ACK,Send,Sended,Rec.UART_BTrig,Rec.UART_Rdata,Rec.UART_Wdata); |
|
85 | port map (clk,rst,TXD,RXD,Capture,NwData,ACK,Send,Sended,Rec.UART_BTrig,Rec.UART_Rdata,Rec.UART_Wdata); | |
85 |
|
86 | |||
86 |
|
87 | |||
87 | process(rst,clk) |
|
88 | process(rst,clk) | |
88 | begin |
|
89 | begin | |
89 | if(rst='0')then |
|
90 | if(rst='0')then | |
90 | Rec.UART_Wdata <= (others => '0'); |
|
91 | Rec.UART_Wdata <= (others => '0'); | |
91 | apbo.prdata <= (others => '0'); |
|
|||
92 |
|
92 | |||
93 | elsif(clk'event and clk='1')then |
|
93 | elsif(clk'event and clk='1')then | |
94 |
|
94 | |||
95 |
|
95 | |||
96 | --APB Write OP |
|
96 | --APB Write OP | |
97 | if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then |
|
97 | if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then | |
98 | case apbi.paddr(abits-1 downto 2) is |
|
98 | case apbi.paddr(abits-1 downto 2) is | |
99 | when "000000" => |
|
99 | when "000000" => | |
100 | Rec.UART_Cfg(2 downto 0) <= apbi.pwdata(2 downto 0); |
|
100 | Rec.UART_Cfg(2 downto 0) <= apbi.pwdata(2 downto 0); | |
101 | when "000001" => |
|
101 | when "000001" => | |
102 | Rec.UART_Wdata <= apbi.pwdata(7 downto 0); |
|
102 | Rec.UART_Wdata <= apbi.pwdata(7 downto 0); | |
103 | when others => |
|
103 | when others => | |
104 | null; |
|
104 | null; | |
105 | end case; |
|
105 | end case; | |
106 | end if; |
|
106 | end if; | |
107 |
|
107 | |||
108 | --APB READ OP |
|
108 | --APB READ OP | |
109 | if (apbi.psel(pindex) and apbi.penable and (not apbi.pwrite)) = '1' then |
|
109 | if (apbi.psel(pindex) and apbi.penable and (not apbi.pwrite)) = '1' then | |
110 | case apbi.paddr(abits-1 downto 2) is |
|
110 | case apbi.paddr(abits-1 downto 2) is | |
111 | when "000000" => |
|
111 | when "000000" => | |
112 |
|
|
112 | Rdata(31 downto 27) <= Rec.UART_Cfg; | |
113 |
|
|
113 | Rdata(26 downto 12) <= (others => '0'); | |
114 |
|
|
114 | Rdata(11 downto 0) <= Rec.UART_BTrig; | |
115 | when "000001" => |
|
115 | when "000001" => | |
116 |
|
|
116 | Rdata(7 downto 0) <= Rec.UART_Wdata; | |
117 | when "000010" => |
|
117 | when "000010" => | |
118 |
|
|
118 | Rdata(7 downto 0) <= Rec.UART_Rdata; | |
119 | when others => |
|
119 | when others => | |
120 |
|
|
120 | Rdata <= (others => '0'); | |
121 | end case; |
|
121 | end case; | |
122 | end if; |
|
122 | end if; | |
123 |
|
123 | |||
124 | end if; |
|
124 | end if; | |
125 | apbo.pconfig <= pconfig; |
|
125 | apbo.pconfig <= pconfig; | |
126 | end process; |
|
126 | end process; | |
127 |
|
127 | |||
|
128 | apbo.prdata <= Rdata when apbi.penable = '1'; | |||
128 | end ar_APB_UART; No newline at end of file |
|
129 | end ar_APB_UART; |
@@ -1,79 +1,81 | |||||
1 | library ieee; |
|
1 | library ieee; | |
2 | use ieee.std_logic_1164.all; |
|
2 | use ieee.std_logic_1164.all; | |
3 | library grlib; |
|
3 | library grlib; | |
4 | use grlib.amba.all; |
|
4 | use grlib.amba.all; | |
5 | -- pragma translate_off |
|
5 | -- pragma translate_off | |
6 | use std.textio.all; |
|
6 | use std.textio.all; | |
7 | -- pragma translate_on |
|
7 | -- pragma translate_on | |
8 | library lpp; |
|
8 | library lpp; | |
9 | use lpp.lpp_amba.all; |
|
9 | use lpp.lpp_amba.all; | |
10 |
|
10 | |||
11 | package lpp_uart is |
|
11 | package lpp_uart is | |
12 |
|
12 | |||
|
13 | ||||
|
14 | component APB_UART is | |||
|
15 | generic ( | |||
|
16 | pindex : integer := 0; | |||
|
17 | paddr : integer := 0; | |||
|
18 | pmask : integer := 16#fff#; | |||
|
19 | pirq : integer := 0; | |||
|
20 | abits : integer := 8; | |||
|
21 | Data_sz : integer := 8); | |||
|
22 | port ( | |||
|
23 | clk : in std_logic; | |||
|
24 | rst : in std_logic; | |||
|
25 | apbi : in apb_slv_in_type; | |||
|
26 | apbo : out apb_slv_out_type; | |||
|
27 | TXD : out std_logic; | |||
|
28 | RXD : in std_logic | |||
|
29 | ); | |||
|
30 | end component; | |||
|
31 | ||||
|
32 | ||||
13 | component UART is |
|
33 | component UART is | |
14 | generic(Data_sz : integer := 8); --! Constante de taille pour un mot de donnee |
|
34 | generic(Data_sz : integer := 8); --! Constante de taille pour un mot de donnee | |
15 | port( |
|
35 | port( | |
16 | clk : in std_logic; --! Horloge a 25Mhz du systeme |
|
36 | clk : in std_logic; --! Horloge a 25Mhz du systeme | |
17 | reset : in std_logic; --! Reset du systeme |
|
37 | reset : in std_logic; --! Reset du systeme | |
18 | TXD : out std_logic; --! Transmission, cote PC |
|
38 | TXD : out std_logic; --! Transmission, cote PC | |
19 | RXD : in std_logic; --! Reception, cote PC |
|
39 | RXD : in std_logic; --! Reception, cote PC | |
20 | Capture : in std_logic; --! "Reset" cible pour le generateur de bauds, ici indissocie du reset global |
|
40 | Capture : in std_logic; --! "Reset" cible pour le generateur de bauds, ici indissocie du reset global | |
21 | NwDat : out std_logic; --! Flag, Nouvelle donnee presente |
|
41 | NwDat : out std_logic; --! Flag, Nouvelle donnee presente | |
22 | ACK : in std_logic; --! Flag, Reponse au flag precedent |
|
42 | ACK : in std_logic; --! Flag, Reponse au flag precedent | |
23 | Send : in std_logic; --! Flag, Demande d'envoi sur le bus |
|
43 | Send : in std_logic; --! Flag, Demande d'envoi sur le bus | |
24 | Sended : out std_logic; --! Flag, Envoi termine |
|
44 | Sended : out std_logic; --! Flag, Envoi termine | |
25 | BTrigger : out std_logic_vector(11 downto 0); --! Registre contenant la valeur du diviseur de frequence pour la transmission |
|
45 | BTrigger : out std_logic_vector(11 downto 0); --! Registre contenant la valeur du diviseur de frequence pour la transmission | |
26 | RDATA : out std_logic_vector(Data_sz-1 downto 0); --! Mot de donnee en provenance de l'utilisateur |
|
46 | RDATA : out std_logic_vector(Data_sz-1 downto 0); --! Mot de donnee en provenance de l'utilisateur | |
27 | WDATA : in std_logic_vector(Data_sz-1 downto 0) --! Mot de donnee a transmettre a l'utilisateur |
|
47 | WDATA : in std_logic_vector(Data_sz-1 downto 0) --! Mot de donnee a transmettre a l'utilisateur | |
28 | ); |
|
48 | ); | |
29 | end component; |
|
49 | end component; | |
30 |
|
50 | |||
31 |
|
51 | |||
32 | component Shift_REG is |
|
52 | component Shift_REG is | |
33 | generic(Data_sz : integer := 10); |
|
53 | generic(Data_sz : integer := 10); | |
34 | port( |
|
54 | port( | |
35 | clk : in std_logic; |
|
55 | clk : in std_logic; | |
36 | Sclk : in std_logic; |
|
56 | Sclk : in std_logic; | |
37 | reset : in std_logic; |
|
57 | reset : in std_logic; | |
38 | SIN : in std_logic; |
|
58 | SIN : in std_logic; | |
39 | SOUT : out std_logic; |
|
59 | SOUT : out std_logic; | |
40 | Serialize : in std_logic; |
|
60 | Serialize : in std_logic; | |
41 | Serialized : out std_logic; |
|
61 | Serialized : out std_logic; | |
42 | D : in std_logic_vector(Data_sz-1 downto 0); |
|
62 | D : in std_logic_vector(Data_sz-1 downto 0); | |
43 | Q : out std_logic_vector(Data_sz-1 downto 0) |
|
63 | Q : out std_logic_vector(Data_sz-1 downto 0) | |
44 |
|
64 | |||
45 | ); |
|
65 | ); | |
46 | end component; |
|
66 | end component; | |
47 |
|
67 | |||
48 |
|
68 | |||
49 | component BaudGen is |
|
69 | component BaudGen is | |
50 | port( |
|
70 | port( | |
51 | clk : in std_logic; |
|
71 | clk : in std_logic; | |
52 | reset : in std_logic; |
|
72 | reset : in std_logic; | |
53 | Capture : in std_logic; |
|
73 | Capture : in std_logic; | |
54 | Bclk : out std_logic; |
|
74 | Bclk : out std_logic; | |
55 | RXD : in std_logic; |
|
75 | RXD : in std_logic; | |
56 | BTrigger : out std_logic_vector(11 downto 0) |
|
76 | BTrigger : out std_logic_vector(11 downto 0) | |
57 | ); |
|
77 | ); | |
58 | end component; |
|
78 | end component; | |
59 |
|
79 | |||
60 | component APB_UART is |
|
|||
61 | generic ( |
|
|||
62 | pindex : integer := 0; |
|
|||
63 | paddr : integer := 0; |
|
|||
64 | pmask : integer := 16#fff#; |
|
|||
65 | pirq : integer := 0; |
|
|||
66 | abits : integer := 8; |
|
|||
67 | Data_sz : integer := 8); |
|
|||
68 | port ( |
|
|||
69 | clk : in std_logic; |
|
|||
70 | rst : in std_logic; |
|
|||
71 | apbi : in apb_slv_in_type; |
|
|||
72 | apbo : out apb_slv_out_type; |
|
|||
73 | TXD : out std_logic; |
|
|||
74 | RXD : in std_logic |
|
|||
75 | ); |
|
|||
76 | end component; |
|
|||
77 |
|
||||
78 |
|
80 | |||
79 | end lpp_uart; No newline at end of file |
|
81 | end lpp_uart; |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
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