123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- ----------------------------------------------------------------------------------
- -- Company:
- -- Engineer:
- --
- -- Create Date: 09.07.2021 09:54:12
- -- Design Name:
- -- Module Name: ScreenDriver - 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;
-
- -- Uncomment the following library declaration if using
- -- arithmetic functions with Signed or Unsigned values
- --use IEEE.NUMERIC_STD.ALL;
-
- -- Uncomment the following library declaration if instantiating
- -- any Xilinx leaf cells in this code.
- --library UNISIM;
- --use UNISIM.VComponents.all;
-
- entity ScreenDriver is
- Generic ( Nb_bits : Natural
- );
- Port ( CLK : in STD_LOGIC;
- Value : in STD_LOGIC_VECTOR (Nb_Bits - 1 downto 0);
- ValueAv : in STD_LOGIC;
- IsInt : in STD_LOGIC;
- OutData : out STD_LOGIC_VECTOR (0 to 6);
- OutDataAv : out STD_LOGIC);
- end ScreenDriver;
-
- architecture Behavioral of ScreenDriver is
-
- signal intern_value : STD_LOGIC_VECTOR (Nb_Bits - 1 downto 0) := (others => '0');
- signal current_hexa : STD_LOGIC_VECTOR (3 downto 0) := (others => '0');
- subtype compteur_T is Natural range 0 to Nb_bits/4 - 1;
- signal compteur : compteur_T := 0;
- signal work_in_progess : BOOLEAN := false;
- signal x_to_send : BOOLEAN := false;
- signal first_detected : BOOLEAN := false;
-
-
- begin
-
- current_hexa <= intern_value(Nb_Bits - 1 - compteur * 4 downto Nb_Bits - compteur * 4 - 4);
-
- process
- begin
- wait until CLK'event and CLK = '1';
- if ValueAv = '1' then
- if IsInt = '0' then
- OutData <= Value (6 downto 0);
- else
- intern_value <= Value;
- OutData <= "0110000";
- x_to_send <= true;
- end if;
- OutDataAv <= '1';
- elsif x_to_send then
- OutData <= "1111000";
- OutDataAv <= '1';
- x_to_send <= false;
- work_in_progess <= true;
- first_detected <= false;
- elsif work_in_progess then
- case current_hexa is
- when "0000" =>
- if first_detected or compteur = Nb_bits/4 - 1 then
- OutData <= "0110000";
- end if;
- when "0001" =>
- OutData <= "0110001";
- when "0010" =>
- OutData <= "0110010";
- when "0011" =>
- OutData <= "0110011";
- when "0100" =>
- OutData <= "0110100";
- when "0101" =>
- OutData <= "0110101";
- when "0110" =>
- OutData <= "0110110";
- when "0111" =>
- OutData <= "0110111";
- when "1000" =>
- OutData <= "0111000";
- when "1001" =>
- OutData <= "0111001";
- when "1010" =>
- OutData <= "1000001";
- when "1011" =>
- OutData <= "1000010";
- when "1100" =>
- OutData <= "1000011";
- when "1101" =>
- OutData <= "1000100";
- when "1110" =>
- OutData <= "1000101";
- when "1111" =>
- OutData <= "1000110";
- when others =>
- OutData <= "0000001";
- end case;
-
-
- if first_detected or not (current_hexa = "0000") or compteur = Nb_bits/4 - 1 then
- OutDataAv <= '1';
- first_detected <= true;
- else
- OutDataAv <= '0';
- first_detected <= false;
- end if;
-
- if (compteur = Nb_bits/4 - 1) then
- compteur <= 0;
- work_in_progess <= false;
- x_to_send <= false;
- first_detected <= false;
- else
- compteur <= compteur + 1;
- end if;
- else
- OutDataAv <= '0';
- end if;
- end process;
-
- end Behavioral;
|