##// END OF EJS Templates
add Sync_FF
pellion -
r120:ab1b1d581f8e JC
parent child
Show More
@@ -0,0 +1,57
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
19 -- Author : Jean-christophe PELLION
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------
22 LIBRARY IEEE;
23 USE IEEE.numeric_std.ALL;
24 USE IEEE.std_logic_1164.ALL;
25
26 ENTITY SYNC_FF IS
27
28 GENERIC (
29 NB_FF_OF_SYNC : INTEGER := 2);
30
31 PORT (
32 clk : IN STD_LOGIC;
33 rstn : IN STD_LOGIC;
34 A : IN STD_LOGIC;
35 A_sync : OUT STD_LOGIC);
36
37 END SYNC_FF;
38
39 ARCHITECTURE beh OF SYNC_FF IS
40 SIGNAL A_temp : STD_LOGIC_VECTOR(NB_FF_OF_SYNC DOWNTO 0);
41 BEGIN -- beh
42
43 sync_loop : FOR I IN 0 TO NB_FF_OF_SYNC-1 GENERATE
44 PROCESS (clk, rstn)
45 BEGIN -- PROCESS
46 IF rstn = '0' THEN -- asynchronous reset (active low)
47 A_temp(I) <= '0';
48 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
49 A_temp(I) <= A_temp(I+1);
50 END IF;
51 END PROCESS;
52 END GENERATE sync_loop;
53
54 A_temp(NB_FF_OF_SYNC) <= A;
55 A_sync <= A_temp(0);
56
57 END beh;
General Comments 0
You need to be logged in to leave comments. Login now