Copied wb_1master back from quad radio
[debian/gnuradio] / usrp2 / fpga / eth / rtl / verilog / MAC_rx / Broadcast_filter.v
1 //////////////////////////////////////////////////////////////////////\r
2 ////                                                              ////\r
3 ////  Broadcast_filter.v                                          ////\r
4 ////                                                              ////\r
5 ////  This file is part of the Ethernet IP core project           ////\r
6 ////  http://www.opencores.org/projects.cgi/web/ethernet_tri_mode/////\r
7 ////                                                              ////\r
8 ////  Author(s):                                                  ////\r
9 ////      - Jon Gao (gaojon@yahoo.com)                            ////\r
10 ////                                                              ////\r
11 ////                                                              ////\r
12 //////////////////////////////////////////////////////////////////////\r
13 ////                                                              ////\r
14 //// Copyright (C) 2001 Authors                                   ////\r
15 ////                                                              ////\r
16 //// This source file may be used and distributed without         ////\r
17 //// restriction provided that this copyright statement is not    ////\r
18 //// removed from the file and that any derivative work contains  ////\r
19 //// the original copyright notice and the associated disclaimer. ////\r
20 ////                                                              ////\r
21 //// This source file is free software; you can redistribute it   ////\r
22 //// and/or modify it under the terms of the GNU Lesser General   ////\r
23 //// Public License as published by the Free Software Foundation; ////\r
24 //// either version 2.1 of the License, or (at your option) any   ////\r
25 //// later version.                                               ////\r
26 ////                                                              ////\r
27 //// This source is distributed in the hope that it will be       ////\r
28 //// useful, but WITHOUT ANY WARRANTY; without even the implied   ////\r
29 //// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////\r
30 //// PURPOSE.  See the GNU Lesser General Public License for more ////\r
31 //// details.                                                     ////\r
32 ////                                                              ////\r
33 //// You should have received a copy of the GNU Lesser General    ////\r
34 //// Public License along with this source; if not, download it   ////\r
35 //// from http://www.opencores.org/lgpl.shtml                     ////\r
36 ////                                                              ////\r
37 //////////////////////////////////////////////////////////////////////\r
38 //                                                                    \r
39 // CVS Revision History                                               \r
40 //                                                                    \r
41 // $Log: Broadcast_filter.v,v $\r
42 // Revision 1.3  2006/01/19 14:07:54  maverickist\r
43 // verification is complete.\r
44 //\r
45 // Revision 1.2  2005/12/16 06:44:16  Administrator\r
46 // replaced tab with space.\r
47 // passed 9.6k length frame test.\r
48 //\r
49 // Revision 1.1.1.1  2005/12/13 01:51:45  Administrator\r
50 // no message\r
51 //    \r
52 \r
53 module Broadcast_filter (    \r
54 Reset                   ,\r
55 Clk                     ,\r
56 //MAC_rx_ctrl           ,\r
57 broadcast_ptr           ,\r
58 broadcast_drop          ,\r
59 //FromCPU               ,\r
60 broadcast_filter_en     ,\r
61 broadcast_bucket_depth    ,\r
62 broadcast_bucket_interval \r
63 );\r
64 input           Reset                       ;\r
65 input           Clk                         ;\r
66                 //MAC_rx_ctrl               \r
67 input           broadcast_ptr               ;\r
68 output          broadcast_drop              ;\r
69                 //FromCPU                   ;\r
70 input           broadcast_filter_en         ;\r
71 input   [15:0]  broadcast_bucket_depth      ;\r
72 input   [15:0]  broadcast_bucket_interval   ;\r
73 \r
74 //******************************************************************************  \r
75 //internal signals                                                                \r
76 //******************************************************************************  \r
77 reg     [15:0]  time_counter            ;\r
78 reg     [15:0]  broadcast_counter        ;\r
79 reg             broadcast_drop          ;\r
80 //******************************************************************************  \r
81 //                                                               \r
82 //****************************************************************************** \r
83 always @ (posedge Clk or posedge Reset)\r
84     if (Reset)\r
85         time_counter    <=0;\r
86     else if (time_counter==broadcast_bucket_interval)\r
87         time_counter    <=0;\r
88     else\r
89         time_counter    <=time_counter+1;\r
90 \r
91 always @ (posedge Clk or posedge Reset)\r
92     if (Reset)\r
93         broadcast_counter   <=0;\r
94     else if (time_counter==broadcast_bucket_interval)\r
95         broadcast_counter   <=0;\r
96     else if (broadcast_ptr&&broadcast_counter!=broadcast_bucket_depth)\r
97         broadcast_counter   <=broadcast_counter+1;\r
98                 \r
99 always @ (posedge Clk or posedge Reset)\r
100     if (Reset)\r
101         broadcast_drop      <=0;\r
102     else if(broadcast_filter_en&&broadcast_counter==broadcast_bucket_depth)\r
103         broadcast_drop      <=1;\r
104     else\r
105         broadcast_drop      <=0;\r
106 \r
107 endmodule