No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Ecran.vhd 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 28.06.2021 09:20:00
  6. -- Design Name:
  7. -- Module Name: Ecran - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool Versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20. library IEEE;
  21. use IEEE.STD_LOGIC_1164.ALL;
  22. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  23. use IEEE.NUMERIC_STD.ALL;
  24. use work.font.all;
  25. use work.ScreenProperties.all;
  26. entity Ecran is
  27. Port ( CLK : in STD_LOGIC;
  28. RST : in STD_LOGIC;
  29. Data_Av : in STD_LOGIC;
  30. Data_IN : in STD_LOGIC_VECTOR (0 to 6);
  31. X : in X_T;
  32. Y : in Y_T;
  33. OUT_ON : out STD_LOGIC);
  34. end Ecran;
  35. architecture Behavioral of Ecran is
  36. component TableASCII is
  37. Port ( CodeASCII : STD_LOGIC_VECTOR (0 to 6);
  38. Font : out STD_LOGIC_VECTOR (0 to (font_width * font_height) - 1));
  39. end component;
  40. constant Flush : STD_LOGIC_VECTOR (0 to 6) := "0000000";
  41. constant RetourChariot : STD_LOGIC_VECTOR (0 to 6) := "0001101";
  42. constant Delete : STD_LOGIC_VECTOR (0 to 6) := "1111111";
  43. 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');
  44. signal L : STD_LOGIC_VECTOR (0 to 6) := "0000000";
  45. signal L_inc : STD_LOGIC_VECTOR (0 to 6);
  46. signal C : STD_LOGIC_VECTOR (0 to 6) := "0000000";
  47. signal InitialL : STD_LOGIC_VECTOR (0 to 6) := "0000000";
  48. signal InitialL_inc : STD_LOGIC_VECTOR (0 to 6);
  49. signal Full : STD_LOGIC := '0';
  50. signal L_Lecture : L_T := 0;
  51. signal point_dereferencement : Natural := 0;
  52. signal point_dereferencement_ecriture : Natural := 0;
  53. signal CurrentCodeASCII : STD_LOGIC_VECTOR (0 to 6) := "0000000";
  54. signal CurrentFont : STD_LOGIC_VECTOR (0 to (font_width * font_height) - 1) := (others => '0');
  55. begin
  56. instance_TableASCII : TableASCII
  57. port map (CodeASCII => CurrentCodeASCII,
  58. Font => CurrentFont);
  59. process
  60. begin
  61. wait until CLK'event and CLK='1';
  62. if (RST = '0') then
  63. Ecran <= (others => '0');
  64. L <= "0000000";
  65. C <= "0000000";
  66. InitialL <= "0000000";
  67. Full <= '0';
  68. elsif (Data_Av = '1') then
  69. if (Data_IN = Flush) then
  70. Ecran <= (others => '0');
  71. L <= "0000000";
  72. C <= "0000000";
  73. InitialL <= "0000000";
  74. Full <= '0';
  75. elsif (Data_IN = RetourChariot) then
  76. C <= "0000000";
  77. L <= L_inc;
  78. if (L_inc = "0000000" or Full = '1') then
  79. Full <= '1';
  80. InitialL <= InitialL_inc;
  81. Ecran(7 * C_Blocks * to_integer(unsigned(L_inc)) to 7 * C_Blocks * (to_integer(unsigned(L_inc)) + 1) - 1) <= Zero_Line;
  82. end if;
  83. elsif (Data_IN = Delete) then
  84. if (C > 0) then
  85. C <= C - 1;
  86. 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";
  87. end if;
  88. else
  89. Ecran(point_dereferencement_ecriture to point_dereferencement_ecriture + 6) <= Data_IN;
  90. C <= C + 1;
  91. if (C + 1 = C_Blocks) then
  92. C <= "0000000";
  93. L <= L_inc;
  94. if (L_inc = 0 or Full = '1') then
  95. Full <= '1';
  96. InitialL <= InitialL_inc;
  97. Ecran(7 * C_Blocks * to_integer(unsigned(L_inc)) to 7 * C_Blocks * (to_integer(unsigned(L_inc)) + 1) - 1) <= Zero_Line;
  98. end if;
  99. end if;
  100. end if;
  101. end if;
  102. end process;
  103. L_inc <= "0000000" when L + 1 = L_Blocks else L + 1;
  104. InitialL_inc <= "0000000" when InitialL + 1 = L_Blocks else InitialL + 1;
  105. 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));
  106. point_dereferencement <= (7 * (C_Blocks * L_Lecture + (X/Display_CaracterWidht)));
  107. point_dereferencement_ecriture <= 7 * (C_Blocks * to_integer(unsigned(L)) + to_integer(unsigned(C)));
  108. CurrentCodeASCII <= Ecran(point_dereferencement to point_dereferencement + 6) when (Y/Display_CaracterHeight < L_Blocks and X/Display_CaracterWidht < C_Blocks and RST='1') else
  109. "0000000";
  110. OUT_ON <= CurrentFont(((Y mod Display_CaracterHeight) / (Display_CaracterHeight / font_height)) * font_width + ((Display_CaracterWidht - 1) - (X mod Display_CaracterWidht)) / (Display_CaracterWidht / font_width));
  111. end Behavioral;