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

Subversion Repositories usb11

[/] [usb11/] [trunk/] [rtl/] [systemc/] [tx_test.cpp] - Blame information for rev 15

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfoltran
#include "systemc.h"
2
#include "usb_tx_phy.h"
3
 
4
SC_MODULE(test) {
5
        sc_in<bool> clk;
6
        sc_out<bool> rst, fs_ce, phy_tx_mode;
7
        sc_in<bool> txdp, txdn, txoe;
8
        sc_out<sc_uint<8> > DataOut_i;
9
        sc_out<bool> TxValid_i;
10
        sc_in<bool> TxReady_o;
11
 
12
        int i;
13
 
14
        void update(void) {
15
                i = 0;
16
                rst.write(false);
17
                wait();
18
                wait();
19
                rst.write(true);
20
                wait();
21
                wait();
22
                wait();
23
                wait();
24
                sc_stop();
25
        }
26
 
27
        SC_CTOR(test) {
28
                SC_THREAD(update);
29
                sensitive << clk.pos();
30
        }
31
};
32
 
33
int sc_main(int argc, char *argv[]) {
34
 
35
        sc_set_time_resolution(1.0, SC_NS);
36
 
37
        sc_clock clk("clock", 20.83, SC_NS);
38
        sc_signal<bool> rst, fs_ce, phy_tx_mode, txdp, txdn, txoe, TxValid_i, TxReady_o;
39
        sc_signal<sc_uint<8> > DataOut_i;
40
 
41
        usb_tx_phy i_tx_phy("TX_PHY");
42
        test i_test("TEST");
43
 
44
        i_tx_phy.clk(clk);
45
        i_tx_phy.rst(rst);
46
        i_tx_phy.fs_ce(fs_ce);
47
        i_tx_phy.phy_mode(phy_tx_mode);
48
        i_tx_phy.txdp(txdp);
49
        i_tx_phy.txdn(txdn);
50
        i_tx_phy.txoe(txoe);
51
        i_tx_phy.DataOut_i(DataOut_i);
52
        i_tx_phy.TxValid_i(TxValid_i);
53
        i_tx_phy.TxReady_o(TxReady_o);
54
 
55
        i_test.clk(clk);
56
        i_test.rst(rst);
57
        i_test.fs_ce(fs_ce);
58
        i_test.phy_tx_mode(phy_tx_mode);
59
        i_test.txdp(txdp);
60
        i_test.txdn(txdn);
61
        i_test.txoe(txoe);
62
        i_test.DataOut_i(DataOut_i);
63
        i_test.TxValid_i(TxValid_i);
64
        i_test.TxReady_o(TxReady_o);
65
 
66
        sc_trace_file *log = sc_create_vcd_trace_file("TX_TEST");
67
        sc_trace(log, clk, "Clock");
68
        sc_trace(log, rst, "Reset");
69
 
70
        //sc_start(1000, SC_NS);
71
        sc_start();
72
 
73
        sc_close_vcd_trace_file(log);
74
 
75
        return 0;
76
}
77
 

powered by: WebSVN 2.1.0

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