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

Subversion Repositories blue

[/] [blue/] [trunk/] [blue8/] [baud.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wd5gnr
 
2
//
3
// BAUD.v
4
//
5
// www.cmosexod.com
6
// 4/13/2001 (c) 2001
7
// Jeung Joon Lee
8
//
9
// This is the "baud-rate-genrator"
10
// The "baud_clk" is the output clock feeding the
11
// receiver and transmitter modules of the UART.
12
//
13
// By design, the purpose of the "baud_clk" is to 
14
// take in the "sys_clk" and generate a clock 
15
// which is 16 x BaudRate, where BaudRate is the
16
// desired UART baud rate.  
17
//
18
// Refer to "inc.h" for the setting of system clock
19
// and the desired baud rate.
20
//        
21
 
22
module baud(
23
                        sys_clk,
24
                        sys_rst_l,
25
 
26
                        baud_clk
27
                );
28
 
29
 
30
`include "inc.h"
31
 
32
 
33
input                   sys_clk;
34
input                   sys_rst_l;
35
output                  baud_clk;
36
 
37
reg             [CW-1:0] clk_div;
38
reg                             baud_clk;
39
 
40
 
41
always @(posedge sys_clk or negedge sys_rst_l)
42
  if (~sys_rst_l) begin
43
    clk_div  <= 0;
44
    baud_clk <= 0;
45
  end else if (clk_div == CLK_DIV) begin
46
    clk_div  <= 0;
47
    baud_clk <= ~baud_clk;
48
  end else begin
49
    clk_div  <= clk_div + 1;
50
    baud_clk <= baud_clk;
51
  end
52
 
53
endmodule

powered by: WebSVN 2.1.0

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