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

Subversion Repositories xulalx25soc

[/] [xulalx25soc/] [trunk/] [rtl/] [uartdev.v] - Diff between revs 7 and 9

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 7 Rev 9
Line 58... Line 58...
        reg     [29:0]   r_setup;
        reg     [29:0]   r_setup;
        reg             r_tx_stb, rx_rdy;
        reg             r_tx_stb, rx_rdy;
        reg     [7:0]    r_tx_data;
        reg     [7:0]    r_tx_data;
        initial r_setup = DEFAULT_SETUP;
        initial r_setup = DEFAULT_SETUP;
        always @(posedge i_clk)
        always @(posedge i_clk)
                if ((i_wb_cyc)&&(i_wb_stb)&&(i_wb_we))
                if ((i_wb_cyc)&&(i_wb_stb)&&(i_wb_we)&&(~i_wb_addr[1]))
 
                        r_setup <= i_wb_data[29:0];
 
 
 
        initial r_tx_stb = 1'b0;
 
        always @(posedge i_clk)
 
                if ((i_wb_cyc)&&(i_wb_stb)&&(i_wb_we)&&(i_wb_addr == 2'b10))
                begin
                begin
                        case(i_wb_addr)
                        // Note: there's no check for overflow here.
                        2'b00: r_setup <= i_wb_data[29:0];
                        // You're on your own: verify that the device
                        2'b10: begin
                        // isn't busy first.
                                r_tx_data <= i_wb_data[7:0];
                                r_tx_data <= i_wb_data[7:0];
                                r_tx_stb <= 1'b1;
                                r_tx_stb <= 1'b1;
                                end
 
                        default: begin end
 
                        endcase
 
                end else
                end else
                        r_tx_stb <= 1'b0;
                        r_tx_stb <= 1'b0;
 
 
        wire    rx_stb, rx_break, rx_parity_err, rx_frame_err, rx_ignored;
        wire    rx_stb, rx_break, rx_parity_err, rx_frame_err;
        wire    [7:0]    rx_data;
        wire    [7:0]    rx_data;
        rxuart  rxmod(i_clk, 1'b0, r_setup, i_rx_uart,
        rxuart  rxmod(i_clk, 1'b0, r_setup, i_rx_uart,
                        rx_stb, rx_data, rx_break,
                        rx_stb, rx_data, rx_break,
                        rx_parity_err, rx_frame_err, rx_ignored);
                        rx_parity_err, rx_frame_err);
 
 
        wire    tx_break, tx_busy;
        wire    tx_break, tx_busy;
        assign  tx_break = 1'b0;
        assign  tx_break = 1'b0;
        txuart  txmod(i_clk, 1'b0, r_setup, tx_break, r_tx_stb, r_tx_data,
        txuart  txmod(i_clk, 1'b0, r_setup, tx_break, r_tx_stb, r_tx_data,
                        o_tx_uart, tx_busy);
                        o_tx_uart, tx_busy);
 
 
        reg     [7:0]    r_data;
        reg     [7:0]    r_data;
        always @(posedge i_clk)
        always @(posedge i_clk)
                if (rx_stb)
                if (rx_stb)
                        r_data <= rx_data;
                        r_data <= rx_data;
 
 
 
        initial o_wb_data = 32'h00;
        always @(posedge i_clk)
        always @(posedge i_clk)
        begin
        begin
                if (rx_stb)
                if (rx_stb)
                        rx_rdy <= (rx_rdy | rx_stb);
                        rx_rdy <= (rx_rdy | rx_stb);
 
 
Line 97... Line 101...
                2'b00: o_wb_data <= { 2'b00, r_setup };
                2'b00: o_wb_data <= { 2'b00, r_setup };
                2'b01: o_wb_data <= { 2'b00, r_setup };
                2'b01: o_wb_data <= { 2'b00, r_setup };
                2'b10: o_wb_data <= { 31'h00,tx_busy };
                2'b10: o_wb_data <= { 31'h00,tx_busy };
                2'b11: begin
                2'b11: begin
                        if ((i_wb_cyc)&&(i_wb_stb)&&(~i_wb_we))
                        if ((i_wb_cyc)&&(i_wb_stb)&&(~i_wb_we))
                                rx_rdy <= 1'b0;
                                rx_rdy <= rx_stb;
                        o_wb_data <= { 20'h00, rx_break, rx_frame_err, rx_parity_err, ~rx_rdy, r_data };
                        o_wb_data <= { 20'h00, rx_break, rx_frame_err, rx_parity_err, ~rx_rdy, r_data };
                        end
                        end
                endcase
                endcase
                o_wb_ack <= (i_wb_cyc)&&(i_wb_stb);
                o_wb_ack <= (i_wb_cyc)&&(i_wb_stb); // Read or write, we ack
        end
        end
 
 
        assign  o_wb_stall = 1'b0;
        assign  o_wb_stall = 1'b0;
        assign  o_rx_int = rx_stb;
        assign  o_rx_int = rx_stb;
        assign  o_tx_int = ~tx_busy;
        assign  o_tx_int = ~tx_busy;

powered by: WebSVN 2.1.0

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