⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eth_random.v

📁 It is a ethernet transmitter module used in emac development.
💻 V
字号:
//////////////////////////////////////////////////////////////////////////                                                              ////////  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] <= #Tp 0;  else    x[9:0] <= #Tp {x[8:0], Feedback};endassign 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 <= #Tp 10'h000;  else    begin      if(StateJam & StateJam_q)        RandomLatched <= #Tp Random;    endend// 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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -