Blame view

fpga/FPGA_projet/ProjectOutputs/Default - All Constraints/Configurable_U1.VHD 1.56 KB
ebafc595   csaad   mise à jour fichi...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  --------------------------------------------------------------------------------

  LIBRARY IEEE;

  USE IEEE.Std_Logic_1164.all;

  USE IEEE.Std_Logic_Unsigned.all;

  --------------------------------------------------------------------------------

  

  --------------------------------------------------------------------------------

  ENTITY Configurable_U1 IS

    PORT(

        D    : IN std_logic_vector(7 downto 0) := (OTHERS => 'U');

        C    : IN std_logic  := 'U';

        PWM  : OUT std_logic := '0'

    );

  END Configurable_U1;

  --------------------------------------------------------------------------------

  

  --------------------------------------------------------------------------------

  ARCHITECTURE structure OF Configurable_U1 IS

  --------------------------------------------------------------------------------

  CONSTANT cCounterMax : std_logic_vector(7 downto 0) := (OTHERS => '1');

  CONSTANT cZeroPW : std_logic_vector(7 downto 0) := (OTHERS => '0');

  SIGNAL I : std_logic_vector(7 downto 0) := (Others=> '0');

  --------------------------------------------------------------------------------

  BEGIN

      PROCESS(C)

      BEGIN

          IF C'Event and C = '1' THEN

              IF (I > D) OR (D = cZeroPW) THEN

                  PWM <= '0';

              ELSE 

                  PWM <= '1';

              END IF;

  

              IF I >= cCounterMax THEN

                  I <= (OTHERS => '0');

              ELSE

                  I <= I + 1;

              END IF;

          END IF;

      END PROCESS;

  END structure;

  --------------------------------------------------------------------------------