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

Subversion Repositories mips32r1

[/] [mips32r1/] [trunk/] [Hardware/] [XUPV5-LX110T_SoC/] [MIPS32-Pipelined-Hw/] [src/] [UART/] [uart_clock.v] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ayersg
`timescale 1ns / 1ps
2
/*
3
 * File         : uart_clock.v
4
 * Project      : University of Utah, XUM Project MIPS32 core
5
 * Creator(s)   : Grant Ayers (ayers@cs.utah.edu)
6
 *
7
 * Modification History:
8
 *   Rev   Date         Initials  Description of Change
9
 *   1.0   24-May-2010  GEA       Initial design.
10
 *
11
 * Standards/Formatting:
12
 *   Verilog 2001, 4 soft tab, wide column.
13
 *
14
 * Description:
15
 *   Takes a 100 MHz clock and generates synchronous pulses for 115200 baud
16
 *   and 16x 115200 baud (synchronized).
17
 *
18
 *   This timing can be adjusted to allow for other baud rates.
19
 */
20
module uart_clock(
21
    input clock,
22
    output uart_tick,
23
    output uart_tick_16x
24
    );
25
 
26
    // 100MHz / (2^13 / 151) == 16 * 115203.857 Hz
27
    // 100MHz / (2^17 / 151) == 115203.857 Hz
28
    //  66MHz / (2^14 / 453) == 16 * 115203.857 Hz
29
    //  66MHz / (2^18 / 453) == 115203.857 Hz
30
 
31
 
32
    // 66 MHz version
33
    reg [14:0] accumulator = 15'h0000;
34
    always @(posedge clock) begin
35
        accumulator <= accumulator[13:0] + 453;
36
    end
37
    assign uart_tick_16x = accumulator[14];
38
 
39 12 ayersg
/*
40 2 ayersg
    // 100 MHz version
41
    reg [13:0] accumulator = 14'h0000;
42
    always @(posedge clock) begin
43
        accumulator <= accumulator[12:0] + 151;
44
    end
45
    assign uart_tick_16x = accumulator[13];
46 12 ayersg
*/
47 2 ayersg
 
48
    //------------------------------
49
    reg [3:0] uart_16x_count = 4'h0;
50
    always @(posedge clock) begin
51
        uart_16x_count <= (uart_tick_16x) ? uart_16x_count + 1 : uart_16x_count;
52
    end
53
    assign uart_tick = (uart_tick_16x==1'b1 && (uart_16x_count == 4'b1111));
54
 
55
endmodule
56 3 ayersg
 

powered by: WebSVN 2.1.0

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