remove unused port
[debian/gnuradio] / usrp2 / fpga / eth / rtl / verilog / MAC_tx / MAC_tx_addr_add.v
1 // ////////////////////////////////////////////////////////////////////\r
2 // //                                                              ////\r
3 // //  MAC_tx_addr_add.v                                           ////\r
4 // //                                                              ////\r
5 // //  This file is part of the Ethernet IP core project           ////\r
6 // //  http://www.opencores.org/projects.cgi/wr_en/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: MAC_tx_addr_add.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:18  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 MAC_tx_addr_add \r
54   (Reset               ,\r
55    Clk                 ,\r
56    MAC_tx_addr_init    ,\r
57    MAC_tx_addr_rd      ,\r
58    MAC_tx_addr_data    ,\r
59    //CPU               ,\r
60    MAC_add_prom_data   ,\r
61    MAC_add_prom_add    ,\r
62    MAC_add_prom_wr     \r
63    );\r
64    \r
65    input Reset               ;\r
66    input Clk                 ;\r
67    input MAC_tx_addr_rd      ;\r
68    input MAC_tx_addr_init    ;\r
69    output [7:0] MAC_tx_addr_data    ;\r
70    //CPU               ;\r
71    input [7:0]  MAC_add_prom_data   ;\r
72    input [2:0]  MAC_add_prom_add    ;\r
73    input        MAC_add_prom_wr     ;\r
74    \r
75    // ******************************************************************************   \r
76    // internal signals                                                              \r
77    // ******************************************************************************\r
78    reg [2:0]    add_rd;\r
79    wire [2:0]   add_wr;\r
80    wire [7:0]   din;\r
81    //wire [7:0]         dout;\r
82    reg [7:0]    dout;\r
83    wire         wr_en;\r
84    reg          MAC_add_prom_wr_dl1;\r
85    reg          MAC_add_prom_wr_dl2;\r
86    // ******************************************************************************   \r
87    // write data from cpu to prom                                                              \r
88    // ******************************************************************************\r
89    always @ (posedge Clk or posedge Reset)\r
90      if (Reset)\r
91        begin\r
92           MAC_add_prom_wr_dl1     <=0;\r
93           MAC_add_prom_wr_dl2     <=0;\r
94        end\r
95      else\r
96        begin\r
97           MAC_add_prom_wr_dl1     <=MAC_add_prom_wr;\r
98           MAC_add_prom_wr_dl2     <=MAC_add_prom_wr_dl1;\r
99        end     \r
100    \r
101    assign wr_en   =MAC_add_prom_wr_dl1&!MAC_add_prom_wr_dl2;\r
102    assign add_wr  =MAC_add_prom_add;\r
103    assign din     =MAC_add_prom_data;\r
104    \r
105    // ******************************************************************************   \r
106    // read data from cpu to prom                                                              \r
107    // ******************************************************************************\r
108    always @ (posedge Clk or posedge Reset)\r
109      if (Reset)\r
110        add_rd       <=0;\r
111      else if (MAC_tx_addr_init)\r
112        add_rd       <=0;\r
113      else if (MAC_tx_addr_rd)\r
114        add_rd       <=add_rd + 1;\r
115    assign MAC_tx_addr_data=dout;      \r
116    // ******************************************************************************   \r
117    // b port for read ,a port for write .\r
118    // ******************************************************************************\r
119    \r
120    reg [7:0] address_ram [0:7];\r
121    always @(posedge Clk)\r
122      if(wr_en)\r
123        address_ram[add_wr] <= din;\r
124 \r
125    always @(posedge Clk)\r
126      dout <= address_ram[add_rd];\r
127 \r
128 endmodule // MAC_tx_addr_add\r