1 |
2 |
alfoltran |
/////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// USB PHY ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// SystemC Version: usb_phy.cpp ////
|
6 |
|
|
//// Author: Alfredo Luiz Foltran Fialho ////
|
7 |
|
|
//// alfoltran@ig.com.br ////
|
8 |
|
|
//// ////
|
9 |
|
|
//// ////
|
10 |
|
|
/////////////////////////////////////////////////////////////////////
|
11 |
|
|
//// ////
|
12 |
|
|
//// Verilog Version: usb_phy.v ////
|
13 |
|
|
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
|
14 |
|
|
//// www.asics.ws ////
|
15 |
|
|
//// rudi@asics.ws ////
|
16 |
|
|
//// ////
|
17 |
|
|
//// This source file may be used and distributed without ////
|
18 |
|
|
//// restriction provided that this copyright statement is not ////
|
19 |
|
|
//// removed from the file and that any derivative work contains ////
|
20 |
|
|
//// the original copyright notice and the associated disclaimer.////
|
21 |
|
|
//// ////
|
22 |
|
|
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
|
23 |
|
|
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
|
24 |
|
|
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
|
25 |
|
|
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
|
26 |
|
|
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
|
27 |
|
|
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
|
28 |
|
|
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
|
29 |
|
|
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
|
30 |
|
|
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
|
31 |
|
|
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
|
32 |
|
|
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
|
33 |
|
|
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
|
34 |
|
|
//// POSSIBILITY OF SUCH DAMAGE. ////
|
35 |
|
|
//// ////
|
36 |
|
|
/////////////////////////////////////////////////////////////////////
|
37 |
|
|
|
38 |
|
|
#include "systemc.h"
|
39 |
|
|
#include "usb_phy.h"
|
40 |
|
|
|
41 |
|
|
void usb_phy::reset_up(void) {
|
42 |
|
|
reset.write(rst.read() && !usb_rst.read());
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
void usb_phy::rst_cnt_up(void) {
|
46 |
|
|
if (!rst.read())
|
47 |
|
|
rst_cnt.write(0);
|
48 |
|
|
else if (LineState_o.read() != 0)
|
49 |
|
|
rst_cnt.write(0);
|
50 |
|
|
else if (!usb_rst.read() && fs_ce.read())
|
51 |
|
|
rst_cnt.write(rst_cnt.read() + 1);
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
void usb_phy::usb_rst_up(void) {
|
55 |
|
|
usb_rst.write(rst_cnt.read() == 31);
|
56 |
|
|
}
|
57 |
|
|
/*
|
58 |
|
|
usb_phy::~usb_phy(void) {
|
59 |
|
|
if (i_tx_phy)
|
60 |
|
|
delete i_tx_phy;
|
61 |
|
|
if (i_rx_phy)
|
62 |
|
|
delete i_rx_phy;
|
63 |
|
|
}
|
64 |
|
|
*/
|