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

Subversion Repositories sgmii

[/] [sgmii/] [trunk/] [build/] [OpenCore_MAC/] [MAC_rx_add_chk.v.bak] - Blame information for rev 26

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 jefflieu
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  MAC_rx_add_chk.v                                            ////
4
////                                                              ////
5
////  This file is part of the Ethernet IP core project           ////
6
////  http://www.opencores.org/projects.cgi/wr_en/ethernet_tri_mode/////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - Jon Gao (gaojon@yahoo.com)                            ////
10
////                                                              ////
11
////                                                              ////
12
//////////////////////////////////////////////////////////////////////
13
////                                                              ////
14
//// Copyright (C) 2001 Authors                                   ////
15
////                                                              ////
16
//// This source file may be used and distributed without         ////
17
//// restriction provided that this copyright statement is not    ////
18
//// removed from the file and that any derivative work contains  ////
19
//// the original copyright notice and the associated disclaimer. ////
20
////                                                              ////
21
//// This source file is free software; you can redistribute it   ////
22
//// and/or modify it under the terms of the GNU Lesser General   ////
23
//// Public License as published by the Free Software Foundation; ////
24
//// either version 2.1 of the License, or (at your option) any   ////
25
//// later version.                                               ////
26
////                                                              ////
27
//// This source is distributed in the hope that it will be       ////
28
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
29
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
30
//// PURPOSE.  See the GNU Lesser General Public License for more ////
31
//// details.                                                     ////
32
////                                                              ////
33
//// You should have received a copy of the GNU Lesser General    ////
34
//// Public License along with this source; if not, download it   ////
35
//// from http://www.opencores.org/lgpl.shtml                     ////
36
////                                                              ////
37
//////////////////////////////////////////////////////////////////////
38
//
39
// CVS Revision History
40
//
41
// $Log: not supported by cvs2svn $
42
// Revision 1.2  2005/12/16 06:44:17  Administrator
43
// replaced tab with space.
44
// passed 9.6k length frame test.
45
//
46
// Revision 1.1.1.1  2005/12/13 01:51:45  Administrator
47
// no message
48
//
49
 
50
module MAC_rx_add_chk (
51
Reset               ,
52
Clk                 ,
53
Init                ,
54
data                ,
55
MAC_add_en          ,
56
MAC_rx_add_chk_err  ,
57
//From CPU
58
MAC_rx_add_chk_en   ,
59
MAC_add_prom_data   ,
60
MAC_add_prom_add    ,
61
MAC_add_prom_wr
62
 
63
);
64
input           Reset               ;
65
input           Clk                 ;
66
input           Init                ;
67
input   [7:0]   data                ;
68
input           MAC_add_en          ;
69
output          MAC_rx_add_chk_err  ;
70
                //From CPU
71
input           MAC_rx_add_chk_en   ;
72
input   [7:0]   MAC_add_prom_data   ;
73
input   [2:0]   MAC_add_prom_add    ;
74
input           MAC_add_prom_wr     ;
75
 
76
//******************************************************************************
77
//internal signals
78
//******************************************************************************
79
reg [2:0]   addr_rd;
80
wire[2:0]   addr_wr;
81
wire[7:0]   din;
82
wire[7:0]   dout;
83
wire        wr_en;
84
 
85
reg         MAC_rx_add_chk_err;
86
reg         MAC_add_prom_wr_dl1;
87
reg         MAC_add_prom_wr_dl2;
88
reg [7:0]   data_dl1                ;
89
reg         MAC_add_en_dl1          ;
90
//******************************************************************************
91
//write data from cpu to prom
92
//******************************************************************************
93
always @ (posedge Clk or posedge Reset)
94
    if (Reset)
95
        begin
96
        data_dl1            <=0;
97
        MAC_add_en_dl1      <=0;
98
        end
99
    else
100
        begin
101
        data_dl1            <=data;
102
        MAC_add_en_dl1      <=MAC_add_en;
103
        end
104
 
105
always @ (posedge Clk or posedge Reset)
106
    if (Reset)
107
        begin
108
        MAC_add_prom_wr_dl1     <=0;
109
        MAC_add_prom_wr_dl2     <=0;
110
        end
111
    else
112
        begin
113
        MAC_add_prom_wr_dl1     <=MAC_add_prom_wr;
114
        MAC_add_prom_wr_dl2     <=MAC_add_prom_wr_dl1;
115
        end
116
 
117
assign wr_en      =MAC_add_prom_wr_dl1&!MAC_add_prom_wr_dl2;
118
assign addr_wr    =MAC_add_prom_add;
119
assign din        =MAC_add_prom_data;
120
 
121
//******************************************************************************
122
//mac add verify
123
//******************************************************************************
124
always @ (posedge Clk or posedge Reset)
125
    if (Reset)
126
        addr_rd       <=0;
127
    else if (Init)
128
        addr_rd       <=0;
129
    else if (MAC_add_en)
130
        addr_rd       <=addr_rd + 1;
131
 
132
always @ (posedge Clk or posedge Reset)
133
    if (Reset)
134
        MAC_rx_add_chk_err  <=0;
135
    else if (Init)
136
        MAC_rx_add_chk_err  <=0;
137
    else if (MAC_rx_add_chk_en&&MAC_add_en_dl1&&dout!=data_dl1)
138
        MAC_rx_add_chk_err  <=1;
139
 
140
 
141
//******************************************************************************
142
//a port for read ,b port for write .
143
//******************************************************************************
144
duram #(8,3,"M512","DUAL_PORT") U_duram(
145
.data_a         (din       ),
146
.wren_a         (wr_en        ),
147
.address_a      (addr_wr      ),
148
.address_b      (addr_rd      ),
149
.clock_a        (Clk        ),
150
.clock_b        (Clk        ),
151
.q_b            (dout      ));
152
 
153
endmodule

powered by: WebSVN 2.1.0

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