Last change
on this file since 13492 was 11755, checked in by neise, 13 years ago |
reinit of this svn repos .... it was all too messy
deleted the old folders and restarted with FACT_FAD_lib only.
(well and the testbenches)
|
File size:
725 bytes
|
Line | |
---|
1 |
|
---|
2 | LIBRARY ieee;
|
---|
3 | USE ieee.std_logic_1164.all;
|
---|
4 | USE ieee.std_logic_arith.all;
|
---|
5 | USE ieee.std_logic_unsigned.all;
|
---|
6 |
|
---|
7 | ENTITY clk_divider IS
|
---|
8 | GENERIC(
|
---|
9 | DIVIDER : integer := 25
|
---|
10 | );
|
---|
11 | PORT(
|
---|
12 | clk : IN std_logic;
|
---|
13 | sclk : OUT std_logic := '0'
|
---|
14 | );
|
---|
15 | END clk_divider ;
|
---|
16 |
|
---|
17 | ARCHITECTURE beha OF clk_divider IS
|
---|
18 |
|
---|
19 | BEGIN
|
---|
20 |
|
---|
21 | clk_proc: process (clk)
|
---|
22 | variable Z: integer range 0 to DIVIDER - 1;
|
---|
23 | begin
|
---|
24 | if rising_edge(clk) then
|
---|
25 | if (Z < DIVIDER - 1) then
|
---|
26 | Z := Z + 1;
|
---|
27 | else
|
---|
28 | Z := 0;
|
---|
29 | end if;
|
---|
30 | if (Z = 0) then
|
---|
31 | sclk <= '1';
|
---|
32 | end if;
|
---|
33 | if (Z = DIVIDER / 2) then
|
---|
34 | sclk <= '0';
|
---|
35 | end if;
|
---|
36 | end if;
|
---|
37 | end process clk_proc;
|
---|
38 |
|
---|
39 | END ARCHITECTURE beha;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.