summaryrefslogtreecommitdiff
path: root/2004/n/fpga/src/pwm/regdata3.vhd
blob: d3ccc1eac8cca717a7fd83919169851b643261fb (plain)
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
43
44
45
46
47
--*************************************************************
--*regdata3.vhd                                               *
--*Eurobot 2004 : APB Team                                    *
--*Auteur : Fid�le GAFAN                                      *
--*Registre de                                                *
--* sauvegarde des donnees entrant                            *
--* conversion des vecteurs en entiers                        *
--* mise � disposition de cette donn�e pour les autres modules*
--*REMARQUE(S)                                                *
--*pour reset=1:le premier PWM fait 0,5ms                     *
--*************************************************************
--LIBRARIES 
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
library work;
library synopsys;
use synopsys.bv_arithmetic.all;
--ENTITY
entity regdata3 is
port(  RST : in std_logic;
       CLK : in std_logic;
       CLK1USREG : in std_logic;--horloge se d�clenchant toutes les 1us
       enloadreg: in std_logic; --autorisation de chargement provenant de fsm
       datain: in std_logic_vector (7 downto 0);
       datareg: out integer range 0 to 255
     );
end regdata3;
--ARCHITECTURE
architecture BEHAV of regdata3 is
begin
process (RST,clk)
begin
if (RST='1') then
	datareg<=0; --valeur par d�faut de la sortie=0,5ms
      --datareg<=conv_integer(std_logic_vector(datain (7 downto 0)));  --�
      --activer si on veut un d�marrage imm�diat
elsif (CLK'event and CLK = '1') then
  if (CLK1USREG='1') then               --chargement toutes les 1us si load=1
    if  (enloadreg='1') then
         datareg<=conv_integer(std_logic_vector(datain (7 downto 0)));
    end if;                                                                   
  end if;
end if;
end process;
end BEHAV;