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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [rtl/] [rxemin.v] - Diff between revs 33 and 50

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

Rev 33 Rev 50
Line 36... Line 36...
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
module rxemin(i_clk, i_ce, i_en, i_cancel, i_v, i_d, o_v, o_d, o_err);
module rxemin(i_clk, i_ce, i_en, i_cancel, i_v, i_d, o_err);
        parameter       MINNIBBLES=120;
        parameter       MINNIBBLES=120;
        localparam      LGNCOUNT=(MINNIBBLES<63)? 6
        localparam      LGNCOUNT=(MINNIBBLES<63)? 6
                                :((MINNIBBLES<127)? 7:((MINNIBBLES<255)? 8:9));
                                :((MINNIBBLES<127)? 7:((MINNIBBLES<255)? 8:9));
        input                   i_clk, i_ce, i_en, i_cancel;
        input                   i_clk, i_ce, i_en, i_cancel;
        input                   i_v;    // Valid
        input                   i_v;    // Valid
        input           [3:0]    i_d;    // Data nibble
        input           [3:0]    i_d;    // Data nibble
        output  reg             o_err;
        output  reg             o_err;
 
 
        reg     last_v;
        reg     last_v;
        reg     [(LGNCOUNT-1):0] r_ncnt;
        reg     [(LGNCOUNT-1):0] r_ncnt;
        initial o_v = 1'b0;
 
        initial last_v = 1'b0;
        initial last_v = 1'b0;
        always @(posedge i_clk)
        always @(posedge i_clk)
        if (i_ce)
        if (i_ce)
        begin
        begin
                last_v <= i_v;
                last_v <= i_v;
 
 
                if (((!i_v)&&(!o_v))||(i_cancel))
                if ((!i_v)||(i_cancel))
                begin
                begin
 
                        // Here's our reset.  If th input isn't valid (i.e., no
 
                        // packet present), or if we are cancelling the packet,
 
                        // then we come in here and reset our interface.
                        r_ncnt <= 0;
                        r_ncnt <= 0;
                        o_err  <= 0;
                        o_err  <= 0;
                end else if (i_v)
                end else if (i_v)
                begin
                begin
                        r_ncnt <= (r_ncnt<MINNIBBLES) ? r_ncnt+1'b1 : r_ncnt;
                        r_ncnt <= (r_ncnt<MINNIBBLES) ? r_ncnt+1'b1 : r_ncnt;

powered by: WebSVN 2.1.0

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