1 //////////////////////////////////////////////////////////////////////
5 //// This file is part of the Ethernet IP core project ////
6 //// http://www.opencores.org/projects.cgi/web/ethernet_tri_mode/////
9 //// - Jon Gao (gaojon@yahoo.com) ////
12 //////////////////////////////////////////////////////////////////////
14 //// Copyright (C) 2001 Authors ////
16 //// This source file may be used and distributed without ////
17 //// restriction provided that this copyright statement is not ////
18 //// removed from the file and that any derivative work contains ////
19 //// the original copyright notice and the associated disclaimer. ////
21 //// This source file is free software; you can redistribute it ////
22 //// and/or modify it under the terms of the GNU Lesser General ////
23 //// Public License as published by the Free Software Foundation; ////
24 //// either version 2.1 of the License, or (at your option) any ////
25 //// later version. ////
27 //// This source is distributed in the hope that it will be ////
28 //// useful, but WITHOUT ANY WARRANTY; without even the implied ////
29 //// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
30 //// PURPOSE. See the GNU Lesser General Public License for more ////
33 //// You should have received a copy of the GNU Lesser General ////
34 //// Public License along with this source; if not, download it ////
35 //// from http://www.opencores.org/lgpl.shtml ////
37 //////////////////////////////////////////////////////////////////////
39 // CVS Revision History
41 // $Log: flow_ctrl.v,v $
42 // Revision 1.3 2006/01/19 14:07:54 maverickist
43 // verification is complete.
45 // Revision 1.2 2005/12/16 06:44:19 Administrator
46 // replaced tab with space.
47 // passed 9.6k length frame test.
49 // Revision 1.1.1.1 2005/12/13 01:51:45 Administrator
81 input [15:0] pause_quanta ;
82 input pause_quanta_val ;
85 input pause_quanta_sub ;
87 input xoff_gen_complete ;
89 input xon_gen_complete ;
91 //******************************************************************************
93 //******************************************************************************
98 reg [15:0] pause_quanta_dl1 ;
99 reg pause_quanta_val_dl1 ;
100 reg pause_quanta_val_dl2 ;
104 reg [15:0] pause_quanta_counter ;
105 reg tx_pause_en_dl1 ;
106 reg tx_pause_en_dl2 ;
107 //******************************************************************************
108 //boundery signal processing
109 //******************************************************************************
110 always @ (posedge Clk or posedge Reset)
118 xoff_cpu_dl1 <=xoff_cpu;
119 xoff_cpu_dl2 <=xoff_cpu_dl1;
122 always @ (posedge Clk or posedge Reset)
130 xon_cpu_dl1 <=xon_cpu;
131 xon_cpu_dl2 <=xon_cpu_dl1;
134 always @ (posedge Clk or posedge Reset)
137 pause_quanta_dl1 <=0;
141 pause_quanta_dl1 <=pause_quanta;
144 always @ (posedge Clk or posedge Reset)
147 pause_quanta_val_dl1 <=0;
148 pause_quanta_val_dl2 <=0;
152 pause_quanta_val_dl1 <=pause_quanta_val;
153 pause_quanta_val_dl2 <=pause_quanta_val_dl1;
156 always @ (posedge Clk or posedge Reset)
164 tx_pause_en_dl1 <=tx_pause_en;
165 tx_pause_en_dl2 <=tx_pause_en_dl1;
168 //******************************************************************************
170 //******************************************************************************
171 always @ (posedge Clk or posedge Reset)
174 else if (xoff_gen_complete)
176 else if (xoff_cpu_dl1&&!xoff_cpu_dl2)
179 always @ (posedge Clk or posedge Reset)
182 else if (xon_gen_complete)
184 else if (xon_cpu_dl1&&!xon_cpu_dl2)
187 always @ (posedge Clk or posedge Reset)
189 pause_quanta_counter <=0;
190 else if(pause_quanta_val_dl1&&!pause_quanta_val_dl2)
191 pause_quanta_counter <=pause_quanta_dl1;
192 else if(pause_quanta_sub&&pause_quanta_counter!=0)
193 pause_quanta_counter <=pause_quanta_counter-1;
195 always @ (posedge Clk or posedge Reset)
198 else if(pause_quanta_counter==0)
200 else if (tx_pause_en_dl2)