1 //////////////////////////////////////////////////////////////////////
3 //// MAC_rx_add_chk.v ////
5 //// This file is part of the Ethernet IP core project ////
6 //// http://www.opencores.org/projects.cgi/wr_en/ethernet_tri_mode/////
9 //// - Jon Gao (gaojon@yahoo.com) ////
12 //////////////////////////////////////////////////////////////////////
14 //// Copyright (C) 2001 Authors ////
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. ////
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. ////
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 ////
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 ////
37 //////////////////////////////////////////////////////////////////////
39 // CVS Revision History
41 // $Log: MAC_rx_add_chk.v,v $
42 // Revision 1.3 2006/01/19 14:07:54 maverickist
43 // verification is complete.
45 // Revision 1.2 2005/12/16 06:44:17 Administrator
46 // replaced tab with space.
47 // passed 9.6k length frame test.
49 // Revision 1.1.1.1 2005/12/13 01:51:45 Administrator
53 module MAC_rx_add_chk (
72 output MAC_rx_add_chk_err ;
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 ;
79 //******************************************************************************
81 //******************************************************************************
88 reg MAC_rx_add_chk_err;
89 reg MAC_add_prom_wr_dl1;
90 reg MAC_add_prom_wr_dl2;
93 //******************************************************************************
94 //write data from cpu to prom
95 //******************************************************************************
96 always @ (posedge Clk or posedge Reset)
105 MAC_add_en_dl1 <=MAC_add_en;
108 always @ (posedge Clk or posedge Reset)
111 MAC_add_prom_wr_dl1 <=0;
112 MAC_add_prom_wr_dl2 <=0;
116 MAC_add_prom_wr_dl1 <=MAC_add_prom_wr;
117 MAC_add_prom_wr_dl2 <=MAC_add_prom_wr_dl1;
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;
124 //******************************************************************************
126 //******************************************************************************
127 always @ (posedge Clk or posedge Reset)
133 addr_rd <=addr_rd + 1;
135 always @ (posedge Clk or posedge Reset)
137 MAC_rx_add_chk_err <=0;
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;
144 //******************************************************************************
145 //a port for read ,b port for write .
146 //******************************************************************************
147 duram #(8,3,"M512","DUAL_PORT") U_duram(
150 .address_a (addr_wr ),
151 .address_b (addr_rd ),