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

Subversion Repositories ulpi_wrapper

[/] [ulpi_wrapper/] [trunk/] [testbench/] [utmi_driver.h] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 ultra_embe
#ifndef UTMI_DRIVER_H
2
#define UTMI_DRIVER_H
3
 
4
#include <systemc.h>
5
 
6
//-------------------------------------------------------------
7
// utmi_driver: UTMI driver (LINK) component
8
//-------------------------------------------------------------
9
SC_MODULE (utmi_driver)
10
{
11
public:
12
    //-------------------------------------------------------------
13
    // Interface I/O
14
    //-------------------------------------------------------------
15
    // Clock and Reset
16
    sc_in<bool>             clk_i;
17
    sc_in<bool>             rst_i;
18
 
19
    // I/O
20
    sc_out <bool>           utmi_txvalid_o;
21
    sc_out <sc_uint<8> >    utmi_data_o;
22
    sc_in  <bool>           utmi_txready_i;
23
 
24
    sc_in  <sc_uint<8> >    utmi_data_i;
25
    sc_in  <bool>           utmi_rxvalid_i;
26
    sc_in  <bool>           utmi_rxactive_i;
27
 
28
    //-------------------------------------------------------------
29
    // Constructor
30
    //-------------------------------------------------------------
31
    SC_HAS_PROCESS(utmi_driver);
32
    utmi_driver(sc_module_name name): sc_module(name),
33
                                      m_tx_fifo(2048),
34
                                      m_rx_fifo(2048)
35
    {
36
        SC_CTHREAD(tx_drive, clk_i.pos());
37
        SC_CTHREAD(rx_mon, clk_i.pos());
38
    }
39
 
40
    //-------------------------------------------------------------
41
    // Trace
42
    //-------------------------------------------------------------
43
    void add_trace(sc_trace_file *vcd, std::string prefix)
44
    {
45
        #undef  TRACE_SIGNAL
46
        #define TRACE_SIGNAL(s) sc_trace(vcd,s,prefix + #s)
47
 
48
        TRACE_SIGNAL(utmi_txvalid_o);
49
        TRACE_SIGNAL(utmi_data_o);
50
        TRACE_SIGNAL(utmi_txready_i);
51
        TRACE_SIGNAL(utmi_data_i);
52
        TRACE_SIGNAL(utmi_rxvalid_i);
53
        TRACE_SIGNAL(utmi_rxactive_i);
54
 
55
        #undef  TRACE_SIGNAL
56
    }
57
 
58
    //-------------------------------------------------------------
59
    // API
60
    //-------------------------------------------------------------
61
    void write(sc_uint <8> data, bool last);
62
    bool read(sc_uint <8> &data);
63
 
64
    //-------------------------------------------------------------
65
    // Internal
66
    //-------------------------------------------------------------
67
protected:
68
    void tx_drive(void);
69
    void rx_mon(void);
70
    void rx_write(sc_uint <8> data, bool last);
71
    bool tx_read(sc_uint <8> &data);
72
 
73
    sc_fifo < sc_uint<9> > m_tx_fifo;
74
    sc_fifo < sc_uint<9> > m_rx_fifo;
75
};
76
 
77
#endif

powered by: WebSVN 2.1.0

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