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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [rtl/] [verilog/] [uart16550/] [uart_tfifo.v] - Diff between revs 360 and 363

Show entire file | Details | Blame | View Log

Rev 360 Rev 363
Line 178... Line 178...
reg     [fifo_pointer_w-1:0]     top;
reg     [fifo_pointer_w-1:0]     top;
reg     [fifo_pointer_w-1:0]     bottom;
reg     [fifo_pointer_w-1:0]     bottom;
 
 
reg     [fifo_counter_w-1:0]     count;
reg     [fifo_counter_w-1:0]     count;
reg                             overrun;
reg                             overrun;
wire [fifo_pointer_w-1:0] top_plus_1 = top + 1'b1;
wire [fifo_pointer_w-1:0] top_plus_1 = top + 4'd1;
 
 
raminfr #(fifo_pointer_w,fifo_width,fifo_depth) tfifo
raminfr #(fifo_pointer_w,fifo_width,fifo_depth) tfifo
        (.clk(clk),
        (.clk(clk),
                        .we(push),
                        .we(push),
                        .a(top),
                        .a(top),
Line 195... Line 195...
always @(posedge clk or posedge wb_rst_i) // synchronous FIFO
always @(posedge clk or posedge wb_rst_i) // synchronous FIFO
begin
begin
        if (wb_rst_i)
        if (wb_rst_i)
        begin
        begin
                top             <=  0;
                top             <=  0;
                bottom          <=  1'b0;
                bottom          <=  0;
                count           <=  0;
                count           <=  0;
        end
        end
        else
        else
        if (fifo_reset) begin
        if (fifo_reset) begin
                top             <=  0;
                top             <=  0;
                bottom          <=  1'b0;
                bottom          <=  0;
                count           <=  0;
                count           <=  0;
        end
        end
  else
  else
        begin
        begin
                case ({push, pop})
                case ({push, pop})
                2'b10 : if (count<fifo_depth)  // overrun condition
                2'b10 : if (count<fifo_depth)  // overrun condition
                        begin
                        begin
                                top       <=  top_plus_1;
                                top       <=  top_plus_1;
                                count     <=  count + 1'b1;
                                count     <=  count + 5'd1;
                        end
                        end
                2'b01 : if(count>0)
                2'b01 : if(count>0)
                        begin
                        begin
                                bottom   <=  bottom + 1'b1;
                                bottom   <=  bottom + 4'd1;
                                count    <=  count - 1'b1;
                                count    <=  count - 5'd1;
                        end
                        end
                2'b11 : begin
                2'b11 : begin
                                bottom   <=  bottom + 1'b1;
                                bottom   <=  bottom + 4'd1;
                                top       <=  top_plus_1;
                                top       <=  top_plus_1;
                        end
                        end
    default: ;
    default: ;
                endcase
                endcase
        end
        end

powered by: WebSVN 2.1.0

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