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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [rtl/] [verilog/] [smii/] [smii.v] - Blame information for rev 408

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 408 julius
/*
2
 * SMII <-> MII interface
3
 *
4
 * Julius Baxter, julius.baxter@orsoc.se
5
 *
6
 */
7
//////////////////////////////////////////////////////////////////////
8
////                                                              ////
9
//// Copyright (C) 2009, 2010 Authors and OPENCORES.ORG           ////
10
////                                                              ////
11
//// This source file may be used and distributed without         ////
12
//// restriction provided that this copyright statement is not    ////
13
//// removed from the file and that any derivative work contains  ////
14
//// the original copyright notice and the associated disclaimer. ////
15
////                                                              ////
16
//// This source file is free software; you can redistribute it   ////
17
//// and/or modify it under the terms of the GNU Lesser General   ////
18
//// Public License as published by the Free Software Foundation; ////
19
//// either version 2.1 of the License, or (at your option) any   ////
20
//// later version.                                               ////
21
////                                                              ////
22
//// This source is distributed in the hope that it will be       ////
23
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
24
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
25
//// PURPOSE.  See the GNU Lesser General Public License for more ////
26
//// details.                                                     ////
27
////                                                              ////
28
//// You should have received a copy of the GNU Lesser General    ////
29
//// Public License along with this source; if not, download it   ////
30
//// from http://www.opencores.org/lgpl.shtml                     ////
31
////                                                              ////
32
//////////////////////////////////////////////////////////////////////
33
 
34
module smii
35
  (
36
   eth_clk,
37
   eth_rst,
38
   eth_sync_pad_o,
39
   eth_tx_pad_o,
40
   eth_rx_pad_i,
41
   mtxd,
42
   mtxen,
43
   mtxerr,
44
   mtx_clk,
45
   mrxd,
46
   mrxdv,
47
   mrxerr,
48
   mrx_clk,
49
   mcoll,
50
   mcrs,
51
   speed,
52
   duplex,
53
   link
54
   );
55
 
56
   input eth_clk;
57
   input eth_rst; // active high reset synchronous to ethernet clock
58
 
59
   // SMII
60
   output reg eth_sync_pad_o /*synthesis syn_useioff=1 syn_allow_retiming=0 syn_noprune=1*/;
61
   output reg eth_tx_pad_o /*synthesis syn_useioff=1 syn_allow_retiming=0 */;
62
   input      eth_rx_pad_i;
63
 
64
 
65
   // MII
66
   // TX
67
   input [3:0] mtxd;
68
   input       mtxen;
69
   input       mtxerr;
70
   output      mtx_clk;
71
   // RX
72
   output [3:0] mrxd;
73
   output       mrxdv;
74
   output       mrxerr;
75
   output       mrx_clk;
76
   output       mcoll;
77
   output       mcrs;
78
   output       speed;
79
   output       duplex;
80
   output       link;
81
 
82
 
83
   // Wires from pads
84
   wire         smii_tx;
85
   reg          smii_rx /*synthesis syn_useioff=1 syn_allow_retiming=0 */;
86
 
87
 
88
   // Sync generation
89
   wire [10:1]  tx_smii_state;
90
   wire [10:1]  next_tx_smii_state;
91
   wire [10:1]  rx_smii_state;
92
   wire         smii_sync;
93
   smii_sync smii_sync0
94
     (
95
      .sync(smii_sync),
96
      .tx_state(tx_smii_state),
97
      .next_tx_state(next_tx_smii_state),
98
      .rx_state(rx_smii_state),
99
      .clk(eth_clk),
100
      .rst(eth_rst)
101
      );
102
 
103
   // IOB regs for SMII
104
   always @(posedge eth_clk) eth_sync_pad_o <= smii_sync;
105
   always @(posedge eth_clk) eth_tx_pad_o <= smii_tx;
106
   always @(posedge eth_clk) smii_rx <= eth_rx_pad_i;
107
 
108
 
109
   smii_if smii_if0
110
     (
111
      // SMII signals
112
      .tx                               (smii_tx),
113
      .rx                               (smii_rx),
114
      .tx_smii_state                    (tx_smii_state[10:1]),
115
      .next_tx_smii_state               (next_tx_smii_state[10:1]),
116
      .rx_smii_state                    (rx_smii_state[10:1]),
117
      // MAC MII receive
118
      .mrxd                             (mrxd[3:0]),
119
      .mrxdv                            (mrxdv),
120
      .mrxerr                           (mrxerr),
121
      .mrx_clk                          (mrx_clk),
122
      // MAC MII transmit
123
      .mtx_clk                          (mtx_clk),
124
      .mtxd                             (mtxd[3:0]),
125
      .mtxen                            (mtxen),
126
      .mtxerr                           (mtxerr),
127
      // Collision
128
      .mcoll                            (mcoll),
129
      // Carrier sense
130
      .mcrs                             (mcrs),
131
      // Speedy ethernet
132
      .speed                            (speed),
133
      // Duplex indicator
134
      .duplex                           (duplex),
135
      // Linke indicator
136
      .link                             (link),
137
      // Clocks, resets
138
      .eth_clk                          (eth_clk),
139
      .eth_rst                          (eth_rst)
140
      );
141
 
142
endmodule // smii

powered by: WebSVN 2.1.0

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