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

Subversion Repositories mips32r1

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ayersg
`timescale 1ns / 1ps
2
/*
3
 * File         : uart-min.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
 *   115200 baud 8-N-1 serial port, using only Tx and Rx.
16
 *   (8 data bits, no parity, 1 stop bit, no flow control.)
17
 *   Configurable baud rate determined by clocking module, 16x oversampling
18
 *   for Rx data, Rx filtering, and configurable FIFO buffers for receiving
19
 *   and transmitting.
20
 *
21
 *   Described as '_min' due to lack of overflow and other status signals
22
 *   as well as the use of only Tx and Rx signals.
23
 */
24
module uart_min(
25
    input clock,
26
    input reset,
27
    input write,
28
    input [7:0] data_in,   // tx going into uart, out of serial port
29
    input read,
30
    output [7:0] data_out, // rx coming in from serial port, out of uart
31
    output data_ready,
32
    output [8:0] rx_count,
33
    /*------------------------*/
34
    input RxD,
35
    output TxD
36
    );
37
 
38
    localparam DATA_WIDTH = 8; // Bit-width of FIFO data (should be 8)
39
    localparam ADDR_WIDTH = 8; // 2^ADDR_WIDTH words of FIFO space
40
 
41
    /* Clocking Signals */
42
    wire uart_tick, uart_tick_16x;
43
 
44
    /* Receive Signals */
45
    wire [7:0] rx_data;     // Raw bytes coming in from uart
46
    wire rx_data_ready;     // Synchronous pulse indicating this (^)
47
    wire rx_fifo_empty;
48
 
49
    /* Send Signals */
50
    reg tx_fifo_deQ = 0;
51
    reg tx_start = 0;
52
    wire tx_free;
53
    wire tx_fifo_empty;
54
    wire [7:0] tx_fifo_data_out;
55
 
56
    assign data_ready = ~rx_fifo_empty;
57
 
58
    always @(posedge clock) begin
59
        if (reset) begin
60
            tx_fifo_deQ <= 0;
61
            tx_start <= 0;
62
        end
63
        else begin
64
            if (~tx_fifo_empty & tx_free & uart_tick) begin
65
                tx_fifo_deQ <= 1;
66
                tx_start <= 1;
67
            end
68
            else begin
69
                tx_fifo_deQ <= 0;
70
                tx_start <= 0;
71
            end
72
        end
73
    end
74
 
75
    uart_clock clocks (
76
        .clock          (clock),
77
        .uart_tick      (uart_tick),
78
        .uart_tick_16x  (uart_tick_16x)
79
    );
80
 
81
    uart_tx tx (
82
        .clock          (clock),
83
        .reset          (reset),
84
        .uart_tick      (uart_tick),
85
        .TxD_data       (tx_fifo_data_out),
86
        .TxD_start      (tx_start),
87
        .ready          (tx_free),
88
        .TxD            (TxD)
89
    );
90
 
91
    uart_rx rx (
92
        .clock          (clock),
93
        .reset          (reset),
94
        .RxD            (RxD),
95
        .uart_tick_16x  (uart_tick_16x),
96
        .RxD_data       (rx_data),
97
        .data_ready     (rx_data_ready)
98
    );
99
 
100
    FIFO_NoFull_Count #(
101
        .DATA_WIDTH     (DATA_WIDTH),
102
        .ADDR_WIDTH     (ADDR_WIDTH))
103
        tx_buffer (
104
        .clock          (clock),
105
        .reset          (reset),
106
        .enQ            (write),
107
        .deQ            (tx_fifo_deQ),
108
        .data_in        (data_in),
109
        .data_out       (tx_fifo_data_out),
110
        .empty          (tx_fifo_empty),
111
        .count          ()
112
    );
113
 
114
    FIFO_NoFull_Count #(
115
        .DATA_WIDTH     (DATA_WIDTH),
116
        .ADDR_WIDTH     (ADDR_WIDTH))
117
        rx_buffer (
118
        .clock          (clock),
119
        .reset          (reset),
120
        .enQ            (rx_data_ready),
121
        .deQ            (read),
122
        .data_in        (rx_data),
123
        .data_out       (data_out),
124
        .empty          (rx_fifo_empty),
125
        .count          (rx_count)
126
    );
127
 
128
endmodule
129 3 ayersg
 

powered by: WebSVN 2.1.0

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