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] - Diff between revs 3 and 12

Only display areas with differences | Details | Blame | View Log

Rev 3 Rev 12
`timescale 1ns / 1ps
`timescale 1ns / 1ps
/*
/*
 * File         : uart_clock.v
 * File         : uart_clock.v
 * Project      : University of Utah, XUM Project MIPS32 core
 * Project      : University of Utah, XUM Project MIPS32 core
 * Creator(s)   : Grant Ayers (ayers@cs.utah.edu)
 * Creator(s)   : Grant Ayers (ayers@cs.utah.edu)
 *
 *
 * Modification History:
 * Modification History:
 *   Rev   Date         Initials  Description of Change
 *   Rev   Date         Initials  Description of Change
 *   1.0   24-May-2010  GEA       Initial design.
 *   1.0   24-May-2010  GEA       Initial design.
 *
 *
 * Standards/Formatting:
 * Standards/Formatting:
 *   Verilog 2001, 4 soft tab, wide column.
 *   Verilog 2001, 4 soft tab, wide column.
 *
 *
 * Description:
 * Description:
 *   Takes a 100 MHz clock and generates synchronous pulses for 115200 baud
 *   Takes a 100 MHz clock and generates synchronous pulses for 115200 baud
 *   and 16x 115200 baud (synchronized).
 *   and 16x 115200 baud (synchronized).
 *
 *
 *   This timing can be adjusted to allow for other baud rates.
 *   This timing can be adjusted to allow for other baud rates.
 */
 */
module uart_clock(
module uart_clock(
    input clock,
    input clock,
    output uart_tick,
    output uart_tick,
    output uart_tick_16x
    output uart_tick_16x
    );
    );
 
 
    // 100MHz / (2^13 / 151) == 16 * 115203.857 Hz
    // 100MHz / (2^13 / 151) == 16 * 115203.857 Hz
    // 100MHz / (2^17 / 151) == 115203.857 Hz
    // 100MHz / (2^17 / 151) == 115203.857 Hz
    //  66MHz / (2^14 / 453) == 16 * 115203.857 Hz
    //  66MHz / (2^14 / 453) == 16 * 115203.857 Hz
    //  66MHz / (2^18 / 453) == 115203.857 Hz
    //  66MHz / (2^18 / 453) == 115203.857 Hz
 
 
 
 
 
    // 66 MHz version
 
    reg [14:0] accumulator = 15'h0000;
 
    always @(posedge clock) begin
 
        accumulator <= accumulator[13:0] + 453;
 
    end
 
    assign uart_tick_16x = accumulator[14];
 
 
/*
/*
    // 66 MHz version
    // 100 MHz version
    reg [14:0] accumulator = 15'h0000;
    reg [13:0] accumulator = 14'h0000;
    always @(posedge clock) begin
    always @(posedge clock) begin
        accumulator <= accumulator[13:0] + 453;
        accumulator <= accumulator[12:0] + 151;
    end
    end
    assign uart_tick_16x = accumulator[14];
    assign uart_tick_16x = accumulator[13];
*/
*/
 
 
    // 100 MHz version
 
    reg [13:0] accumulator = 14'h0000;
 
    always @(posedge clock) begin
 
        accumulator <= accumulator[12:0] + 151;
 
    end
 
    assign uart_tick_16x = accumulator[13];
 
 
 
 
 
    //------------------------------
    //------------------------------
    reg [3:0] uart_16x_count = 4'h0;
    reg [3:0] uart_16x_count = 4'h0;
    always @(posedge clock) begin
    always @(posedge clock) begin
        uart_16x_count <= (uart_tick_16x) ? uart_16x_count + 1 : uart_16x_count;
        uart_16x_count <= (uart_tick_16x) ? uart_16x_count + 1 : uart_16x_count;
    end
    end
    assign uart_tick = (uart_tick_16x==1'b1 && (uart_16x_count == 4'b1111));
    assign uart_tick = (uart_tick_16x==1'b1 && (uart_16x_count == 4'b1111));
 
 
endmodule
endmodule
 
 
 
 

powered by: WebSVN 2.1.0

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