123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- ----------------------------------------------------------------------------------
- -- 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;
|