vusb_bias.v
3.79 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
/*******************************************************************************
-- 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_bias
-- Date Created: Tue Jul 16 14:01:11 2002
*******************************************************************************/
`timescale 1 ns / 1 ps // timescale for following modules
// -------------------------------------------------------------------
// Copyright 2001 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_bias.vhdl$
// Revision: $Revision: 1.4 $
//
// Description:
// This module should be instantiated at the same level as
// host_ctl. It is used to model the resistors on the usb dplus and
// dminus signals.
//
//
// --------------------------------------------------------------------
// This product is licensed to:
// John Princen of RouteFree
// for use at site(s):
// broadon
// --------------------------------------------------------------------
// Revision History
// $Log:
// 5 VUSB 1.4 4/11/02 2:49:09 PM Patrick Koran all
// checked in from pats pc, week of Starteam upgrade 4.6 to 5.1
// 4 VUSB 1.3 11/7/01 9:00:56 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.
// 3 VUSB 1.2 6/28/01 9:27:58 AM Tom Frechette Added
// control to turn off drives when others are driving the lines.
// 2 VUSB 1.1 6/21/01 10:41:25 AM Tom Frechette Added
// comments.
// 1 VUSB 1.0 6/15/01 2:30:47 PM Tom Frechette
// $
// --------------------------------------------------------------------
module vusb_bias (usb_dp_high,
usb_dp_low_n,
usb_dm_high,
usb_dm_low_n,
tb_is_device,
dplus,
dminus);
input usb_dp_high;
input usb_dp_low_n;
input usb_dm_high;
input usb_dm_low_n;
input tb_is_device;
inout dplus;
inout dminus;
wire VHDL2V_dplus;
wire VHDL2V_dminus;
wire dplus;
wire dminus;
reg dplus_i;
reg dminus_i;
reg fight_dp;
reg fight_dm;
reg drive_dm;
reg drive_dp;
// drive out the signals after 1 nsec to avoid contention
bufif0 (highz1,weak0)
g1(dplus, 1'b0, 1'b0) ,
g2(dminus, 1'b0,1'b0) ;
initial
begin
drive_dp = 1'b 1;
end
initial
begin
drive_dm = 1'b 1;
end
initial
begin
fight_dm = 1'b 0;
end
initial
begin
fight_dp = 1'b 0;
end
initial
begin
dminus_i = 1'b z;
end
initial
begin
dplus_i = 1'b z;
end
assign #(1) dplus = ((drive_dp === 1'b 1) & (tb_is_device !== 1'b0) & (usb_dp_high !== 1'b1)) ? dplus_i :
1'b z;
assign #(1) dminus = ((drive_dm === 1'b 1) & (usb_dm_low_n !== 1'b0)) ? dminus_i :
1'b z;
// determine whether someone else is driving the signals and yield to them
always @( dplus )
fight_dp = dplus === 1'b x ? 1'b 1 :
1'b 0;
always @( dminus )
fight_dm = dminus === 1'b x ? 1'b 1 :
1'b 0;
// if no one is driving the signals then drive them
always @( drive_dp or fight_dp or dplus )
drive_dp = drive_dp === 1'b 1 & fight_dp === 1'b 0 |
dplus === 1'b Z ? 1'b 1 :
1'b 0;
always @( drive_dm or fight_dm or dminus )
drive_dm = drive_dm === 1'b 1 & fight_dm === 1'b 0 |
dminus === 1'b Z ? 1'b 1 :
1'b 0;
always @( tb_is_device )
dplus_i = tb_is_device === 1'b 1 ? 1'b 1 :
1'b 0;
always @( usb_dm_high )
dminus_i = usb_dm_high === 1'b 1 ? 1'b 1 :
1'b 0;
endmodule // module vusb_bias