It is a ethernet transmitter module used in emac development.

源代码在线查看: eth_random.v

软件大小: 9 K
上传用户: wanghaihah
关键词: development transmitter ethernet module
下载地址: 免注册下载 普通下载 VIP

相关代码

				//////////////////////////////////////////////////////////////////////				////                                                              ////				////  eth_random.v                                                ////				////                                                              ////				////  This file is part of the Ethernet IP core project           ////				////  http://www.opencores.org/projects/ethmac/                   ////				////                                                              ////				////  Author(s):                                                  ////				////      - Igor Mohor (igorM@opencores.org)                      ////				////      - Novan Hartadi (novan@vlsi.itb.ac.id)                  ////				////      - Mahmud Galela (mgalela@vlsi.itb.ac.id)                ////				////                                                              ////				////  All additional information is avaliable in the Readme.txt   ////				////  file.                                                       ////				////                                                              ////				//////////////////////////////////////////////////////////////////////				////                                                              ////				//// Copyright (C) 2001 Authors                                   ////				////                                                              ////				//// This source file may be used and distributed without         ////				//// restriction provided that this copyright statement is not    ////				//// removed from the file and that any derivative work contains  ////				//// the original copyright notice and the associated disclaimer. ////				////                                                              ////				//// This source file is free software; you can redistribute it   ////				//// and/or modify it under the terms of the GNU Lesser General   ////				//// Public License as published by the Free Software Foundation; ////				//// either version 2.1 of the License, or (at your option) any   ////				//// later version.                                               ////				////                                                              ////				//// This source is distributed in the hope that it will be       ////								//				// Revision 1.1  2001/06/19 10:27:57  mohor				// TxEthMAC initial release.				//				//				//				//								`include "timescale.v"								module eth_random (MTxClk, Reset, StateJam, StateJam_q, RetryCnt, NibCnt, ByteCnt, 				                   RandomEq0, RandomEqByteCnt);								parameter Tp = 1;								input MTxClk;				input Reset;				input StateJam;				input StateJam_q;				input [3:0] RetryCnt;				input [15:0] NibCnt;				input [9:0] ByteCnt;				output RandomEq0;				output RandomEqByteCnt;								wire Feedback;				reg [9:0] x;				wire [9:0] Random;				reg  [9:0] RandomLatched;												always @ (posedge MTxClk or posedge Reset)				begin				  if(Reset)				    x[9:0] 				  else				    x[9:0] 				end								assign Feedback = ~(x[2] ^ x[9]);								assign Random [0] = x[0];				assign Random [1] = (RetryCnt > 1) ? x[1] : 1'b0;				assign Random [2] = (RetryCnt > 2) ? x[2] : 1'b0;				assign Random [3] = (RetryCnt > 3) ? x[3] : 1'b0;				assign Random [4] = (RetryCnt > 4) ? x[4] : 1'b0;				assign Random [5] = (RetryCnt > 5) ? x[5] : 1'b0;				assign Random [6] = (RetryCnt > 6) ? x[6] : 1'b0;				assign Random [7] = (RetryCnt > 7) ? x[7] : 1'b0;				assign Random [8] = (RetryCnt > 8) ? x[8] : 1'b0;				assign Random [9] = (RetryCnt > 9) ? x[9] : 1'b0;												always @ (posedge MTxClk or posedge Reset)				begin				  if(Reset)				    RandomLatched 				  else				    begin				      if(StateJam & StateJam_q)				        RandomLatched 				    end				end								// Random Number == 0      IEEE 802.3 page 68. If 0 we go to defer and not to backoff.				assign RandomEq0 = RandomLatched == 10'h0; 								assign RandomEqByteCnt = ByteCnt[9:0] == RandomLatched & (&NibCnt[6:0]);								endmodule							

相关资源