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

Subversion Repositories modbus

[/] [modbus/] [trunk/] [enlace/] [divider8_uart.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 guanucolui
------------------------------------------------------------------
2
--  divider8_uart.vhd -- 
3
-- This circuit generates a clock signal with a frequency 8 times slower
4
-- than the input clock frequency.
5
-- The use of a counter to generate the output clock makes the first period of the output clock only 7 times slower, because
6
-- the first time, the counter counts from 0 to 3 (3 cycles) and the following times it counts from 3 to 3 (4 cycles)
7
-- This is not important, since the UART detects the rising edges of this output clock and
8
-- there are always 8 input clock cycles between two consecutive output clock rising edges.
9
 
10
------------------------------------------------------------------
11
-- Luis Jacobo Alvarez Ruiz de Ojeda
12
-- Dpto. Tecnologia Electronica
13
-- University of Vigo
14
-- 18, October, 2006 
15
------------------------------------------------------------------
16
 
17
 
18
library IEEE;
19
use IEEE.STD_LOGIC_1164.ALL;
20
use IEEE.STD_LOGIC_ARITH.ALL;
21
use IEEE.STD_LOGIC_UNSIGNED.ALL;
22
 
23
entity divider8_uart is
24
    Port ( clk_in : in std_logic;
25
           clk_out_8_times_slow : out std_logic;
26
                          reset: in std_logic
27
                          );
28
end divider8_uart;
29
 
30
architecture Behavioral of divider8_uart is
31
signal count: integer range 0 to 3;
32
signal clk_out_aux: std_logic;
33
 
34
begin
35
 
36
clk_out_8_times_slow <= clk_out_aux;
37
 
38
process (reset, clk_in, count, clk_out_aux)
39
begin
40
        if reset = '1' then     clk_out_aux <='0';
41
                                                                count <= 0;
42
        elsif (clk_in='1' and clk_in'event) then
43
                        if count = 3 then clk_out_aux <= not clk_out_aux;
44
                                                              count <= 0;
45
                        else count <= count+1;
46
                        end if;
47
        end if;
48
end process;
49
 
50
end Behavioral;

powered by: WebSVN 2.1.0

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