1 |
42 |
lmaarsen |
--------------------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- Ethernet Switch on Configurable Logic IP Core ----
|
4 |
|
|
---- ----
|
5 |
|
|
---- This file is part of the ESoCL project ----
|
6 |
|
|
---- http://www.opencores.org/cores/esoc/ ----
|
7 |
|
|
---- ----
|
8 |
|
|
---- Description: see design description ESoCL_dd_71022001.pdf ----
|
9 |
|
|
---- ----
|
10 |
|
|
---- To Do: see roadmap description ESoCL_dd_71022001.pdf ----
|
11 |
|
|
---- and/or release bulleting ESoCL_rb_71022001.pdf ----
|
12 |
|
|
---- ----
|
13 |
|
|
---- Author(s): L.Maarsen ----
|
14 |
|
|
---- Bert Maarsen, lmaarsen@opencores.org ----
|
15 |
|
|
---- ----
|
16 |
|
|
--------------------------------------------------------------------------------
|
17 |
|
|
---- ----
|
18 |
|
|
---- Copyright (C) 2009 Authors and OPENCORES.ORG ----
|
19 |
|
|
---- ----
|
20 |
|
|
---- This source file may be used and distributed without ----
|
21 |
|
|
---- restriction provided that this copyright statement is not ----
|
22 |
|
|
---- removed from the file and that any derivative work contains ----
|
23 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
24 |
|
|
---- ----
|
25 |
|
|
---- This source file is free software; you can redistribute it ----
|
26 |
|
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
27 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
28 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
29 |
|
|
---- later version. ----
|
30 |
|
|
---- ----
|
31 |
|
|
---- This source is distributed in the hope that it will be ----
|
32 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
33 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
34 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
35 |
|
|
---- details. ----
|
36 |
|
|
---- ----
|
37 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
38 |
|
|
---- Public License along with this source; if not, download it ----
|
39 |
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
40 |
|
|
---- ----
|
41 |
|
|
--------------------------------------------------------------------------------
|
42 |
|
|
-- Object : Entity work.esoc_clk_en_gen
|
43 |
|
|
-- Last modified : Mon Apr 14 12:48:32 2014.
|
44 |
|
|
--------------------------------------------------------------------------------
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
library ieee, std, work;
|
49 |
|
|
use ieee.std_logic_1164.all;
|
50 |
|
|
use std.textio.all;
|
51 |
|
|
use ieee.numeric_std.all;
|
52 |
|
|
use work.package_esoc_configuration.all;
|
53 |
|
|
|
54 |
|
|
entity esoc_clk_en_gen is
|
55 |
|
|
port(
|
56 |
|
|
clk : in std_logic;
|
57 |
|
|
clk_div : in integer;
|
58 |
|
|
clk_en : out std_logic;
|
59 |
|
|
reset : in std_logic);
|
60 |
|
|
end entity esoc_clk_en_gen;
|
61 |
|
|
|
62 |
|
|
--------------------------------------------------------------------------------
|
63 |
|
|
-- Object : Architecture work.esoc_clk_en_gen.esoc_clk_en_gen
|
64 |
|
|
-- Last modified : Mon Apr 14 12:48:32 2014.
|
65 |
|
|
--------------------------------------------------------------------------------
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
architecture esoc_clk_en_gen of esoc_clk_en_gen is
|
69 |
|
|
|
70 |
|
|
signal clk_count: integer;
|
71 |
|
|
|
72 |
|
|
begin
|
73 |
|
|
|
74 |
|
|
--=============================================================================================================
|
75 |
|
|
-- Process : proces to create clock enable signal
|
76 |
|
|
-- Description :
|
77 |
|
|
--=============================================================================================================
|
78 |
|
|
create_en: process(clk, reset)
|
79 |
|
|
begin
|
80 |
|
|
if reset = '1' then
|
81 |
|
|
clk_count <= 0;
|
82 |
|
|
clk_en <= '0';
|
83 |
|
|
|
84 |
|
|
elsif clk'event and clk = '1' then
|
85 |
|
|
-- clear one-clock active signals
|
86 |
|
|
clk_en <= '0';
|
87 |
|
|
|
88 |
|
|
-- count down until 0, then assert the enable for one clock period
|
89 |
|
|
if clk_count = 0 then
|
90 |
|
|
clk_count <= clk_div;
|
91 |
|
|
clk_en <= '1';
|
92 |
|
|
else
|
93 |
|
|
clk_count <= clk_count - 1 ;
|
94 |
|
|
end if;
|
95 |
|
|
end if;
|
96 |
|
|
end process;
|
97 |
|
|
|
98 |
|
|
end architecture esoc_clk_en_gen ; -- of esoc_clk_en_gen
|
99 |
|
|
|