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

Subversion Repositories pcie_vera_tb

[/] [pcie_vera_tb/] [trunk/] [ti_phy_top.v] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 cmagleby
// ===========================================================================
2
// File    : ti_phy_top.v
3
// Author  : cmagleby
4
// Date    : Mon Dec 3 11:03:46 MST 2007
5
// Project : TI PHY design
6
//
7
// Copyright (c) notice
8
// This code adheres to the GNU public license
9
// Please contact www.gutzlogic.com for details.
10
// cmagleby@gutzlogic.com; cwinward@gutzlogic.com
11
//
12
// ===========================================================================
13
//
14 7 cmagleby
// $Id: ti_phy_top.v,v 1.2 2008-01-15 03:25:07 cmagleby Exp $
15 2 cmagleby
//
16
// ===========================================================================
17
//
18
// $Log: not supported by cvs2svn $
19 7 cmagleby
// Revision 1.1.1.1  2007/12/05 18:37:06  cmagleby
20
// importing tb files
21 2 cmagleby
//
22 7 cmagleby
//
23 2 cmagleby
// ===========================================================================
24
// Function : This file is non-synthesizable rtl file to demonstrate TS1's.
25
// Insert your own RTL design here.  It has dummy signals for a sram if that
26
// can be ignored.
27
// ===========================================================================
28
// ===========================================================================
29
 
30
module ti_phy_top (/*AUTOARG*/
31
   // Outputs
32
   LED, txclk, txdata16, txdatak16, txidle16, rxdet_loopb, txcomp,
33
   rxpol, phy_reset_n, pwrdwn, sram_addr, sram_adscn, sram_adspn,
34
   sram_advn, sram_ben, sram_ce, sram_clk, sram_gwn, sram_mode,
35
   sram_oen, sram_wen, sram_zz,
36
   // Inouts
37
   sram_data,
38
   // Inputs
39 7 cmagleby
   clk_50mhz, PUSH_BUTTON, FPGA_RESET_n, PERST_n, rxclk, rxdata16,
40
   rxdatak16, rxvalid16, rxidle16, rxidle, rxstatus, phystatus
41 2 cmagleby
   );
42
   //****************************************************************************************
43
   //TI PHY interface
44
   //****************************************************************************************
45
   //debug ports
46
   input          clk_50mhz;
47
   input [1:0]     PUSH_BUTTON;
48
   output [7:0]   LED;
49
   reg [7:0]       LED;
50
   input          FPGA_RESET_n;
51 7 cmagleby
   input          PERST_n;
52 2 cmagleby
   //****************************************************************************************
53
   //Phillips PHY interface
54
   output         txclk;                //source synch 250 Mhz transmit clock from MAC.
55
   wire           txclk;
56
 
57
   output [15:0]  txdata16;
58
   reg [15:0]      txdata16;
59
   output [1:0]   txdatak16;
60
   reg [1:0]       txdatak16;
61
   output         txidle16;     //forces tx output to electrical idle.  txidle should be asserted while in power states p0 and p1.
62
   reg            txidle16;
63
   input          rxclk;                //source synch 250 clk for received data.
64
   input [15:0]   rxdata16;
65
   input [1:0]     rxdatak16;
66
   input          rxvalid16;
67
   output         rxdet_loopb;  //used to tell the phy to begin
68
   reg            rxdet_loopb;
69
   input          rxidle16;
70
   input          rxidle;       //indicates receiver detection of an electrical idle;  This is a synchronous signal.
71
   input [2:0]     rxstatus;     //encodes receiver status and error codes.
72
 
73
   input          phystatus;    //used to communicate completion of several phy functions.
74
   output         txcomp;       //used when transmitting the compliance pattern; high-level sets the running disparity to negative.
75
   reg            txcomp;
76
   output         rxpol;                //signals the phy to perform a polarity inversion on the receive data; low = no polarity inversion; high = polarity inversion.
77
   reg            rxpol;
78
   output         phy_reset_n;  //phy reset active low
79
   reg            phy_reset_n;
80
   output [1:0]   pwrdwn;
81
   reg [1:0]       pwrdwn;
82
 
83
   //****************************************************************************************
84
   //SRAM Interface
85
   output [16:0]  sram_addr;
86
   reg [16:0]      sram_addr;
87
   output         sram_adscn;
88
   reg            sram_adscn;
89
   output         sram_adspn;
90
   reg            sram_adspn;
91
   output         sram_advn;
92
   reg            sram_advn;
93
   output [3:0]   sram_ben;
94
   reg [3:0]       sram_ben;
95
   output [2:0]   sram_ce;
96
   reg [2:0]       sram_ce;
97
   output         sram_clk;
98
   reg            sram_clk;
99
   output         sram_gwn;
100
   reg            sram_gwn;
101
   output         sram_mode;
102
   reg            sram_mode;
103
   output         sram_oen;
104
   reg            sram_oen;
105
   output         sram_wen;
106
   reg            sram_wen;
107
   output         sram_zz;
108
   reg            sram_zz;
109
   inout [35:0]   sram_data;
110
 
111
 
112
   assign         txclk = rxclk;
113
   reg            continue;
114
 
115
   initial begin
116
      LED            <= 'b0;
117
      txdata16       <= 15'b0;
118
      txdatak16      <= 2'b0;
119
      txidle16       <= 1'b0;
120
      pwrdwn         <= 2'b0;
121
      phy_reset_n    <= 1'b0;
122
      rxpol          <= 1'b0;
123
      txcomp         <= 1'b0;
124
      rxdet_loopb    <= 1'b0;
125
      phy_reset_n    <= 1'b0;
126
      //ignore these signals
127
      sram_addr      <= 'b0;
128
      sram_adscn     <= 'b0;
129
      sram_adspn     <= 'b0;
130
      sram_advn      <= 'b0;
131
      sram_ben       <= 'b0;
132
      sram_ce        <= 'b0;
133
      sram_clk       <= 'b0;
134
      sram_gwn       <= 'b0;
135
      sram_mode      <= 'b0;
136
      sram_oen       <= 'b0;
137
      sram_wen       <= 'b0;
138
      sram_zz        <= 'b0;
139
      //sram_data      <= 'b0;
140
      continue       <= 1'b1;
141
      #100;
142
      phy_reset_n             <= 1'b1;
143
      sample_ts1();
144
   end
145
 
146
   task sample_ts1;
147
      begin
148
         pwrdwn <=  2'b10;
149
         @ (negedge rxclk);
150
         wait (phystatus == 0); //indicate that the pll is locked.
151
         repeat (20) @ (negedge rxclk);
152
         rxdet_loopb <=  1'b1;
153
         wait (phystatus == 1'b1 && rxstatus == 3'b11); //receiver detect
154
         repeat (5) @ (negedge rxclk);
155
         rxdet_loopb <=  1'b0;
156
         repeat (2) @ (negedge rxclk);
157
         pwrdwn <= 2'b0;
158
         wait (phystatus == 1'b0);
159
         wait (phystatus == 1'b1 && rxstatus == 4'b100); //power change accept
160
         repeat (100) @ (negedge rxclk);
161
 
162
         while (continue == 1) begin
163
            //start sending ts1;         
164
            @ (negedge rxclk);
165
            txdatak16 <= 2'b11;
166
            txdata16  <= 16'hf7bc; //PAD LINK,COM
167
            @ (negedge rxclk);
168
            txdatak16 <= 2'b01;
169
            txdata16  <= 16'hf0f7; //NFST,PAD LANE       
170
            @ (negedge rxclk);
171
            txdatak16 <= 2'b0;
172
            txdata16  <= 16'h02;  //training control Rate ID
173
            @ (negedge rxclk);
174
            txdatak16 <= 2'b0;
175
            txdata16  <= 16'h4a4a; //ts id
176
            @ (negedge rxclk);
177
            txdatak16 <= 2'b0;
178
            txdata16  <= 16'h4a4a; //ts id
179
            @ (negedge rxclk);
180
            txdatak16 <= 2'b0;
181
            txdata16  <= 16'h4a4a; //ts id
182
            @ (negedge rxclk);
183
            txdatak16 <= 2'b0;
184
            txdata16  <= 16'h4a4a; //ts id
185
            @ (negedge rxclk);
186
            txdatak16 <= 2'b0;
187
            txdata16  <= 16'h4a4a; //ts id
188
            //add sending ts2;
189
            //add link and lane
190
         end // while (continue == 1)
191
      end
192
   endtask // sample_ts1
193
 
194
 
195
 
196
 
197
 
198
 
199
endmodule
200
 
201
 
202
// Local Variables:
203
// verilog-library-directories:("." "./dcm" "./ddr_div2" "./single_dcm" "./dll" "./tl")
204
// End:

powered by: WebSVN 2.1.0

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