00001 --**************************************************************
00002 --* *
00003 --* The source code for the ATLAS BCM "AAA" FPGA is made *
00004 --* available via the GNU General Public License (GPL) *
00005 --* unless otherwise stated below. *
00006 --* *
00007 --* In case of problems/questions/bug reports etc. please *
00008 --* contact michael.niegl@cern.ch *
00009 --* *
00010 --**************************************************************
00011
00012 --**************************************************************
00013 --* *
00014 --* $Source: /local/reps/bcmfpga/bcm_aaa/bcm_aaa/lcd/lcd_commander.vhd,v $ *
00015 --* $Revision: 1.8.2.3 $ *
00016 --* $Name: dev $ *
00017 --* $Author: mniegl $ *
00018 --* $Date: 2008/11/03 17:57:46 $ *
00019
00020
00021 --* *
00022 --**************************************************************
00023
00024 library ieee;
00025
00026 use ieee.std_logic_1164.all;
00027
00028 use ieee.std_logic_arith.all;
00029
00030 use ieee.std_logic_unsigned.all;
00031
00032
00033
00034
00035
00036 entity lcd_commander is
00037 port (
00038 CLOCK : in ;
00039 IN_RS : in ;
00040 IN_DB : in (7 downto 0);
00041 STROBE : in ;
00042 BUSY : out ;
00043 RS : out ;
00044 RW : out := '0';
00045 DB : inout (7 downto 0);
00046 DIRECTION : out := '0';
00047 E : out := '1');
00048 end lcd_commander;
00049
00050 architecture lcd_commander_arc of lcd_commander is
00051
00052 signal INT_ENABLE : := '1';
00053 signal INT_DATA : (7 downto 0);
00054 signal INT_STATE : (2 downto 0) := "000";
00055
00056 begin
00057
00058
00059
00060 rising_clock : process (CLOCK) is
00061 begin
00062 if (CLOCK'event and CLOCK = '1') then
00063 if INT_STATE = "000" and STROBE = '1' then
00064 INT_STATE <= "001";
00065 INT_ENABLE <= '1';
00066 BUSY <= '1';
00067 INT_DATA <= IN_DB;
00068 RS <= IN_RS;
00069 elsif INT_STATE = "001" then
00070 INT_STATE <= "010";
00071 E <= '0';
00072 elsif INT_STATE = "010" then
00073 INT_STATE <= "011";
00074 INT_ENABLE <= '0';
00075 RS <= '0';
00076 RW <= '1';
00077 E <= '1';
00078 elsif INT_STATE = "011" then
00079 if DB(7) = '0' then
00080 INT_STATE <= "100";
00081 end if;
00082 elsif INT_STATE = "100" then
00083 RW <= '0';
00084 BUSY <= '0';
00085 INT_STATE <= "000";
00086 end if;
00087 end if;
00088 end process;
00089
00090 DIRECTION <= INT_ENABLE;
00091
00092 DB <= INT_DATA when INT_ENABLE = '1' else "ZZZZZZZZ";
00093
00094 end lcd_commander_arc;
00095