vusb_bvci_tb.v
15.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
/*******************************************************************************
-- File Type: Verilog HDL
-- Tool Version: VHDL2verilog v4.4 Tue Sep 19 10:06:32 EDT 2000 SunOS 5.5.1
-- Input file was: vusb_bvci_tb
-- Date Created: Tue Jul 16 14:00:48 2002
*******************************************************************************/
`timescale 1 ns / 1 ps // timescale for following modules
// ----------------------------------------------------------------------------
// Copyright 2000 VAutomation Inc. Nashua NH USA. All rights reserved.
// This software is provided under license and contains proprietary
// and confidential material which is the property of VAutomation Inc.
// HTTP://www.vautomation.com
// ----------------------------------------------------------------------------
// File Name: $Workfile: vusb_bvci_tb.vhdl$
// Revision: $Revision: 1.1.1.1 $
// Description:
//
// Description:
// This is the top level file for the standalone VUSB 1.1 test
// bench with a BVCI interface. It instantiates the following
// blocks:
//
// vusb_bvci - top level block of the vusb core with
// BVCI interface
// vusbtst - instantiation of vusb test bench
// pvic_connection_
// interface - provides connection to dll
//
//
//
// -----------------------------------------------------------------------------
// This product is licensed to:
// John Princen of RouteFree
// for use at site(s):
// broadon
// -----------Revision History--------------------------------------------------
// $Log:
// 18 VUSB 1.17 7/5/02 2:00:51 PM Will Sanborn Removed
// hub signals, which were not used.
// 17 VUSB 1.16 6/27/02 2:32:50 PM Will Sanborn Changed
// test bench so two separate clocks are used, one for system and one
// for clk48mhz, before they were both clocked off the 48 MHz clock.
// 16 VUSB 1.15 4/11/02 2:49:08 PM Patrick Koran all
// checked in from pats pc, week of Starteam upgrade 4.6 to 5.1
// 15 VUSB 1.14 2/8/02 11:25:56 AM Tom Frechette Changed
// name of interrupt.
// 14 VUSB 1.13 2/7/02 4:40:55 PM Tom Frechette Added
// sync and async resets to the top level.
// 13 VUSB 1.12 11/7/01 9:05:30 AM Tom Frechette Typos.
// 12 VUSB 1.11 11/7/01 9:00:57 AM Tom Frechette Bring in
// vbus sense to turn off dp_high and dm_high. Change the polarity of
// the dp_low and dm_low.
// 11 VUSB 1.10 7/23/01 2:25:16 PM Tom Frechette Added
// debug port.
// 10 VUSB 1.9 7/12/01 7:24:10 PM Patrick Koran Added
// reset to interface
// 9 VUSB 1.8 7/3/01 4:43:00 PM Tom Frechette Chnaged
// mode to a constant in vusb_cfg.
// 8 VUSB 1.7 6/26/01 11:23:01 AM Tom Frechette Changed
// usb_mode connection.
// 7 VUSB 1.6 6/22/01 9:10:00 AM Tom Frechette Changed
// name of config package
// 6 VUSB 1.5 6/21/01 10:42:07 AM Tom Frechette Added
// comments
// 5 VUSB 1.4 6/15/01 3:28:59 PM Tom Frechette Changed
// Architecture to be like ARC
// 4 VUSB 1.3 5/16/01 3:26:48 PM Tom Frechette Removed
// hc_mode en from top level. It wasn't connected to anything.
// 3 VUSB 1.2 5/15/01 10:42:31 AM Tom Frechette Added
// more interrupts to pvic and changed VUSB bus widths to be BVCI
// compliant
// 2 VUSB 1.1 5/8/01 4:13:52 PM Tom Frechette New host
// control
// 1 VUSB 1.0 5/2/01 4:03:43 PM Tom Frechette
// $
// $NoKeywords$
// -----------------------------------------------------------------------------
// ------------------------------------------------------------------------------
// Copyright 1995 VAutomation Inc. Nashua NH (603)882-2282 ALL RIGHTS RESERVED.
// This software is provided under license and contains proprietary and
// confidential material which is the property of VAutomation Inc.
//
// File: vusb_cfg.vhd USB Configuration file.
//
// Revision: $Revision: 1.1.1.1 $
//
// Description: A Package file for the usb core that defines global usb constants
// that contol how the VUSB core is synthesised.
//
// ---------------------------------------------------------------------------
// This product is licensed to:
// $name$ of $company$
// for use at site(s):
// $site$
// ------------------------------------------------------------------------------
// Revision History
// $Log:
// 32 VUSB 1.31 7/5/02 9:15:50 AM Chris Kolb Moved
// VUSB build configruation Revision constant to vusb_cfg, and updated
// the rev number to 3.0.
// 31 VUSB 1.30 4/11/02 2:49:09 PM Patrick Koran all
// checked in from pats pc, week of Starteam upgrade 4.6 to 5.1
// 30 VUSB 1.29 3/18/02 10:52:11 AM Tom Frechette Changed
// IRQ_NUM default to 0x0.
// 29 VUSB 1.28 3/15/02 2:39:08 PM Tom Frechette Added
// Interupt info into add_info register.
// 28 VUSB 1.27 2/7/02 4:49:00 PM Tom Frechette Removed
// sync config variable.
// 27 VUSB 1.26 8/23/01 9:48:58 AM Tom Frechette
// 26 VUSB 1.25 7/25/01 3:41:35 PM Tom Frechette Changed
// FIFO Parameter Names.
// 25 VUSB 1.24 7/10/01 3:03:41 PM Tom Frechette Moved
// HOST comment for verilog.
// 24 VUSB 1.23 7/6/01 7:44:00 AM Tom Frechette Added
// host comments around host constant to make it look like vusb_sie.
// 23 VUSB 1.22 7/6/01 7:34:33 AM Tom Frechette Added
// device constant comment for ARC.
// 22 VUSB 1.21 7/3/01 4:42:08 PM Tom Frechette Changed
// mode to a constant in vusb_cfg.
// 21 VUSB 1.20 6/22/01 3:09:48 PM Tom Frechette Changed
// endpoint number.
// 20 VUSB 1.19 6/21/01 9:59:56 AM Tom Frechette Changed
// the name and added fifo constants
// 19 VUSB 1.18 6/21/01 9:51:24 AM Tom Frechette
// 18 VUSB 1.17 5/25/01 10:25:08 AM Monika Leary Set
// synchronous reset constant to '1'
// 17 VUSB 1.16 5/17/01 2:52:48 PM Monika Leary Added
// USE_SYNC_RESET constant
// 16 VUSB 1.15 12/14/00 8:42:11 AM Christopher Meyers RCS
// Keyword To StarTeam Keyword Translation
// 15 VUSB 1.14 12/13/00 7:58:39 PM Chris Kolb Removed
// the HOST_WITHOUT_HUB constant. This control is now a Endpt0 control
// register bit in up_int.vhd.
// 14 VUSB 1.13 12/13/00 7:58:31 PM Gregory Recupero Removed
// ^M's
// 13 VUSB 1.12 12/13/00 7:58:26 PM Mark Pettigrew
// ulogicified source - no functional changes
// 12 VUSB 1.11 12/13/00 7:58:19 PM Chris Kolb Change
// type of HOST_WITHOUT_HUB from std_logic to integer so that it could
// be used to initialize a _synopsysTM(TM) compatible generic.
// 11 VUSB 1.10 12/13/00 7:58:14 PM Chris Kolb Set
// constant to support Host to Low Speed device thru a hub.
// 10 VUSB 1.9 12/13/00 7:58:07 PM Chris Kolb Changed
// LOW_SPEED_DEV constant to type integer to support generics.
// 9 VUSB 1.8 12/13/00 7:57:58 PM Christopher Meyers
// removed ASIC_IMPLEMENTATION constant
// 8 VUSB 1.7 12/13/00 7:57:46 PM Chris Kolb Remove
// ^M's. No functional changes.
// 7 VUSB 1.6 12/13/00 7:57:39 PM Chris Kolb Added
// HOST_WITHOUT_HUB constant to support new code in the DPLLNRZI.
// 6 VUSB 1.5 12/13/00 7:57:19 PM Chris Kolb Turned
// host mode back on.
// 5 VUSB 1.4 12/13/00 7:57:12 PM Chris Kolb Reverted
// to device only implementation.
// 4 VUSB 1.3 12/13/00 7:57:08 PM Chris Kolb Added
// revision string.
// 3 VUSB 1.2 12/13/00 7:57:03 PM Chris Kolb Enabled
// implementation of embedded host functions.
// 2 VUSB 1.1 12/13/00 7:56:58 PM Chris Kolb Added
// IMPLEMENT_EMBEDED_HOST constant.
// 1 VUSB 1.0 12/13/00 7:56:51 PM Chris Kolb initial
// revision
// $
//
//
// ------------------------------------------------------------------------------
module vusb_bvci_tb ;
// file containing translation of VHDL package 'vusb_cfg'
wire usb_clk;
wire usb_rst_a;
wire usb_clk48;
wire usb_rst48_a;
wire vdd;
wire gnd;
// BVCI Initiator Interface
wire i_cmdack; // init. command acknowledge
wire [31:0] i_rdata; // init. read data
wire i_reop; // init. response end of packet
wire i_rspval; // init. response valid
wire [31:0] i_address; // init. address
wire [3:0] i_be; // init. byte enables
wire [1:0] i_cmd; // init. command
wire i_cmdval; // init. command valid
wire i_eop; // init. end of packet
wire i_rspack; // init. response acknowledge
wire [31:0] i_wdata; // init. write data
// BVCI Target Interface
wire [31:0] t_address; // target address
wire [3:0] t_be; // target byte enables
wire [1:0] t_cmd; // target command
wire t_cmdval; // target command valid
wire t_eop; // target end of packet
wire t_rspack; // target response acknowledge
wire [31:0] t_wdata; // target write data
wire t_cmdack; // target command acknowledge
wire [31:0] t_rdata; // target read data
wire t_reop; // target response end of packet
wire t_rspval; // target response valid
wire usb_int;
// usb signals
wire usb_rcv;
wire usb_dp;
wire usb_dm;
wire usb_dpo;
wire usb_dmo;
wire usb_oe_n;
wire usb_speed;
wire usb_suspnd;
// pull-up resistor controls
wire usb_dp_high;
wire usb_dp_low_n;
wire usb_dm_high;
wire usb_dm_low_n;
// OTG signals
wire usb_id;
wire usb_a_vbus_vld;
wire usb_sess_vld;
wire usb_b_sess_end;
wire usb_vbus_on;
wire usb_vbus_chg;
wire usb_vbus_dschg;
wire usb_a_vbus_vld_n;
wire usb_sess_vld_n;
wire usb_b_sess_end_n;
wire usb_vbus_on_n;
wire usb_vbus_chg_n;
wire usb_vbus_dschg_n;
// ---------------------------------------------------------------------------
// test bench begins here
// ---------------------------------------------------------------------------
assign vdd = 1'b 1;
assign gnd = 1'b 0;
vusb_bvci u_vusb_bvci (.clk(usb_clk),
.rst(usb_rst_a),
.rst_a(usb_rst_a),
.usb_clk48(usb_clk48),
.usb_rst48(usb_rst48_a),
.usb_rst48_a(usb_rst48_a),
// BVCI Initiator Interface
.vusb_i_cmdack(i_cmdack),
.vusb_i_rdata(i_rdata),
.vusb_i_reop(i_reop),
.vusb_i_rspval(i_rspval),
.vusb_i_address(i_address),
.vusb_i_be(i_be),
.vusb_i_cmd(i_cmd),
.vusb_i_cmdval(i_cmdval),
.vusb_i_eop(i_eop),
.vusb_i_rspack(i_rspack),
.vusb_i_wdata(i_wdata),
// BVCI Target Interface
.vusb_t_address(t_address),
.vusb_t_be(t_be),
.vusb_t_cmd(t_cmd),
.vusb_t_cmdval(t_cmdval),
.vusb_t_eop(t_eop),
.vusb_t_rspack(t_rspack),
.vusb_t_wdata(t_wdata),
.vusb_t_cmdack(t_cmdack),
.vusb_t_rdata(t_rdata),
.vusb_t_reop(t_reop),
.vusb_t_rspval(t_rspval),
// interrupt out
.vusb_irq(usb_int),
// USB transceiver interfaces
.usb_rcv(usb_rcv),
.usb_dp(usb_dp),
.usb_dm(usb_dm),
.usb_vbus_in(vdd),
.usb_dpo(usb_dpo),
.usb_dmo(usb_dmo),
.usb_oe_n(usb_oe_n),
.usb_speed(usb_speed),
.usb_suspnd(usb_suspnd),
// pull-up resistor controls
.usb_dp_high(usb_dp_high),
.usb_dp_low_n(usb_dp_low_n),
.usb_dm_high(usb_dm_high),
.usb_dm_low_n(usb_dm_low_n),
// OTG signals
.usb_id(usb_id),
.usb_a_vbus_vld(usb_a_vbus_vld),
.usb_sess_vld(usb_sess_vld),
.usb_b_sess_end(usb_b_sess_end),
.usb_vbus_on(usb_vbus_on),
.usb_vbus_chg(usb_vbus_chg),
.usb_vbus_dschg(usb_vbus_dschg));
pvic_connection_interface u_pvic (.master_clock(usb_clk),
.master_rst(usb_rst_a),
// cross connect the target & initiator
// bvci target
.device_1_t_cmdack(i_cmdack),
.device_1_t_rdata(i_rdata),
.device_1_t_reop(i_reop),
.device_1_t_rspval(i_rspval),
.device_1_t_addr(i_address),
.device_1_t_be(i_be),
.device_1_t_cmd(i_cmd),
.device_1_t_cmdval(i_cmdval),
.device_1_t_eop(i_eop),
.device_1_t_rspack(i_rspack),
.device_1_t_wdata(i_wdata),
// BVCI Initiator
.device_1_i_addr(t_address),
.device_1_i_be(t_be),
.device_1_i_cmd(t_cmd),
.device_1_i_cmdval(t_cmdval),
.device_1_i_eop(t_eop),
.device_1_i_rspack(t_rspack),
.device_1_i_wdata(t_wdata),
.device_1_i_cmdack(t_cmdack),
.device_1_i_rdata(t_rdata),
.device_1_i_reop(t_reop),
.device_1_i_rspval(t_rspval),
// interrupts
.pirq_1_irq_0(usb_int),
.pirq_1_irq_1(gnd),
.pirq_1_irq_2(gnd),
.pirq_1_irq_3(gnd),
.pirq_1_irq_4(gnd),
.pirq_1_irq_5(gnd),
.pirq_1_irq_6(gnd),
.pirq_1_irq_7(gnd));
vusb_tst u_vusb_tst (.usb_clk(usb_clk),
.usb_rst_a(usb_rst_a),
.usb_clk48(usb_clk48),
.usb_rst48_a(usb_rst48_a),
.usb_rcv(usb_rcv),
.usb_dp(usb_dp),
.usb_dm(usb_dm),
.usb_dpo(usb_dpo),
.usb_dmo(usb_dmo),
.usb_oe_n(usb_oe_n),
.usb_speed(usb_speed),
.usb_suspnd(usb_suspnd),
// pull-up resistor controls
.usb_dp_high(usb_dp_high),
.usb_dp_low_n(usb_dp_low_n),
.usb_dm_high(usb_dm_high),
.usb_dm_low_n(usb_dm_low_n),
// OTG signals
.usb_id(usb_id),
.usb_a_vbus_vld_n(usb_a_vbus_vld_n),
.usb_sess_vld_n(usb_sess_vld_n),
.usb_b_sess_end_n(usb_b_sess_end_n),
.usb_vbus_on_n(usb_vbus_on_n),
.usb_vbus_chg_n(usb_vbus_chg_n),
.usb_vbus_dschg_n(usb_vbus_dschg_n));
assign usb_sess_vld = ~usb_sess_vld_n; // invert these signals
assign usb_a_vbus_vld = ~usb_a_vbus_vld_n;
assign usb_b_sess_end = ~usb_b_sess_end_n;
assign usb_vbus_on_n = ~usb_vbus_on;
assign usb_vbus_chg_n = ~usb_vbus_chg;
assign usb_vbus_dschg_n = ~usb_vbus_dschg;
endmodule // module vusb_bvci_tb
// VUSB synthesis and simulation configuration constants.