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

Subversion Repositories srdydrdy_lib

[/] [srdydrdy_lib/] [trunk/] [external/] [ethernet_tri_mode/] [MAC_tx/] [Ramdon_gen.v] - Blame information for rev 23

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 23 ghutchis
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Ramdon_gen.v                                                ////
4
////                                                              ////
5
////  This file is part of the Ethernet IP core project           ////
6
////  http://www.opencores.org/projects.cgi/web/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: Ramdon_gen.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:19  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 Ramdon_gen(
54
Reset           ,
55
Clk             ,
56
Init            ,
57
RetryCnt        ,
58
Random_time_meet
59
);
60
input           Reset           ;
61
input           Clk             ;
62
input           Init            ;
63
input   [3:0]   RetryCnt        ;
64
output          Random_time_meet;
65
 
66
//******************************************************************************
67
//internal signals                                                              
68
//******************************************************************************
69
reg [9:0]       Random_sequence ;
70
reg [9:0]       Ramdom          ;
71
reg [9:0]       Ramdom_counter  ;
72
reg [7:0]       Slot_time_counter; //256*2=512bit=1 slot time
73
reg             Random_time_meet;
74
 
75
//******************************************************************************
76
always @ (posedge Clk or posedge Reset)
77
    if (Reset)
78
        Random_sequence     <=0;
79
    else
80
        Random_sequence     <={Random_sequence[8:0],~(Random_sequence[2]^Random_sequence[9])};
81
 
82
always @ (RetryCnt or Random_sequence)
83
    case (RetryCnt)
84
        4'h0    :   Ramdom={9'b0,Random_sequence[0]};
85
        4'h1    :   Ramdom={8'b0,Random_sequence[1:0]};
86
        4'h2    :   Ramdom={7'b0,Random_sequence[2:0]};
87
        4'h3    :   Ramdom={6'b0,Random_sequence[3:0]};
88
        4'h4    :   Ramdom={5'b0,Random_sequence[4:0]};
89
        4'h5    :   Ramdom={4'b0,Random_sequence[5:0]};
90
        4'h6    :   Ramdom={3'b0,Random_sequence[6:0]};
91
        4'h7    :   Ramdom={2'b0,Random_sequence[7:0]};
92
        4'h8    :   Ramdom={1'b0,Random_sequence[8:0]};
93
        4'h9    :   Ramdom={     Random_sequence[9:0]};
94
        default :   Ramdom={     Random_sequence[9:0]};
95
    endcase
96
 
97
always @ (posedge Clk or posedge Reset)
98
    if (Reset)
99
        Slot_time_counter       <=0;
100
    else if(Init)
101
        Slot_time_counter       <=0;
102
    else if(!Random_time_meet)
103
        Slot_time_counter       <=Slot_time_counter+1;
104
 
105
always @ (posedge Clk or posedge Reset)
106
    if (Reset)
107
        Ramdom_counter      <=0;
108
    else if (Init)
109
        Ramdom_counter      <=Ramdom;
110
    else if (Ramdom_counter!=0&&Slot_time_counter==255)
111
        Ramdom_counter      <=Ramdom_counter -1 ;
112
 
113
always @ (posedge Clk or posedge Reset)
114
    if (Reset)
115
        Random_time_meet    <=1;
116
    else if (Init)
117
        Random_time_meet    <=0;
118
    else if (Ramdom_counter==0)
119
        Random_time_meet    <=1;
120
 
121
endmodule
122
 
123
 

powered by: WebSVN 2.1.0

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