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

Subversion Repositories ethmac

[/] [ethmac/] [tags/] [rel_7/] [rtl/] [verilog/] [eth_outputcontrol.v] - Blame information for rev 15

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 15 mohor
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  eth_outputcontrol.v                                         ////
4
////                                                              ////
5
////  This file is part of the Ethernet IP core project           ////
6
////  http://www.opencores.org/cores/ethmac/                      ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - Igor Mohor (igorM@opencores.org)                      ////
10
////                                                              ////
11
////  All additional information is avaliable in the Readme.txt   ////
12
////  file.                                                       ////
13
////                                                              ////
14
//////////////////////////////////////////////////////////////////////
15
////                                                              ////
16
//// Copyright (C) 2001 Authors                                   ////
17
////                                                              ////
18
//// This source file may be used and distributed without         ////
19
//// restriction provided that this copyright statement is not    ////
20
//// removed from the file and that any derivative work contains  ////
21
//// the original copyright notice and the associated disclaimer. ////
22
////                                                              ////
23
//// This source file is free software; you can redistribute it   ////
24
//// and/or modify it under the terms of the GNU Lesser General   ////
25
//// Public License as published by the Free Software Foundation; ////
26
//// either version 2.1 of the License, or (at your option) any   ////
27
//// later version.                                               ////
28
////                                                              ////
29
//// This source is distributed in the hope that it will be       ////
30
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
31
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
32
//// PURPOSE.  See the GNU Lesser General Public License for more ////
33
//// details.                                                     ////
34
////                                                              ////
35
//// You should have received a copy of the GNU Lesser General    ////
36
//// Public License along with this source; if not, download it   ////
37
//// from http://www.opencores.org/lgpl.shtml                     ////
38
////                                                              ////
39
//////////////////////////////////////////////////////////////////////
40
//
41
// CVS Revision History
42
//
43
// $Log: not supported by cvs2svn $
44
// Revision 1.1  2001/07/30 21:23:42  mohor
45
// Directory structure changed. Files checked and joind together.
46
//
47
// Revision 1.3  2001/06/01 22:28:56  mohor
48
// This files (MIIM) are fully working. They were thoroughly tested. The testbench is not updated.
49
//
50
//
51
 
52
`include "eth_timescale.v"
53
 
54
module eth_outputcontrol(Clk, Reset, InProgress, ShiftedBit, BitCounter, WriteOp, NoPre, MdcEn_n, Mdo, MdoEn);
55
 
56
parameter Tp = 1;
57
 
58
input         Clk;                // Host Clock
59
input         Reset;              // General Reset
60
input         WriteOp;            // Write Operation Latch (When asserted, write operation is in progress)
61
input         NoPre;              // No Preamble (no 32-bit preamble)
62
input         InProgress;         // Operation in progress
63
input         ShiftedBit;         // This bit is output of the shift register and is connected to the Mdo signal
64
input   [6:0] BitCounter;         // Bit Counter
65
input         MdcEn_n;            // MII Management Data Clock Enable signal is asserted for one Clk period before Mdc falls.
66
 
67
output        Mdo;                // MII Management Data Output
68
output        MdoEn;              // MII Management Data Output Enable
69
 
70
wire          SerialEn;
71
 
72
reg           MdoEn_2d;
73
reg           MdoEn_d;
74
reg           MdoEn;
75
 
76
reg           Mdo_2d;
77
reg           Mdo_d;
78
reg           Mdo;                // MII Management Data Output
79
 
80
 
81
 
82
// Generation of the Serial Enable signal (enables the serialization of the data)
83
assign SerialEn =  WriteOp & InProgress & ( BitCounter>31 | ( ( BitCounter == 0 ) & NoPre ) )
84
                | ~WriteOp & InProgress & (( BitCounter>31 & BitCounter<46 ) | ( ( BitCounter == 0 ) & NoPre )); // igor !!!  ali je tu res <46. To je veljalo, ko sem imel se >31 in napako 32 preamble bitov
85
 
86
 
87
// Generation of the MdoEn signal
88
always @ (posedge Clk or posedge Reset)
89
begin
90
  if(Reset)
91
    begin
92
      MdoEn_2d <= #Tp 1'b0;
93
      MdoEn_d <= #Tp 1'b0;
94
      MdoEn <= #Tp 1'b0;
95
    end
96
  else
97
    begin
98
      if(MdcEn_n)
99
        begin
100
          MdoEn_2d <= #Tp SerialEn | InProgress & BitCounter<32;
101
          MdoEn_d <= #Tp MdoEn_2d;
102
          MdoEn <= #Tp MdoEn_d;
103
        end
104
    end
105
end
106
 
107
 
108
// Generation of the Mdo signal.
109
always @ (posedge Clk or posedge Reset)
110
begin
111
  if(Reset)
112
    begin
113
      Mdo_2d <= #Tp 1'b0;
114
      Mdo_d <= #Tp 1'b0;
115
      Mdo <= #Tp 1'b0;
116
    end
117
  else
118
    begin
119
      if(MdcEn_n)
120
        begin
121
          Mdo_2d <= #Tp ~SerialEn & BitCounter<32;
122
          Mdo_d <= #Tp ShiftedBit | Mdo_2d;
123
          Mdo <= #Tp Mdo_d;
124
        end
125
    end
126
end
127
 
128
 
129
 
130
endmodule

powered by: WebSVN 2.1.0

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