##// END OF EJS Templates
LCD Driver fixed but AMBA interface still not implemented.
Alexis -
r11:b3a8b4c115e7 default
parent child
Show More
@@ -1,66 +1,64
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
19
20
20
21 | ABOUT
21 | ABOUT
22 | ~~~~~
22 | ~~~~~
23
23
24 LPP's VHD_Lib is a VHDL library, which is target independent and includes a set of scripts for integrating into
24 LPP's VHD_Lib is a VHDL library which is target independent and includes a set of scripts for integrating into
25 gaisler's grlib and use its features. For setup read instalation section.
25 gaisler's grlib and use its features. For setup read instalation section.
26
26
27
27
28 | REQUIREMENTS
28 | REQUIREMENTS
29 | ~~~~~~~~~~~~
29 | ~~~~~~~~~~~~
30
30
31 To use this library you need the grlib and linux shell or mingw for windows users.
31 To use this library you need the grlib and linux shell or mingw for windows users.
32
32
33
33
34 | PERSONALIZATION
34 | PERSONALIZATION
35 | ~~~~~~~~~~~~~~~
35 | ~~~~~~~~~~~~~~~
36
36
37 You can add your IPs to the library, see how_to_improve.pdf(Comming soon).
37 You can add your IPs to the library, see how_to_improve.pdf(Comming soon).
38
38
39
39
40 | INSTALLATION
40 | INSTALLATION
41 | ~~~~~~~~~~~~
41 | ~~~~~~~~~~~~
42
42
43 To set up the VHD_Lib follow this steps:
43 To set up the VHD_Lib follow this steps:
44 -download and setup the grlib
44 -download and setup the grlib
45 -create a VARIABLE called GRLIB with value the path to the grlib folder.
45 -create a VARIABLE called GRLIB with value the path to the grlib folder.
46 -untar the VHD_Lib and type "make Patch-GRLIB"
46 -untar the VHD_Lib and type "make Patch-GRLIB"
47 -now you can use the grlib's Makefiles and designs.
47 -now you can use the grlib's Makefiles and designs.
48 Please note that if you try "make" or "make help" you will see all targets and if the GRLIB variable is correct.
48 Please note that if you try "make" or "make help" you will see all targets and if the GRLIB variable is correct.
49
49
50
50
51 | HACKING
51 | HACKING
52 | ~~~~~~~
52 | ~~~~~~~
53
53
54 The first thing you should look at is the Makefile and then all scripts in "scripts" folder.
54 The first thing you should look at is the Makefile and then all scripts in "scripts" folder.
55
55
56
56
57 | LICENSE
57 | LICENSE
58 | ~~~~~~~
58 | ~~~~~~~
59
59
60 All the programs used by the VHD_Lib are protected by their respective
60 All the programs used by the VHD_Lib are protected by their respective
61 license. They all are free software and most of them are covered by the
61 license. They all are free software and most of them are covered by the
62 GNU General Public License.
62 GNU General Public License.
63
63
64 The VHD_Lib itself, meaning all the scripts which are used in the building
65 process, are covered by the GNU General Public License.
66
64
@@ -1,55 +1,55
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 -- Package File Template
19 -- Package File Template
20 --
20 --
21 -- Purpose: This package defines supplemental types, subtypes,
21 -- Purpose: This package defines supplemental types, subtypes,
22 -- constants, and functions
22 -- constants, and functions
23
23
24
24
25 library IEEE;
25 library IEEE;
26 use IEEE.STD_LOGIC_1164.all;
26 use IEEE.STD_LOGIC_1164.all;
27 library lpp;
27 library lpp;
28 use lpp.amba_lcd_16x2_ctrlr.all;
28 use lpp.amba_lcd_16x2_ctrlr.all;
29
29
30
30
31
31
32 package LCD_16x2_CFG is
32 package LCD_16x2_CFG is
33
33
34
34
35 constant ClearDSPLY : std_logic_vector(7 downto 0):= X"01";
35 constant ClearDSPLY : std_logic_vector(7 downto 0):= X"01";
36 constant FunctionSet : std_logic_vector(7 downto 0):= X"38";
36 constant FunctionSet : std_logic_vector(7 downto 0):= X"38";
37 constant RetHome : std_logic_vector(7 downto 0):= X"02";
37 constant RetHome : std_logic_vector(7 downto 0):= X"02";
38 constant SetEntryMode : std_logic_vector(7 downto 0):= X"06";
38 constant SetEntryMode : std_logic_vector(7 downto 0):= X"06";
39 constant DSPL_CTRL : std_logic_vector(7 downto 0):= X"0C";
39 constant DSPL_CTRL : std_logic_vector(7 downto 0):= X"0E";
40
40
41 constant CursorON : std_logic_vector(7 downto 0):= X"0E";
41 constant CursorON : std_logic_vector(7 downto 0):= X"0E";
42 constant CursorOFF : std_logic_vector(7 downto 0):= X"0C";
42 constant CursorOFF : std_logic_vector(7 downto 0):= X"0C";
43
43
44 --===========================================================|
44 --===========================================================|
45 --======L C D D R I V E R T I M I N G C O D E=====|
45 --======L C D D R I V E R T I M I N G C O D E=====|
46 --===========================================================|
46 --===========================================================|
47
47
48 constant Duration_4us : std_logic_vector(1 downto 0) := "00";
48 constant Duration_4us : std_logic_vector(1 downto 0) := "00";
49 constant Duration_100us : std_logic_vector(1 downto 0) := "01";
49 constant Duration_100us : std_logic_vector(1 downto 0) := "01";
50 constant Duration_4ms : std_logic_vector(1 downto 0) := "10";
50 constant Duration_4ms : std_logic_vector(1 downto 0) := "10";
51 constant Duration_20ms : std_logic_vector(1 downto 0) := "11";
51 constant Duration_20ms : std_logic_vector(1 downto 0) := "11";
52
52
53
53
54 end LCD_16x2_CFG;
54 end LCD_16x2_CFG;
55
55
@@ -1,67 +1,187
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 ----------------------------------------------------------------------------------
19 ----------------------------------------------------------------------------------
20 -- Company:
20 -- Company:
21 -- Engineer:
21 -- Engineer:
22 --
22 --
23 -- Create Date: 10:09:57 10/13/2010
23 -- Create Date: 10:09:57 10/13/2010
24 -- Design Name:
24 -- Design Name:
25 -- Module Name: LCD_2x16_DRIVER - Behavioral
25 -- Module Name: LCD_2x16_DRIVER - Behavioral
26 -- Project Name:
26 -- Project Name:
27 -- Target Devices:
27 -- Target Devices:
28 -- Tool versions:
28 -- Tool versions:
29 -- Description:
29 -- Description:
30 --
30 --
31 -- Dependencies:
31 -- Dependencies:
32 --
32 --
33 -- Revision:
33 -- Revision:
34 -- Revision 0.01 - File Created
34 -- Revision 0.01 - File Created
35 -- Additional Comments:
35 -- Additional Comments:
36 --
36 --
37 ----------------------------------------------------------------------------------
37 ----------------------------------------------------------------------------------
38
39 ---TDODO => Clean Enable pulse FSM
38 library IEEE;
40 library IEEE;
39 use IEEE.STD_LOGIC_1164.ALL;
41 use IEEE.STD_LOGIC_1164.ALL;
40 use IEEE.NUMERIC_STD.all;
42 use IEEE.NUMERIC_STD.all;
41 library lpp;
43 library lpp;
42 use lpp.amba_lcd_16x2_ctrlr.all;
44 use lpp.amba_lcd_16x2_ctrlr.all;
43
45 use lpp.lcd_16x2_cfg.all;
44
46
45 entity LCD_16x2_DRIVER is
47 entity LCD_16x2_DRIVER is
46 generic(
48 generic(
47 OSC_Freq_MHz : integer:=60
49 OSC_Freq_KHz : integer:=50000
48 );
50 );
49 Port(
51 Port(
50 reset : in STD_LOGIC;
52 reset : in STD_LOGIC;
51 clk : in STD_LOGIC;
53 clk : in STD_LOGIC;
52 LCD_CTRL : out LCD_DRVR_CTRL_BUSS;
54 LCD_CTRL : out LCD_DRVR_CTRL_BUSS;
53 SYNCH : out LCD_DRVR_SYNCH_BUSS;
55 SYNCH : out LCD_DRVR_SYNCH_BUSS;
54 DRIVER_CMD : in LCD_DRVR_CMD_BUSS
56 DRIVER_CMD : in LCD_DRVR_CMD_BUSS
55 );
57 );
56 end LCD_16x2_DRIVER;
58 end LCD_16x2_DRIVER;
57
59
58 architecture Behavioral of LCD_16x2_DRIVER is
60 architecture Behavioral of LCD_16x2_DRIVER is
59
61
62 type stateT is (idle,Enable0,Enable1,Enable2,tempo);
63 signal state : stateT;
64
65
66 constant trigger_4us : integer := 5;
67 constant trigger_100us : integer := 100;
68 constant trigger_4ms : integer := 4200;
69 constant trigger_20ms : integer := 20000;
70
71
72 signal i : integer :=0;
73 signal reset_i : std_logic := '0';
74 signal tempoTRIG : integer :=0;
75
76 signal clk_1us : std_logic;
77 signal clk_1us_reg : std_logic;
78
60 begin
79 begin
61
80
81
82 CLK0: LCD_CLK_GENERATOR
83 generic map(OSC_Freq_KHz)
84 Port map( clk,reset,clk_1us);
85
86
87
88 process(clk_1us,reset_i)
89 begin
90 if reset_i = '0' then
91 i <= 0;
92 elsif clk_1us'event and clk_1us ='1' then
93 i <= i+1;
94 end if;
95 end process;
96
97 LCD_CTRL.LCD_RW <= '0';
98
99 process(clk,reset)
100 begin
101 if reset = '0' then
102 state <= idle;
103 LCD_CTRL.LCD_E <= '0';
104 SYNCH.DRVR_READY <= '0';
105 SYNCH.LCD_INITIALISED <= '0';
106 reset_i <= '0';
107 elsif clk'event and clk = '1' then
108 case state is
109 when idle =>
110 SYNCH.LCD_INITIALISED <= '1';
111 LCD_CTRL.LCD_E <= '0';
112 if DRIVER_CMD.Exec = '1' then
113 state <= Enable0;
114 reset_i <= '1';
115 SYNCH.DRVR_READY <= '0';
116 LCD_CTRL.LCD_DATA <= DRIVER_CMD.Word;
117 LCD_CTRL.LCD_RS <= DRIVER_CMD.CMD_Data;
118 case DRIVER_CMD.Duration is
119 when Duration_4us =>
120 tempoTRIG <= trigger_4us;
121 when Duration_100us =>
122 tempoTRIG <= trigger_100us;
123 when Duration_4ms =>
124 tempoTRIG <= trigger_4ms;
125 when Duration_20ms =>
126 tempoTRIG <= trigger_20ms;
127 when others =>
128 tempoTRIG <= trigger_20ms;
129 end case;
130 else
131 SYNCH.DRVR_READY <= '1';
132 reset_i <= '0';
133 end if;
134 when Enable0 =>
135 if i = 1 then
136 reset_i <= '0';
137 LCD_CTRL.LCD_E <= '1';
138 state <= Enable1;
139 else
140 reset_i <= '1';
141 LCD_CTRL.LCD_E <= '0';
142 end if;
143 when Enable1 =>
144 if i = 2 then
145 reset_i <= '0';
146 LCD_CTRL.LCD_E <= '0';
147 state <= Enable2;
148 else
149 reset_i <= '1';
150 LCD_CTRL.LCD_E <= '1';
151 end if;
152 when Enable2 =>
153 if i = 1 then
154 reset_i <= '0';
155 LCD_CTRL.LCD_E <= '0';
156 state <= tempo;
157 else
158 reset_i <= '1';
159 LCD_CTRL.LCD_E <= '0';
160 end if;
161 when tempo =>
162 if i = tempoTRIG then
163 reset_i <= '0';
164 state <= idle;
165 else
166 reset_i <= '1';
167 end if;
168 end case;
169 end if;
170 end process;
171
62 end Behavioral;
172 end Behavioral;
63
173
64
174
65
175
66
176
67
177
178
179
180
181
182
183
184
185
186
187
@@ -1,228 +1,228
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 ----------------------------------------------------------------------------------
19 ----------------------------------------------------------------------------------
20 -- Company:
20 -- Company:
21 -- Engineer:
21 -- Engineer:
22 --
22 --
23 -- Create Date: 08:32:21 10/19/2010
23 -- Create Date: 08:32:21 10/19/2010
24 -- Design Name:
24 -- Design Name:
25 -- Module Name: LCD_16x2_ENGINE - Behavioral
25 -- Module Name: LCD_16x2_ENGINE - Behavioral
26 -- Project Name:
26 -- Project Name:
27 -- Target Devices:
27 -- Target Devices:
28 -- Tool versions:
28 -- Tool versions:
29 -- Description:
29 -- Description:
30 --
30 --
31 -- Dependencies:
31 -- Dependencies:
32 --
32 --
33 -- Revision:
33 -- Revision:
34 -- Revision 0.01 - File Created
34 -- Revision 0.01 - File Created
35 -- Additional Comments:
35 -- Additional Comments:
36 --
36 --
37 ----------------------------------------------------------------------------------
37 ----------------------------------------------------------------------------------
38 library IEEE;
38 library IEEE;
39 use IEEE.STD_LOGIC_1164.ALL;
39 use IEEE.STD_LOGIC_1164.ALL;
40 use IEEE.NUMERIC_STD.ALL;
40 use IEEE.NUMERIC_STD.ALL;
41
41
42 library lpp;
42 library lpp;
43 use lpp.amba_lcd_16x2_ctrlr.all;
43 use lpp.amba_lcd_16x2_ctrlr.all;
44 use lpp.LCD_16x2_CFG.all;
44 use lpp.LCD_16x2_CFG.all;
45
45
46
46
47 entity LCD_16x2_ENGINE is
47 entity LCD_16x2_ENGINE is
48 generic(OSC_freqKHz : integer := 50000);
48 generic(OSC_freqKHz : integer := 50000);
49 Port ( clk : in STD_LOGIC;
49 Port ( clk : in STD_LOGIC;
50 reset : in STD_LOGIC;
50 reset : in STD_LOGIC;
51 DATA : in std_logic_vector(16*2*8-1 downto 0);
51 DATA : in std_logic_vector(16*2*8-1 downto 0);
52 CMD : in std_logic_vector(10 downto 0);
52 CMD : in std_logic_vector(10 downto 0);
53 Exec : in std_logic;
53 Exec : in std_logic;
54 Ready : out std_logic;
54 Ready : out std_logic;
55 LCD_CTRL : out LCD_DRVR_CTRL_BUSS
55 LCD_CTRL : out LCD_DRVR_CTRL_BUSS
56 );
56 );
57 end LCD_16x2_ENGINE;
57 end LCD_16x2_ENGINE;
58
58
59 architecture ar_LCD_16x2_ENGINE of LCD_16x2_ENGINE is
59 architecture ar_LCD_16x2_ENGINE of LCD_16x2_ENGINE is
60
60
61 constant ConfigTbl : LCD_CFG_Tbl :=(ClearDSPLY,FunctionSet,DSPL_CTRL,SetEntryMode,RetHome);
61 constant ConfigTbl : LCD_CFG_Tbl :=(ClearDSPLY,FunctionSet,DSPL_CTRL,SetEntryMode,RetHome);
62
62
63
63
64
64
65 signal SYNCH : LCD_DRVR_SYNCH_BUSS;
65 signal SYNCH : LCD_DRVR_SYNCH_BUSS;
66 signal DRIVER_CMD : LCD_DRVR_CMD_BUSS;
66 signal DRIVER_CMD : LCD_DRVR_CMD_BUSS;
67 signal FRAME_CLK : std_logic;
67 signal FRAME_CLK : std_logic;
68
68
69 signal FRAME_CLK_reg : std_logic;
69 signal FRAME_CLK_reg : std_logic;
70 signal RefreshFlag : std_logic;
70 signal RefreshFlag : std_logic;
71 signal CMD_Flag : std_logic;
71 signal CMD_Flag : std_logic;
72 signal Exec_Reg : std_logic;
72 signal Exec_Reg : std_logic;
73
73
74 type state_t is (INIT0,INIT1,INIT2,IDLE,Refresh,Refresh0,Refresh1,ReturnHome,GoLine2,GoLine2_0,ExecCMD0,ExecCMD1);
74 type state_t is (INIT0,INIT1,INIT2,IDLE,Refresh,Refresh0,Refresh1,ReturnHome,GoLine2,GoLine2_0,ExecCMD0,ExecCMD1);
75 signal state : state_t;
75 signal state : state_t;
76 signal i : integer range 0 to 32 := 0;
76 signal i : integer range 0 to 32 := 0;
77
77
78
78
79
79
80 begin
80 begin
81
81
82 Driver0 : LCD_16x2_DRIVER
82 Driver0 : LCD_16x2_DRIVER
83 generic map(OSC_freqKHz)
83 generic map(OSC_freqKHz)
84 Port map(reset,clk,LCD_CTRL,SYNCH,DRIVER_CMD);
84 Port map(reset,clk,LCD_CTRL,SYNCH,DRIVER_CMD);
85
85
86 FRAME_CLK_GEN0 : FRAME_CLK_GEN
86 FRAME_CLK_GEN0 : FRAME_CLK_GEN
87 generic map(OSC_freqKHz)
87 generic map(OSC_freqKHz)
88 Port map( clk,reset,FRAME_CLK);
88 Port map( clk,reset,FRAME_CLK);
89
89
90
90
91
91
92 process(reset,clk)
92 process(reset,clk)
93 begin
93 begin
94 if reset = '0' then
94 if reset = '0' then
95 state <= INIT0;
95 state <= INIT0;
96 Ready <= '0';
96 Ready <= '0';
97 RefreshFlag <= '0';
97 RefreshFlag <= '0';
98 i <= 0;
98 i <= 0;
99 elsif clk'event and clk ='1' then
99 elsif clk'event and clk ='1' then
100 FRAME_CLK_reg <= FRAME_CLK;
100 FRAME_CLK_reg <= FRAME_CLK;
101 Exec_Reg <= Exec;
101 Exec_Reg <= Exec;
102
102
103 if FRAME_CLK_reg = '0' and FRAME_CLK = '1' then
103 if FRAME_CLK_reg = '0' and FRAME_CLK = '1' then
104 RefreshFlag <= '1';
104 RefreshFlag <= '1';
105 elsif state = Refresh or state = Refresh0 or state = Refresh1 then
105 elsif state = Refresh or state = Refresh0 or state = Refresh1 then
106 RefreshFlag <= '0';
106 RefreshFlag <= '0';
107 end if;
107 end if;
108
108
109 if Exec_Reg = '0' and Exec = '1' then
109 if Exec_Reg = '0' and Exec = '1' then
110 CMD_Flag <= '1';
110 CMD_Flag <= '1';
111 elsif state = ExecCMD0 or state = ExecCMD1 then
111 elsif state = ExecCMD0 or state = ExecCMD1 then
112 CMD_Flag <= '0';
112 CMD_Flag <= '0';
113 end if;
113 end if;
114
114
115 case state is
115 case state is
116 when INIT0 =>
116 when INIT0 =>
117 if SYNCH.DRVR_READY = '1' then
117 if SYNCH.DRVR_READY = '1' then
118 DRIVER_CMD.Exec <= '1';
118 DRIVER_CMD.Exec <= '1';
119 DRIVER_CMD.Duration <= Duration_20ms;
119 DRIVER_CMD.Duration <= Duration_20ms;
120 DRIVER_CMD.CMD_Data <= '0';
120 DRIVER_CMD.CMD_Data <= '0';
121 DRIVER_CMD.Word <= ConfigTbl(i);
121 DRIVER_CMD.Word <= ConfigTbl(i);
122 i <= i + 1;
122 i <= i + 1;
123 state <= INIT1;
123 state <= INIT1;
124 else
124 else
125 DRIVER_CMD.Exec <= '0';
125 DRIVER_CMD.Exec <= '0';
126 end if;
126 end if;
127 when INIT1 =>
127 when INIT1 =>
128 state <= INIT2;
128 state <= INIT2;
129 DRIVER_CMD.Exec <= '0';
129 DRIVER_CMD.Exec <= '0';
130 when INIT2 =>
130 when INIT2 =>
131 if SYNCH.DRVR_READY = '1' then
131 if SYNCH.DRVR_READY = '1' then
132 if i = 5 then
132 if i = 5 then
133 state <= Idle;
133 state <= Idle;
134 else
134 else
135 state <= INIT0;
135 state <= INIT0;
136 end if;
136 end if;
137 end if;
137 end if;
138 when Idle=>
138 when Idle=>
139 DRIVER_CMD.Exec <= '0';
139 DRIVER_CMD.Exec <= '0';
140 if RefreshFlag = '1' then
140 if RefreshFlag = '1' then
141 Ready <= '0';
141 Ready <= '0';
142 state <= Refresh;
142 state <= Refresh;
143 elsif CMD_Flag = '1' then
143 elsif CMD_Flag = '1' then
144 Ready <= '0';
144 Ready <= '0';
145 state <= ExecCMD0;
145 state <= ExecCMD0;
146 else
146 else
147 Ready <= '1';
147 Ready <= '1';
148 end if;
148 end if;
149 i <= 0;
149 i <= 0;
150 when Refresh=>
150 when Refresh=>
151 if SYNCH.DRVR_READY = '1' then
151 if SYNCH.DRVR_READY = '1' then
152 DRIVER_CMD.Exec <= '1';
152 DRIVER_CMD.Exec <= '1';
153 DRIVER_CMD.Duration <= Duration_100us;
153 DRIVER_CMD.Duration <= Duration_100us;
154 DRIVER_CMD.CMD_Data <= '1';
154 DRIVER_CMD.CMD_Data <= '1';
155 DRIVER_CMD.Word <= DATA(i*8+7 downto i*8);
155 DRIVER_CMD.Word <= DATA(i*8+7 downto i*8);
156 i <= i + 1;
157 state <= Refresh0;
156 state <= Refresh0;
158 else
157 else
159 DRIVER_CMD.Exec <= '0';
158 DRIVER_CMD.Exec <= '0';
160 end if;
159 end if;
161 when Refresh0=>
160 when Refresh0=>
161 i <= i + 1;
162 state <= Refresh1;
162 state <= Refresh1;
163 DRIVER_CMD.Exec <= '0';
163 DRIVER_CMD.Exec <= '0';
164 when Refresh1=>
164 when Refresh1=>
165 if SYNCH.DRVR_READY = '1' then
165 if SYNCH.DRVR_READY = '1' then
166 if i = 32 then
166 if i = 32 then
167 state <= ReturnHome;
167 state <= ReturnHome;
168 elsif i = 16 then
168 elsif i = 16 then
169 state <= GoLine2;
169 state <= GoLine2;
170 else
170 else
171 state <= Refresh;
171 state <= Refresh;
172 end if;
172 end if;
173 end if;
173 end if;
174
174
175 when ExecCMD0=>
175 when ExecCMD0=>
176 if SYNCH.DRVR_READY = '1' then
176 if SYNCH.DRVR_READY = '1' then
177 DRIVER_CMD.Exec <= '1';
177 DRIVER_CMD.Exec <= '1';
178 DRIVER_CMD.Duration <= CMD(9 downto 8);
178 DRIVER_CMD.Duration <= CMD(9 downto 8);
179 DRIVER_CMD.CMD_Data <= '0';
179 DRIVER_CMD.CMD_Data <= '0';
180 DRIVER_CMD.Word <= CMD(7 downto 0);
180 DRIVER_CMD.Word <= CMD(7 downto 0);
181 state <= ExecCMD1;
181 state <= ExecCMD1;
182 else
182 else
183 DRIVER_CMD.Exec <= '0';
183 DRIVER_CMD.Exec <= '0';
184 end if;
184 end if;
185
185
186 when ExecCMD1=>
186 when ExecCMD1=>
187 state <= Idle;
187 state <= Idle;
188 DRIVER_CMD.Exec <= '0';
188 DRIVER_CMD.Exec <= '0';
189
189
190 when GoLine2=>
190 when GoLine2=>
191 if SYNCH.DRVR_READY = '1' then
191 if SYNCH.DRVR_READY = '1' then
192 DRIVER_CMD.Exec <= '1';
192 DRIVER_CMD.Exec <= '1';
193 DRIVER_CMD.Duration <= Duration_100us;
193 DRIVER_CMD.Duration <= Duration_100us;
194 DRIVER_CMD.CMD_Data <= '0';
194 DRIVER_CMD.CMD_Data <= '0';
195 DRIVER_CMD.Word <= X"C0";
195 DRIVER_CMD.Word <= X"C0";
196 state <= GoLine2_0;
196 state <= GoLine2_0;
197 else
197 else
198 DRIVER_CMD.Exec <= '0';
198 DRIVER_CMD.Exec <= '0';
199 end if;
199 end if;
200 when GoLine2_0=>
200 when GoLine2_0=>
201 state <= Refresh;
201 state <= Refresh;
202 DRIVER_CMD.Exec <= '0';
202 DRIVER_CMD.Exec <= '0';
203 when ReturnHome=>
203 when ReturnHome=>
204 if SYNCH.DRVR_READY = '1' then
204 if SYNCH.DRVR_READY = '1' then
205 DRIVER_CMD.Exec <= '1';
205 DRIVER_CMD.Exec <= '1';
206 DRIVER_CMD.Duration <= Duration_4ms;
206 DRIVER_CMD.Duration <= Duration_4ms;
207 DRIVER_CMD.CMD_Data <= '0';
207 DRIVER_CMD.CMD_Data <= '0';
208 DRIVER_CMD.Word <= X"02";
208 DRIVER_CMD.Word <= RetHome;
209 state <= Idle;
209 state <= Idle;
210 else
210 else
211 DRIVER_CMD.Exec <= '0';
211 DRIVER_CMD.Exec <= '0';
212 end if;
212 end if;
213 end case;
213 end case;
214 end if;
214 end if;
215 end process;
215 end process;
216
216
217
217
218 end ar_LCD_16x2_ENGINE;
218 end ar_LCD_16x2_ENGINE;
219
219
220
220
221
221
222
222
223
223
224
224
225
225
226
226
227
227
228
228
@@ -1,124 +1,123
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 ----------------------------------------------------------------------------------
19 ----------------------------------------------------------------------------------
20 -- Company:
20 -- Company:
21 -- Engineer:
21 -- Engineer:
22 --
22 --
23 -- Create Date: 08:44:41 10/14/2010
23 -- Create Date: 08:44:41 10/14/2010
24 -- Design Name:
24 -- Design Name:
25 -- Module Name: Top_LCD - Behavioral
25 -- Module Name: Top_LCD - Behavioral
26 -- Project Name:
26 -- Project Name:
27 -- Target Devices:
27 -- Target Devices:
28 -- Tool versions:
28 -- Tool versions:
29 -- Description:
29 -- Description:
30 --
30 --
31 -- Dependencies:
31 -- Dependencies:
32 --
32 --
33 -- Revision:
33 -- Revision:
34 -- Revision 0.01 - File Created
34 -- Revision 0.01 - File Created
35 -- Additional Comments:
35 -- Additional Comments:
36 --
36 --
37 ----------------------------------------------------------------------------------
37 ----------------------------------------------------------------------------------
38 library IEEE;
38 library IEEE;
39 use IEEE.STD_LOGIC_1164.ALL;
39 use IEEE.STD_LOGIC_1164.ALL;
40
40
41 library lpp;
41 library lpp;
42 use lpp.amba_lcd_16x2_ctrlr.all;
42 use lpp.amba_lcd_16x2_ctrlr.all;
43 use lpp.LCD_16x2_CFG.all;
43 use lpp.LCD_16x2_CFG.all;
44
44
45
45
46 entity AMBA_LCD_16x2_DRIVER is
46 entity AMBA_LCD_16x2_DRIVER is
47 Port ( reset : in STD_LOGIC;
47 Port ( reset : in STD_LOGIC;
48 clk : in STD_LOGIC;
48 clk : in STD_LOGIC;
49 Bp0 : in STD_LOGIC;
49 Bp0 : in STD_LOGIC;
50 Bp1 : in STD_LOGIC;
50 Bp1 : in STD_LOGIC;
51 Bp2 : in STD_LOGIC;
51 Bp2 : in STD_LOGIC;
52 LCD_data : out STD_LOGIC_VECTOR (7 downto 0);
52 LCD_data : out STD_LOGIC_VECTOR (7 downto 0);
53 LCD_RS : out STD_LOGIC;
53 LCD_RS : out STD_LOGIC;
54 LCD_RW : out STD_LOGIC;
54 LCD_RW : out STD_LOGIC;
55 LCD_E : out STD_LOGIC;
55 LCD_E : out STD_LOGIC;
56 LCD_RET : out STD_LOGIC;
56 LCD_RET : out STD_LOGIC;
57 LCD_CS1 : out STD_LOGIC;
57 LCD_CS1 : out STD_LOGIC;
58 LCD_CS2 : out STD_LOGIC;
58 LCD_CS2 : out STD_LOGIC;
59 SF_CE0 : out std_logic
59 SF_CE0 : out std_logic
60 );
60 );
61 end AMBA_LCD_16x2_DRIVER;
61 end AMBA_LCD_16x2_DRIVER;
62
62
63 architecture Behavioral of AMBA_LCD_16x2_DRIVER is
63 architecture Behavioral of AMBA_LCD_16x2_DRIVER is
64
64
65 signal FramBUFF : STD_LOGIC_VECTOR(16*2*8-1 downto 0);
65 signal FramBUFF : STD_LOGIC_VECTOR(16*2*8-1 downto 0);
66 signal CMD : std_logic_vector(10 downto 0);
66 signal CMD : std_logic_vector(10 downto 0);
67 signal Exec : std_logic;
67 signal Exec : std_logic;
68 signal Ready : std_logic;
68 signal Ready : std_logic;
69 signal rst : std_logic;
69 signal rst : std_logic;
70 signal LCD_CTRL : LCD_DRVR_CTRL_BUSS;
70 signal LCD_CTRL : LCD_DRVR_CTRL_BUSS;
71
71
72 begin
72 begin
73
73
74 LCD_data <= LCD_CTRL.LCD_DATA;
74 LCD_data <= LCD_CTRL.LCD_DATA;
75 LCD_RS <= LCD_CTRL.LCD_RS;
75 LCD_RS <= LCD_CTRL.LCD_RS;
76 LCD_RW <= LCD_CTRL.LCD_RW;
76 LCD_RW <= LCD_CTRL.LCD_RW;
77 LCD_E <= LCD_CTRL.LCD_E;
77 LCD_E <= LCD_CTRL.LCD_E;
78
78
79
79
80 LCD_RET <= '0';
80 LCD_RET <= '0';
81 LCD_CS1 <= '0';
81 LCD_CS1 <= '0';
82 LCD_CS2 <= '0';
82 LCD_CS2 <= '0';
83
83
84 SF_CE0 <= '1';
84 SF_CE0 <= '1';
85
85
86 rst <= not reset;
87
86
88
87
89
88
90 Driver0 : LCD_16x2_ENGINE
89 Driver0 : LCD_16x2_ENGINE
91 generic map(50000)
90 generic map(50000)
92 Port map(clk,rst,FramBUFF,CMD,Exec,Ready,LCD_CTRL);
91 Port map(clk,reset,FramBUFF,CMD,Exec,Ready,LCD_CTRL);
93
92
94 FramBUFF(0*8+7 downto 0*8) <= X"41" when Bp0 = '1' else
93 FramBUFF(0*8+7 downto 0*8) <= X"41" when Bp0 = '1' else
95 X"42" when Bp1 = '1' else
94 X"42" when Bp1 = '1' else
96 X"43" when Bp2 = '1' else
95 X"43" when Bp2 = '1' else
97 X"44";
96 X"44";
98
97
99 FramBUFF(1*8+7 downto 1*8)<= X"46" when Bp0 = '1' else
98 FramBUFF(1*8+7 downto 1*8)<= X"46" when Bp0 = '1' else
100 X"47" when Bp1 = '1' else
99 X"47" when Bp1 = '1' else
101 X"48" when Bp2 = '1' else
100 X"48" when Bp2 = '1' else
102 X"49";
101 X"49";
103
102
104
103
105 CMD(9 downto 0) <= Duration_100us & CursorON when Bp0 = '1' else
104 CMD(9 downto 0) <= Duration_100us & CursorON when Bp0 = '1' else
106 Duration_100us & CursorOFF;
105 Duration_100us & CursorOFF;
107
106
108
107
109 Exec <= Bp1;
108 Exec <= Bp1;
110
109
111 FramBUFF(2*8+7 downto 2*8) <= X"23";
110 FramBUFF(2*8+7 downto 2*8) <= X"23";
112 FramBUFF(3*8+7 downto 3*8) <= X"66";
111 FramBUFF(3*8+7 downto 3*8) <= X"66";
113 FramBUFF(4*8+7 downto 4*8) <= X"67";
112 FramBUFF(4*8+7 downto 4*8) <= X"67";
114 FramBUFF(5*8+7 downto 5*8) <= X"68";
113 FramBUFF(5*8+7 downto 5*8) <= X"68";
115 FramBUFF(17*8+7 downto 17*8) <= X"69";
114 FramBUFF(17*8+7 downto 17*8) <= X"69";
116 --FramBUFF(16*2*8-1 downto 16) <= (others => '0');
115 --FramBUFF(16*2*8-1 downto 16) <= (others => '0');
117
116
118 end Behavioral;
117 end Behavioral;
119
118
120
119
121
120
122
121
123
122
124
123
@@ -1,3 +1,4
1 ./dsp/iir_filter
2 ./general_purpose
1 ./general_purpose
3 ./lpp_amba
2 ./lpp_amba
3 ./dsp/iir_filter
4 ./amba_lcd_16x2_ctrlr
@@ -1,12 +1,12
1 APB_IIR_CEL.vhd
1 APB_IIR_CEL.vhd
2 FILTER.vhd
3 FILTER_RAM_CTRLR.vhd
4 FILTERcfg.vhd
2 FILTERcfg.vhd
5 FilterCTRLR.vhd
3 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 RAM.vhd
8 iir_filter.vhd
9 RAM_CEL.vhd
9 RAM_CEL.vhd
10 RAM_CTRLR2.vhd
10 RAM_CTRLR2.vhd
11 RAM.vhd
11 Top_Filtre_IIR.vhd
12 Top_Filtre_IIR.vhd
12 iir_filter.vhd
@@ -1,13 +1,13
1 Adder.vhd
1 ADDRcntr.vhd
2 ADDRcntr.vhd
2 ALU.vhd
3 ALU.vhd
3 Adder.vhd
4 general_purpose.vhd
4 MAC.vhd
5 MAC_CONTROLER.vhd
5 MAC_CONTROLER.vhd
6 MAC_MUX2.vhd
6 MAC_MUX.vhd
7 MAC_MUX.vhd
7 MAC_MUX2.vhd
8 MAC_REG.vhd
8 MAC_REG.vhd
9 MAC.vhd
10 Multiplier.vhd
9 MUX2.vhd
11 MUX2.vhd
10 Multiplier.vhd
11 REG.vhd
12 REG.vhd
12 Shifter.vhd
13 Shifter.vhd
13 general_purpose.vhd
General Comments 0
You need to be logged in to leave comments. Login now