summaryrefslogtreecommitdiff
path: root/2004/n/fpga/src/pwm/regdata3.vhd
diff options
context:
space:
mode:
Diffstat (limited to '2004/n/fpga/src/pwm/regdata3.vhd')
-rw-r--r--2004/n/fpga/src/pwm/regdata3.vhd47
1 files changed, 47 insertions, 0 deletions
diff --git a/2004/n/fpga/src/pwm/regdata3.vhd b/2004/n/fpga/src/pwm/regdata3.vhd
new file mode 100644
index 0000000..d3ccc1e
--- /dev/null
+++ b/2004/n/fpga/src/pwm/regdata3.vhd
@@ -0,0 +1,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;