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.test_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.test_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 7 cmagleby
// $Id: ti_phy_top.test_top.v,v 1.3 2008-01-15 03:25:07 cmagleby Exp $
14 2 cmagleby
//
15
// ===========================================================================
16
//
17
// $Log: not supported by cvs2svn $
18 7 cmagleby
// Revision 1.2  2007/12/05 23:00:33  cmagleby
19
// add sram for real rtl
20
//
21 4 cmagleby
// Revision 1.1.1.1  2007/12/05 18:37:07  cmagleby
22
// importing tb files
23 2 cmagleby
//
24 4 cmagleby
//
25 2 cmagleby
// ===========================================================================
26
// Function : This is the top level testbench file.
27
//
28
// ===========================================================================
29
// ===========================================================================
30 7 cmagleby
`timescale 1 ns/100 ps
31 2 cmagleby
module ti_phy_top_test_top;
32 4 cmagleby
   parameter simulation_cycle = 8;
33 2 cmagleby
 
34
   reg       SystemClock;
35
   wire      clk_50mhz;
36
   wire [1:0] PUSH_BUTTON;
37
   wire       FPGA_RESET_n;
38 7 cmagleby
   wire       PERST_n;
39 2 cmagleby
   wire       rxclk;
40
   wire [15:0] rxdata16;
41
   wire [1:0]  rxdatak16;
42
   wire        rxvalid16;
43
   wire        rxidle16;
44
   wire [2:0]  rxstatus;
45
   wire        phystatus;
46
   wire [7:0]  LED;
47
   wire        txclk;
48
   wire [15:0] txdata16;
49
   wire [1:0]  txdatak16;
50
   wire        txidle16;
51
   wire        rxdet_loopb;
52
   wire        txcomp;
53
   wire        rxpol;
54
   wire        phy_reset_n;
55
   wire [1:0]  pwrdwn;
56
   wire [16:0] sram_addr;
57
   wire        sram_adscn;
58
   wire        sram_adspn;
59
   wire        sram_advn;
60
   wire [3:0]  sram_ben;
61
   wire [2:0]  sram_ce;
62
   wire        sram_clk;
63
   wire        sram_gwn;
64
   wire        sram_mode;
65
   wire        sram_oen;
66
   wire        sram_wen;
67
   wire        sram_zz;
68
   wire [35:0] sram_data;
69
   assign      rxclk = SystemClock;
70 7 cmagleby
   assign      PERST_n = FPGA_RESET_n;
71 2 cmagleby
 
72
`ifdef SYNOPSYS_NTB
73
               ti_phy_top_test vshell(
74
                                      .SystemClock (SystemClock),
75
                                      .\ti_phy_top.clk_50mhz    (clk_50mhz),
76
                                      .\ti_phy_top.PUSH_BUTTON  (PUSH_BUTTON),
77
                                      .\ti_phy_top.FPGA_RESET_n (FPGA_RESET_n),
78 7 cmagleby
                                      .\ti_phy_top.PERST_n      (PERST_n),
79 2 cmagleby
                                      .\ti_phy_top.rxclk        (rxclk),
80
                                      .\ti_phy_top.rxdata16     (rxdata16),
81
                                      .\ti_phy_top.rxdatak16    (rxdatak16),
82
                                      .\ti_phy_top.rxvalid16    (rxvalid16),
83
                                      .\ti_phy_top.rxidle16     (rxidle16),
84
                                      .\ti_phy_top.rxstatus     (rxstatus),
85
                                      .\ti_phy_top.phystatus    (phystatus),
86
                                      .\ti_phy_top.sram_data    (sram_data),
87
                                      .\ti_phy_top.LED  (LED),
88
                                      .\ti_phy_top.txclk        (txclk),
89
                                      .\ti_phy_top.txdata16     (txdata16),
90
                                      .\ti_phy_top.txdatak16    (txdatak16),
91
                                      .\ti_phy_top.txidle16     (txidle16),
92
                                      .\ti_phy_top.rxdet_loopb  (rxdet_loopb),
93
                                      .\ti_phy_top.txcomp       (txcomp),
94
                                      .\ti_phy_top.rxpol        (rxpol),
95
                                      .\ti_phy_top.phy_reset_n  (phy_reset_n),
96
                                      .\ti_phy_top.pwrdwn       (pwrdwn),
97
                                      .\ti_phy_top.sram_addr    (sram_addr),
98
                                      .\ti_phy_top.sram_adscn   (sram_adscn),
99
                                      .\ti_phy_top.sram_adspn   (sram_adspn),
100
                                      .\ti_phy_top.sram_advn    (sram_advn),
101
                                      .\ti_phy_top.sram_ben     (sram_ben),
102
                                      .\ti_phy_top.sram_ce      (sram_ce),
103
                                      .\ti_phy_top.sram_clk     (sram_clk),
104
                                      .\ti_phy_top.sram_gwn     (sram_gwn),
105
                                      .\ti_phy_top.sram_mode    (sram_mode),
106
                                      .\ti_phy_top.sram_oen     (sram_oen),
107
                                      .\ti_phy_top.sram_wen     (sram_wen),
108
                                      .\ti_phy_top.sram_zz      (sram_zz)
109
                                      );
110
`else
111
 
112
   vera_shell vshell(
113
                     .SystemClock (SystemClock),
114
                     .ti_phy_top_clk_50mhz      (clk_50mhz),
115
                     .ti_phy_top_PUSH_BUTTON    (PUSH_BUTTON),
116 7 cmagleby
                     .ti_phy_top_FPGA_RESET_n   (FPGA_RESET_),
117 2 cmagleby
                     .ti_phy_top_rxclk  (rxclk),
118
                     .ti_phy_top_rxdata16       (rxdata16),
119
                     .ti_phy_top_rxdatak16      (rxdatak16),
120
                     .ti_phy_top_rxvalid16      (rxvalid16),
121
                     .ti_phy_top_rxidle16       (rxidle16),
122
                     .ti_phy_top_rxstatus       (rxstatus),
123
                     .ti_phy_top_phystatus      (phystatus),
124
                     .ti_phy_top_sram_data      (sram_data),
125
                     .ti_phy_top_LED    (LED),
126
                     .ti_phy_top_txclk  (txclk),
127
                     .ti_phy_top_txdata16       (txdata16),
128
                     .ti_phy_top_txdatak16      (txdatak16),
129
                     .ti_phy_top_txidle16       (txidle16),
130
                     .ti_phy_top_rxdet_loopb    (rxdet_loopb),
131
                     .ti_phy_top_txcomp (txcomp),
132
                     .ti_phy_top_rxpol  (rxpol),
133
                     .ti_phy_top_phy_reset_n    (phy_reset_n),
134
                     .ti_phy_top_pwrdwn (pwrdwn),
135
                     .ti_phy_top_sram_addr      (sram_addr),
136
                     .ti_phy_top_sram_adscn     (sram_adscn),
137
                     .ti_phy_top_sram_adspn     (sram_adspn),
138
                     .ti_phy_top_sram_advn      (sram_advn),
139
                     .ti_phy_top_sram_ben       (sram_ben),
140
                     .ti_phy_top_sram_ce        (sram_ce),
141
                     .ti_phy_top_sram_clk       (sram_clk),
142
                     .ti_phy_top_sram_gwn       (sram_gwn),
143
                     .ti_phy_top_sram_mode      (sram_mode),
144
                     .ti_phy_top_sram_oen       (sram_oen),
145
                     .ti_phy_top_sram_wen       (sram_wen),
146
                     .ti_phy_top_sram_zz        (sram_zz)
147
                     );
148
`endif
149
 
150
 
151
 
152
`ifdef emu
153
   /* DUT is in emulator, so not instantiated here */
154
`else
155
   ti_phy_top dut(
156
                  .clk_50mhz    (clk_50mhz),
157
                  .PUSH_BUTTON  (PUSH_BUTTON),
158
                  .FPGA_RESET_n (FPGA_RESET_n),
159 7 cmagleby
                  .PERST_n      (PERST_n),
160 2 cmagleby
                  .rxclk        (rxclk),
161
                  .rxdata16     (rxdata16),
162
                  .rxdatak16    (rxdatak16),
163
                  .rxvalid16    (rxvalid16),
164
                  .rxidle16     (rxidle16),
165
                  .rxstatus     (rxstatus),
166
                  .phystatus    (phystatus),
167
                  .sram_data    (sram_data),
168
                  .LED  (LED),
169
                  .txclk        (txclk),
170
                  .txdata16     (txdata16),
171
                  .txdatak16    (txdatak16),
172
                  .txidle16     (txidle16),
173
                  .rxdet_loopb  (rxdet_loopb),
174
                  .txcomp       (txcomp),
175
                  .rxpol        (rxpol),
176
                  .phy_reset_n  (phy_reset_n),
177
                  .pwrdwn       (pwrdwn),
178
                  .sram_addr    (sram_addr),
179
                  .sram_adscn   (sram_adscn),
180
                  .sram_adspn   (sram_adspn),
181
                  .sram_advn    (sram_advn),
182
                  .sram_ben     (sram_ben),
183
                  .sram_ce      (sram_ce),
184
                  .sram_clk     (sram_clk),
185
                  .sram_gwn     (sram_gwn),
186
                  .sram_mode    (sram_mode),
187
                  .sram_oen     (sram_oen),
188
                  .sram_wen     (sram_wen),
189
                  .sram_zz      (sram_zz)
190
                  );
191
`endif
192
 
193
   always @ (posedge SystemClock) begin
194
      if (|rxdatak16)
195
        $display($time,":datak symbol");
196
   end
197
 
198
   reg set_once;
199
   //simulation short ts1 sets
200
`ifdef REAL_RTL
201
   always @ (posedge SystemClock) begin
202
      if (dut.phy_layer_top_inst.send_ts1 & ~set_once) begin
203
         force dut.phy_layer_top_inst.tx_alignment_32_inst.ts_1024_count = 10'b1111000000;
204
         set_once <= #1 1'b1;
205
 
206
      end
207
      else begin
208
         release dut.phy_layer_top_inst.tx_alignment_32_inst.ts_1024_count;
209
         if (dut.phy_layer_top_inst.ltssm_32bit_inst.start_link_training_pm) begin
210
            set_once <= #1 1'b0;
211
         end
212
      end
213
   end // always @ (posedge ti_phy_top_inst.clk_125mhz)
214 4 cmagleby
 
215
   /* -----\/----- EXCLUDED -----\/-----
216
    idt71v25761s200 AUTO_TEMPLATE (
217
                                  .D    (sram_data[31:0]),
218
                                  .DP   (sram_data[35:32]),
219
                                  // Inputs
220
                                  .A    (sram_addr),
221
                                  .oe_  (sram_oen),
222
                                  .ce_  (sram_ce[0]),
223
                                  .cs0  (sram_ce[1]),
224
                                  .cs1_ (sram_ce[2]),
225
                                  .lbo_ (sram_mode),
226
                                  .gw_  (sram_gwn),
227
                                  .bwe_ (sram_wen),
228
                                  .bw4_ (sram_ben[3]),
229
                                  .bw3_ (sram_ben[2]),
230
                                  .bw2_ (sram_ben[1]),
231
                                  .bw1_ (sram_ben[0]),
232
                                  .adsp_(sram_adspn),
233
                                  .adsc_(sram_adscn),
234
                                  .adv_ (sram_advn),
235
                                  .clk  (sram_clk));
236
    -----/\----- EXCLUDED -----/\----- */
237
 
238
   idt71v25761s200 SRAM_MODEL_inst (/*AUTOINST*/
239
                                    // Inouts
240
                                    .D  (sram_data[31:0]),        // Templated
241
                                    .DP (sram_data[35:32]),      // Templated
242
                                    // Inputs
243
                                    .A  (sram_addr),             // Templated
244
                                    .oe_        (sram_oen),              // Templated
245
                                    .ce_        (sram_ce[0]),             // Templated
246
                                    .cs0        (sram_ce[1]),            // Templated
247
                                    .cs1_       (sram_ce[2]),            // Templated
248
                                    .lbo_       (sram_mode),             // Templated
249
                                    .gw_        (sram_gwn),              // Templated
250
                                    .bwe_       (sram_wen),              // Templated
251
                                    .bw4_       (sram_ben[3]),           // Templated
252
                                    .bw3_       (sram_ben[2]),           // Templated
253
                                    .bw2_       (sram_ben[1]),           // Templated
254
                                    .bw1_       (sram_ben[0]),            // Templated
255
                                    .adsp_(sram_adspn),          // Templated
256
                                    .adsc_(sram_adscn),          // Templated
257
                                    .adv_       (sram_advn),             // Templated
258
                                    .clk        (sram_clk));             // Templated
259
 
260 2 cmagleby
`endif
261
 
262
   initial begin
263
      //****************************************************************************************
264
      //force scramble bypass until the tb can scramble and de-scramble data. 
265
      //force dut.phy_layer_top_inst.make_rxdata_path16.scramble16_inst.scram_bypass = 2'b11;
266
      //force dut.phy_layer_top_inst.make_tx_data_path16.scramble16_inst.scram_bypass = 2'b11;
267
      //****************************************************************************************
268
      set_once = 0;
269
      SystemClock = 0;
270
      forever begin
271
         #(simulation_cycle/2)
272
         SystemClock = ~SystemClock;
273
      end
274
 
275 4 cmagleby
   end // initial begin
276 2 cmagleby
 
277 4 cmagleby
`ifdef REAL_RTL
278 2 cmagleby
   initial begin
279
      $fsdbDumpfile("vera_test.fsdb");
280
      $fsdbDumpvars(dut);
281
   end
282 4 cmagleby
`endif
283 2 cmagleby
 
284
 
285
endmodule

powered by: WebSVN 2.1.0

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