1 |
94 |
JonasDC |
----------------------------------------------------------------------
|
2 |
|
|
---- clk_sync ----
|
3 |
|
|
---- ----
|
4 |
|
|
---- This file is part of the ----
|
5 |
|
|
---- Modular Simultaneous Exponentiation Core project ----
|
6 |
|
|
---- http://www.opencores.org/cores/mod_sim_exp/ ----
|
7 |
|
|
---- ----
|
8 |
|
|
---- Description ----
|
9 |
|
|
---- synchronises signal A to clock B, avoiding metastable ----
|
10 |
|
|
---- states. ----
|
11 |
|
|
---- ----
|
12 |
|
|
---- Dependencies: none ----
|
13 |
|
|
---- ----
|
14 |
|
|
---- Authors: ----
|
15 |
|
|
---- - Geoffrey Ottoy, DraMCo research group ----
|
16 |
|
|
---- - Jonas De Craene, JonasDC@opencores.org ----
|
17 |
|
|
---- ----
|
18 |
|
|
----------------------------------------------------------------------
|
19 |
|
|
---- ----
|
20 |
|
|
---- Copyright (C) 2011 DraMCo research group and OPENCORES.ORG ----
|
21 |
|
|
---- ----
|
22 |
|
|
---- This source file may be used and distributed without ----
|
23 |
|
|
---- restriction provided that this copyright statement is not ----
|
24 |
|
|
---- removed from the file and that any derivative work contains ----
|
25 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
26 |
|
|
---- ----
|
27 |
|
|
---- This source file is free software; you can redistribute it ----
|
28 |
|
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
29 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
30 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
31 |
|
|
---- later version. ----
|
32 |
|
|
---- ----
|
33 |
|
|
---- This source is distributed in the hope that it will be ----
|
34 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
35 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
36 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
37 |
|
|
---- details. ----
|
38 |
|
|
---- ----
|
39 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
40 |
|
|
---- Public License along with this source; if not, download it ----
|
41 |
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
42 |
|
|
---- ----
|
43 |
|
|
----------------------------------------------------------------------
|
44 |
|
|
|
45 |
|
|
library ieee;
|
46 |
|
|
use ieee.std_logic_1164.all;
|
47 |
|
|
use ieee.std_logic_unsigned.all;
|
48 |
|
|
|
49 |
|
|
entity clk_sync is
|
50 |
|
|
port (
|
51 |
|
|
sigA : in std_logic;
|
52 |
|
|
clkB : in std_logic;
|
53 |
|
|
sigB : out std_logic
|
54 |
|
|
);
|
55 |
|
|
end clk_sync;
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
architecture arch of clk_sync is
|
59 |
|
|
signal sigMeta : std_logic; -- signal where metastable states are possible
|
60 |
|
|
begin
|
61 |
|
|
|
62 |
|
|
sync : process (clkB)
|
63 |
|
|
begin
|
64 |
|
|
if rising_edge(clkB) then
|
65 |
|
|
sigMeta <= sigA;
|
66 |
|
|
sigB <= sigMeta;
|
67 |
|
|
end if;
|
68 |
|
|
end process;
|
69 |
|
|
|
70 |
|
|
end arch;
|