library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity Schieberegister is generic ( MIN_COUNT_Zeile : natural := 0;--- MAX_COUNT_Zeile : natural := 6; MIN_COUNT_Spalte : natural := 0; MAX_COUNT_Spalte : natural := 4 ); port ( c_in : in std_logic; taste_rechts: in std_logic; taste_links: in std_logic; taste_oben: in std_logic; taste_unten: in std_logic; taste_reset: in std_logic; Spalte : out std_logic_vector(4 downto 0):="00001"; Zeile : out std_logic_vector(6 downto 0):="1111110"; x : out std_logic_vector (6 downto 0):= "0001001"; y : out std_logic_vector(6 downto 0) := "0010001"; a : out std_logic; b : out std_logic; c : out std_logic; d : out std_logic; e : out std_logic; f : out std_logic; g : out std_logic; h : out std_logic; i : out std_logic; j : out std_logic; k : out std_logic; l : out std_logic; m : out std_logic; n : out std_logic ); end entity; architecture archi of Schieberegister is begin process (c_in, taste_reset, taste_rechts, taste_links, taste_oben, taste_unten) variable count_Spalte: integer range MIN_COUNT_Spalte to Max_COUNT_Spalte; variable count_Zeile : integer range MIN_COUNT_Zeile to Max_COUNT_Zeile; begin -------------------Reset--------------------- if( taste_reset = '0')then ----ist auf dem board low-aktiv(beim drücken) Spalte <= "11111"; ----------alle LED`s leuchten, wenn reset gedrückt Zeile <= "0000000"; count_Spalte := 0; ---erste stelle links count_Zeile := 0; else -------------------Spalten---------------------- if(rising_edge(c_in) and taste_rechts = '1')then ---wird extern high-aktiv betätigt if(count_Spalte = 4)then ---falls pkt rechts am Ende, dann an erste Position rücken count_Spalte := 0; else count_Spalte := count_Spalte + 1;---ansonsten eins nach rechts setzen end if; end if; if(rising_edge(c_in) and taste_links = '1')then if(count_Spalte = 0)then ----analog oben count_Spalte := 4; else count_Spalte := count_Spalte - 1; end if; end if; case count_Spalte is ------falls alles kacke ist, bedenke dass wir diese reihenfolge geändert haben when 0 => Spalte <= "00001"; a<='1'; b<='0'; c<='1'; d<='1'; e<='0'; f<='1'; g<='1'; when 1 => Spalte <= "00010"; a<='0'; b<='0'; c<='1'; d<='0'; e<='1'; f<='0'; g<='0'; when 2 => Spalte <= "00100"; a<='0'; b<='0'; c<='1'; d<='0'; e<='0'; f<='1'; g<='0'; when 3 => Spalte <= "01000"; a<='1'; b<='0'; c<='0'; d<='0'; e<='0'; f<='1'; g<='1'; when 4 => Spalte <= "10000"; a<='0'; b<='1'; c<='0'; d<='0'; e<='0'; f<='1'; g<='0'; end case; ----------------------Zeilen----------------------------------------------- if(rising_edge(c_in) and taste_oben = '1')then if(count_Zeile = 0)then --6 count_Zeile := 6; --0 else count_Zeile := count_Zeile - 1; -- + end if; end if; if(rising_edge(c_in) and taste_unten = '1')then if(count_Zeile = 6)then ---0 count_Zeile := 0; ---6 else count_Zeile := count_Zeile + 1; --- - end if; end if; case count_Zeile is when 0 => Zeile <= "0111111"; h<='1'; i<='0'; j<='1'; k<='1'; l<='0'; m<='1'; n<='1'; when 1 => Zeile <= "1011111"; h<='0'; i<='0'; j<='1'; k<='0'; l<='1'; m<='0'; n<='0'; when 2 => Zeile <= "1101111"; h<='0'; i<='0'; j<='1'; k<='0'; l<='0'; m<='1'; n<='0'; when 3 => Zeile <= "1110111"; h<='1'; i<='0'; j<='0'; k<='0'; l<='0'; m<='1'; n<='1'; when 4 => Zeile <= "1111011"; h<='0'; i<='1'; j<='0'; k<='0'; l<='0'; m<='1'; n<='0'; when 5 => Zeile <= "1111101"; h<='0'; i<='1'; j<='0'; k<='0'; l<='0'; m<='0'; n<='0'; when 6 => Zeile <= "1111110"; h<='0'; i<='0'; j<='1'; k<='1'; l<='0'; m<='1'; n<='1'; end case; end if; end process; end archi; ----------------------------------end---------architecture