OpenCores
URL https://opencores.org/ocsvn/mips_enhanced/mips_enhanced/trunk

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [lib/] [techmap/] [maps/] [clkmux.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
------------------------------------------------------------------------------
2
--  This file is a part of the GRLIB VHDL IP LIBRARY
3
--  Copyright (C) 2003, Gaisler Research
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 2 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
-- Entity:      clkmux
20
-- File:        clkmux.vhd
21
-- Author:      Edvin Catovic - Gaisler Research
22
-- Description: Glitch-free clock multiplexer
23
------------------------------------------------------------------------------
24
 
25
library ieee;
26
use ieee.std_logic_1164.all;
27
use work.gencomp.all;
28
use work.allclkgen.all;
29
 
30
entity clkmux is
31
  generic(tech : integer := 0;
32
          rsel : integer range 0 to 1 := 0); -- registered sel
33
  port(
34
    i0, i1  :  in  std_ulogic;
35
    sel     :  in  std_ulogic;
36
    o       :  out std_ulogic;
37
    rst     :  in  std_ulogic := '1'
38
  );
39
end entity;
40
 
41
architecture rtl of clkmux is
42
  signal seli, sel0, sel1, cg0, cg1 : std_ulogic;
43
begin
44
 
45
  rs : if rsel = 1 generate
46
    rsproc : process(i0)
47
    begin
48
      if rising_edge(i0) then seli <= sel; end if;
49
    end process;
50
  end generate;
51
 
52
  cs : if rsel = 0 generate seli <= sel; end generate;
53
 
54
  xil : if (tech = virtex2) or (tech = spartan3) or (tech = spartan3e)
55
          or (tech = virtex4) or (tech = virtex5) generate
56
    buf : clkmux_unisim port map(sel => seli, I0 => i0, I1 => i1, O => o);
57
  end generate;
58
 
59
  gen : if has_clkmux(tech) = 0 generate
60
 
61
    p0 : process(i0, rst)
62
    begin
63
      if rst = '0' then
64
        sel0 <= '1';
65
      elsif falling_edge(i0) then
66
        sel0 <= (not seli) and (not sel1);
67
      end if;
68
    end process;
69
 
70
    p1 : process(i1, rst)
71
    begin
72
      if rst = '0' then
73
        sel1 <= '0';
74
      elsif falling_edge(i1) then
75
        sel1 <= seli and (not sel0);
76
      end if;
77
    end process;
78
 
79
    cg0 <= i0 and sel0;
80
    cg1 <= i1 and sel1;
81
    o   <= cg0 or cg1;
82
 
83
  end generate;
84
end architecture;
85
 
86
 
87
 
88
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.