1 |
59 |
fisher5090 |
`timescale 1ns / 1ps
|
2 |
|
|
//////////////////////////////////////////////////////////////////////
|
3 |
|
|
//// ////
|
4 |
|
|
//// MODULE NAME: manage_top mdoule ////
|
5 |
|
|
//// ////
|
6 |
|
|
//// DESCRIPTION: Implement Management module to config the MAC, ////
|
7 |
|
|
//// read statistics info, and get PHY info via MDIO ////
|
8 |
|
|
//// ////
|
9 |
|
|
//// This file is part of the 10 Gigabit Ethernet IP core project ////
|
10 |
|
|
//// http://www.opencores.org/projects/ethmac10g/ ////
|
11 |
|
|
//// ////
|
12 |
|
|
//// AUTHOR(S): ////
|
13 |
|
|
//// Zheng Cao ////
|
14 |
|
|
//// ////
|
15 |
|
|
//////////////////////////////////////////////////////////////////////
|
16 |
|
|
//// ////
|
17 |
|
|
//// Copyright (c) 2005 AUTHORS. All rights reserved. ////
|
18 |
|
|
//// ////
|
19 |
|
|
//// This source file may be used and distributed without ////
|
20 |
|
|
//// restriction provided that this copyright statement is not ////
|
21 |
|
|
//// removed from the file and that any derivative work contains ////
|
22 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
23 |
|
|
//// ////
|
24 |
|
|
//// This source file is free software; you can redistribute it ////
|
25 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
26 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
27 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
28 |
|
|
//// later version. ////
|
29 |
|
|
//// ////
|
30 |
|
|
//// This source is distributed in the hope that it will be ////
|
31 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
32 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
33 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
34 |
|
|
//// details. ////
|
35 |
|
|
//// ////
|
36 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
37 |
|
|
//// Public License along with this source; if not, download it ////
|
38 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
39 |
|
|
//// ////
|
40 |
|
|
//////////////////////////////////////////////////////////////////////
|
41 |
|
|
//
|
42 |
|
|
// CVS REVISION HISTORY:
|
43 |
|
|
//
|
44 |
|
|
// $Log: not supported by cvs2svn $
|
45 |
|
|
// Revision 1.1 2005/12/25 16:43:10 Zheng Cao
|
46 |
|
|
//
|
47 |
|
|
//
|
48 |
|
|
//
|
49 |
|
|
//////////////////////////////////////////////////////////////////////
|
50 |
|
|
module management_top(mgmt_clk, rxclk, txclk, mgmt_opcode, mgmt_addr, mgmt_wr_data, mgmt_rd_data,
|
51 |
|
|
mgmt_miim_sel, mgmt_req, mgmt_miim_rdy, rxStatRegPlus, txStatRegPlus,
|
52 |
|
|
cfgRxRegData, cfgTxRegData, mdc, mdio, reset);
|
53 |
|
|
input mgmt_clk; //management clock
|
54 |
|
|
input rxclk; //receive clock
|
55 |
|
|
input txclk; //transmit clock
|
56 |
|
|
input[1:0] mgmt_opcode; //management opcode(read/write/mdio)
|
57 |
|
|
input[9:0] mgmt_addr; //management address, including addresses of configuration, statistics and MDIO registers
|
58 |
|
|
input[31:0] mgmt_wr_data; //Data to be writen to Configuration/MDIO registers
|
59 |
|
|
output[31:0] mgmt_rd_data; //Data read from Configuration/Statistics/MDIO registers
|
60 |
|
|
input mgmt_miim_sel; //select internal register or MDIO registers
|
61 |
|
|
input mgmt_req; //Valid when operate statistics/MDIO registers, one clock valid____|-|____
|
62 |
|
|
output mgmt_miim_rdy; //Indicate the Management Module is in IDLE Status
|
63 |
|
|
input[18:0] rxStatRegPlus; //From Receive Module, one bit is related to one receive statistics register
|
64 |
|
|
input[14:0] txStatRegPlus; //From Transmit Module, one bit is related to one transmit statistics register
|
65 |
|
|
output[52:0] cfgRxRegData; //To Receive Module, config receive module
|
66 |
|
|
output[9:0] cfgTxRegData; //To Transmit Module, config transmit module
|
67 |
|
|
output mdc;
|
68 |
|
|
inout mdio;
|
69 |
|
|
input reset;
|
70 |
|
|
|
71 |
|
|
wire[1:0] mdio_opcode;
|
72 |
|
|
wire mdio_out_valid;
|
73 |
|
|
wire mdio_in_valid;
|
74 |
|
|
wire[41:0] mdio_data_out;
|
75 |
|
|
wire[15:0] mdio_data_in;
|
76 |
|
|
wire[31:0] mgmt_config;
|
77 |
|
|
|
78 |
|
|
IOBUF mdio_gen(.I(mdio_o), .O(mdio_i), .T(mdio_t), .IO(mdio));
|
79 |
|
|
|
80 |
|
|
/////////////////////////////////////////////////////
|
81 |
|
|
// Read&Write Logic for Config&Statistics Registers
|
82 |
|
|
/////////////////////////////////////////////////////
|
83 |
|
|
manage_registers mgmt_interface(.mgmt_clk(mgmt_clk), .rxclk(rxclk), .txclk(txclk), .reset(reset), .mgmt_opcode(mgmt_opcode), .mgmt_addr(mgmt_addr),
|
84 |
|
|
.mgmt_wr_data(mgmt_wr_data), .mgmt_rd_data(mgmt_rd_data), .mgmt_miim_sel(mgmt_miim_sel), .mgmt_req(mgmt_req),
|
85 |
|
|
.mgmt_miim_rdy(mgmt_miim_rdy), .rxStatRegPlus(rxStatRegPlus), .txStatRegPlus(txStatRegPlus), .cfgRxRegData(cfgRxRegData),
|
86 |
|
|
.cfgTxRegData(cfgTxRegData), .mdio_opcode(mdio_opcode), .mdio_data_out(mdio_data_out), .mdio_data_in(mdio_data_in),
|
87 |
|
|
.mdio_in_valid(mdio_in_valid), .mdio_out_valid(mdio_out_valid), .mgmt_config(mgmt_config));
|
88 |
|
|
|
89 |
|
|
//////////////////////////////////////////
|
90 |
|
|
// Generate MDIO signals
|
91 |
|
|
//////////////////////////////////////////
|
92 |
|
|
mdio mdio_inst(.mgmt_clk(mgmt_clk), .reset(reset), .mdc(mdc), .mdio_t(mdio_t), .mdio_i(mdio_i), .mdio_o(mdio_o), .mdio_opcode(mdio_opcode),
|
93 |
|
|
.mdio_in_valid(mdio_in_valid), .mdio_data_in(mdio_data_in), .mdio_out_valid(mdio_out_valid), .mdio_data_out(mdio_data_out), .mgmt_config(mgmt_config));
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
endmodule
|