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

Subversion Repositories srdydrdy_lib

[/] [srdydrdy_lib/] [trunk/] [external/] [ethernet_tri_mode/] [MAC_rx/] [MAC_rx_add_chk.v] - Blame information for rev 23

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 23 ghutchis
//////////////////////////////////////////////////////////////////////
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: MAC_rx_add_chk.v,v $
42
// Revision 1.3  2006/01/19 14:07:54  maverickist
43
// verification is complete.
44
//
45
// Revision 1.2  2005/12/16 06:44:17  Administrator
46
// replaced tab with space.
47
// passed 9.6k length frame test.
48
//
49
// Revision 1.1.1.1  2005/12/13 01:51:45  Administrator
50
// no message
51
//                                           
52
 
53
module MAC_rx_add_chk (
54
Reset               ,
55
Clk                 ,
56
Init                ,
57
data                ,
58
MAC_add_en          ,
59
MAC_rx_add_chk_err  ,
60
//From CPU                                         
61
MAC_rx_add_chk_en   ,
62
MAC_add_prom_data   ,
63
MAC_add_prom_add    ,
64
MAC_add_prom_wr
65
 
66
);
67
input           Reset               ;
68
input           Clk                 ;
69
input           Init                ;
70
input   [7:0]   data                ;
71
input           MAC_add_en          ;
72
output          MAC_rx_add_chk_err  ;
73
                //From CPU
74
input           MAC_rx_add_chk_en   ;
75
input   [7:0]   MAC_add_prom_data   ;
76
input   [2:0]   MAC_add_prom_add    ;
77
input           MAC_add_prom_wr     ;
78
 
79
//******************************************************************************   
80
//internal signals                                                              
81
//******************************************************************************
82
reg [2:0]   addr_rd;
83
wire[2:0]   addr_wr;
84
wire[7:0]   din;
85
wire[7:0]   dout;
86
wire        wr_en;
87
 
88
reg         MAC_rx_add_chk_err;
89
reg         MAC_add_prom_wr_dl1;
90
reg         MAC_add_prom_wr_dl2;
91
reg [7:0]   data_dl1                ;
92
reg         MAC_add_en_dl1          ;
93
//******************************************************************************   
94
//write data from cpu to prom                                                              
95
//******************************************************************************
96
always @ (posedge Clk or posedge Reset)
97
    if (Reset)
98
        begin
99
        data_dl1            <=0;
100
        MAC_add_en_dl1      <=0;
101
        end
102
    else
103
        begin
104
        data_dl1            <=data;
105
        MAC_add_en_dl1      <=MAC_add_en;
106
        end
107
 
108
always @ (posedge Clk or posedge Reset)
109
    if (Reset)
110
        begin
111
        MAC_add_prom_wr_dl1     <=0;
112
        MAC_add_prom_wr_dl2     <=0;
113
        end
114
    else
115
        begin
116
        MAC_add_prom_wr_dl1     <=MAC_add_prom_wr;
117
        MAC_add_prom_wr_dl2     <=MAC_add_prom_wr_dl1;
118
        end
119
 
120
assign wr_en      =MAC_add_prom_wr_dl1&!MAC_add_prom_wr_dl2;
121
assign addr_wr    =MAC_add_prom_add;
122
assign din        =MAC_add_prom_data;
123
 
124
//******************************************************************************   
125
//mac add verify                                                             
126
//******************************************************************************
127
always @ (posedge Clk or posedge Reset)
128
    if (Reset)
129
        addr_rd       <=0;
130
    else if (Init)
131
        addr_rd       <=0;
132
    else if (MAC_add_en)
133
        addr_rd       <=addr_rd + 1;
134
 
135
always @ (posedge Clk or posedge Reset)
136
    if (Reset)
137
        MAC_rx_add_chk_err  <=0;
138
    else if (Init)
139
        MAC_rx_add_chk_err  <=0;
140
    else if (MAC_rx_add_chk_en&&MAC_add_en_dl1&&dout!=data_dl1)
141
        MAC_rx_add_chk_err  <=1;
142
 
143
 
144
//******************************************************************************   
145
//a port for read ,b port for write .
146
//******************************************************************************     
147
duram #(8,3,"M512","DUAL_PORT") U_duram(
148
.data_a         (din       ),
149
.wren_a         (wr_en        ),
150
.address_a      (addr_wr      ),
151
.address_b      (addr_rd      ),
152
.clock_a        (Clk        ),
153
.clock_b        (Clk        ),
154
.q_b            (dout      ));
155
 
156
endmodule

powered by: WebSVN 2.1.0

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