---------------------------------------------------------------------------------- -- Company: -- Engineer: -- -- Create Date: 28.06.2021 09:20:00 -- Design Name: -- Module Name: Ecran - Behavioral -- Project Name: -- Target Devices: -- Tool Versions: -- Description: -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; use IEEE.NUMERIC_STD.ALL; use work.font.all; use work.ScreenProperties.all; entity Ecran is Port ( CLK : in STD_LOGIC; RST : in STD_LOGIC; Data_Av : in STD_LOGIC; Data_IN : in STD_LOGIC_VECTOR (0 to 6); X : in X_T; Y : in Y_T; OUT_ON : out STD_LOGIC); end Ecran; architecture Behavioral of Ecran is component TableASCII is Port ( CodeASCII : STD_LOGIC_VECTOR (0 to 6); Font : out STD_LOGIC_VECTOR (0 to (font_width * font_height) - 1)); end component; constant Flush : STD_LOGIC_VECTOR (0 to 6) := "0000000"; constant RetourChariot : STD_LOGIC_VECTOR (0 to 6) := "0001010"; constant Delete : STD_LOGIC_VECTOR (0 to 6) := "1111111"; signal Ecran : STD_LOGIC_VECTOR (0 to Ecran_Taille - 1) := (others => '0'); --(0 => '1', 1 => '0', 2 => '0', 3 => '1', 4 => '0', 5 => '0', 6 => '0', others => '0'); signal L : STD_LOGIC_VECTOR (0 to 6) := "0000000"; signal L_inc : STD_LOGIC_VECTOR (0 to 6); signal C : STD_LOGIC_VECTOR (0 to 6) := "0000000"; signal InitialL : STD_LOGIC_VECTOR (0 to 6) := "0000000"; signal InitialL_inc : STD_LOGIC_VECTOR (0 to 6); signal Full : STD_LOGIC := '0'; signal L_Lecture : L_T := 0; signal point_dereferencement : Natural := 0; signal point_dereferencement_ecriture : Natural := 0; signal CurrentCodeASCII : STD_LOGIC_VECTOR (0 to 6) := "0000000"; signal CurrentFont : STD_LOGIC_VECTOR (0 to (font_width * font_height) - 1) := (others => '0'); begin instance_TableASCII : TableASCII port map (CodeASCII => CurrentCodeASCII, Font => CurrentFont); process begin wait until CLK'event and CLK='1'; if (RST = '0') then Ecran <= (others => '0'); L <= "0000000"; C <= "0000000"; InitialL <= "0000000"; Full <= '0'; elsif (Data_Av = '1') then if (Data_IN = Flush) then Ecran <= (others => '0'); L <= "0000000"; C <= "0000000"; InitialL <= "0000000"; Full <= '0'; elsif (Data_IN = RetourChariot) then C <= "0000000"; L <= L_inc; if (L_inc = "0000000" or Full = '1') then Full <= '1'; InitialL <= InitialL_inc; Ecran(7 * C_Blocks * to_integer(unsigned(L_inc)) to 7 * C_Blocks * (to_integer(unsigned(L_inc)) + 1) - 1) <= Zero_Line; end if; elsif (Data_IN = Delete) then if (C > 0) then C <= C - 1; Ecran(7 * (C_Blocks * to_integer(unsigned(L)) + to_integer(unsigned(C)) - 1) to 7 * (C_Blocks * to_integer(unsigned(L)) + to_integer(unsigned(C))) - 1) <= "0000000"; end if; else Ecran(point_dereferencement_ecriture to point_dereferencement_ecriture + 6) <= Data_IN; C <= C + 1; if (C + 1 = C_Blocks) then C <= "0000000"; L <= L_inc; if (L_inc = 0 or Full = '1') then Full <= '1'; InitialL <= InitialL_inc; Ecran(7 * C_Blocks * to_integer(unsigned(L_inc)) to 7 * C_Blocks * (to_integer(unsigned(L_inc)) + 1) - 1) <= Zero_Line; end if; end if; end if; end if; end process; L_inc <= "0000000" when L + 1 = L_Blocks else L + 1; InitialL_inc <= "0000000" when InitialL + 1 = L_Blocks else InitialL + 1; L_Lecture <= Y/Display_CaracterHeight + to_integer(unsigned(InitialL)) - L_Blocks when (Y/Display_CaracterHeight + to_integer(unsigned(InitialL))) >= L_Blocks else Y/Display_CaracterHeight + to_integer(unsigned(InitialL)); point_dereferencement <= (7 * (C_Blocks * L_Lecture + (X/Display_CaracterWidht))); point_dereferencement_ecriture <= 7 * (C_Blocks * to_integer(unsigned(L)) + to_integer(unsigned(C))); CurrentCodeASCII <= Ecran(point_dereferencement to point_dereferencement + 6) when (Y < screen_height and X < screen_width and RST='1') else "0000000"; OUT_ON <= CurrentFont(((Y mod Display_CaracterHeight) / (Display_CaracterHeight / font_height)) * font_width + ((Display_CaracterWidht - 1) - (X mod Display_CaracterWidht)) / (Display_CaracterWidht / font_width)); end Behavioral;