Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: itl.hpp | |
4 | // Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved | |
5 | // 4150 Network Circle, Santa Clara, California 95054, U.S.A. | |
6 | // | |
7 | // * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
8 | // | |
9 | // This program is free software; you can redistribute it and/or modify | |
10 | // it under the terms of the GNU General Public License as published by | |
11 | // the Free Software Foundation; version 2 of the License. | |
12 | // | |
13 | // This program is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | // | |
18 | // You should have received a copy of the GNU General Public License | |
19 | // along with this program; if not, write to the Free Software | |
20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | // | |
22 | // For the avoidance of doubt, and except that if any non-GPL license | |
23 | // choice is available it will apply instead, Sun elects to use only | |
24 | // the General Public License version 2 (GPLv2) at this time for any | |
25 | // software where a choice of GPL license versions is made | |
26 | // available with the language indicating that GPLv2 or any later version | |
27 | // may be used, or where a choice of which version of the GPL is applied is | |
28 | // otherwise unspecified. | |
29 | // | |
30 | // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
31 | // CA 95054 USA or visit www.sun.com if you need additional information or | |
32 | // have any questions. | |
33 | // | |
34 | // ========== Copyright Header End ============================================ | |
35 | #ifndef INC_itl_hpp__ | |
36 | #define INC_itl_hpp__ | |
37 | ||
38 | #include <systemc.h> | |
39 | ||
40 | #include "pcie_common/config.hpp" | |
41 | #include "pcie_common/pciePacket.hpp" | |
42 | ||
43 | #include "pcie_common/data_port.hpp" | |
44 | #include "pcie_common/csr_if_port.hpp" | |
45 | #include "pcie_common/peu_csr_defines.hpp" | |
46 | #include "pcie_common/peu_defines.hpp" | |
47 | ||
48 | #include "tlm.h" | |
49 | ||
50 | using tlm::tlm_transport_if; | |
51 | using tlm::tlm_slave_if; | |
52 | ||
53 | #include "pcie_common/tlm/tlm_data_channel.hpp" | |
54 | ||
55 | #include <queue> | |
56 | ||
57 | #define WAIT(__EV__) if(!POR_RESET) wait( __EV__ | reset_ev); \ | |
58 | if(POR_RESET) {LOG_INFO<<"ITL: WAIT exception thrown!"; throw sc_exception();} | |
59 | ||
60 | namespace pcie { | |
61 | ||
62 | class itl : public sc_module | |
63 | { | |
64 | public: | |
65 | itl(sc_module_name module_name, sc_event *parent_global_ev, uint8 *global_event_type) : | |
66 | sc_module (module_name), | |
67 | d_in_port("data_in_port"), | |
68 | d_out_port("data_out_port"), | |
69 | rsb_out_port("rsb_out_port"), | |
70 | csr_port("CSR_PORT") | |
71 | { | |
72 | this->parent_global_ev = parent_global_ev; | |
73 | this->global_event_type = global_event_type; | |
74 | SC_METHOD(init); | |
75 | SC_THREAD(reset_handler); | |
76 | } | |
77 | ||
78 | SC_HAS_PROCESS( itl); | |
79 | ||
80 | data_in_port<RefPciePacket> d_in_port; | |
81 | data_out_port<RefPciePacket> d_out_port; | |
82 | sc_port< tlm_transport_if<RefPciePacket, bool> > rsb_out_port; | |
83 | csr_if_port< CSR_ADDR_T, CSR_DATA_T > csr_port; | |
84 | ||
85 | private: | |
86 | //Module threads and methods | |
87 | void execute(); | |
88 | void update_ica(); | |
89 | void write_error_csr(uint8, uint8, uint8, char[]); | |
90 | void init(); | |
91 | void reset_handler(); | |
92 | ||
93 | //Module events | |
94 | sc_event fcComp_ev; ///< Flow Control credits update complete event | |
95 | sc_event inPkt_ev; ///< Ingress pkt rdy for flow control processing event | |
96 | sc_event reset_ev; ///< Reset event for threads in the module | |
97 | sc_event *parent_global_ev; ///< Global event to the module | |
98 | ||
99 | uint8 *global_event_type; ///< Global event type | |
100 | ||
101 | //Module flags and registers | |
102 | bool DROP; ///< Ingress Pkt to-be-dropped flag | |
103 | bool POR_RESET; ///< Power-on Reset flag | |
104 | sc_uint<64> icc_val; ///< Ingress Credits Consumed/Recvd local register | |
105 | ||
106 | //Proc handles | |
107 | sc_process_handle execute_ph; | |
108 | sc_process_handle update_ica_ph; | |
109 | ||
110 | enum {OE,UE,CE}; | |
111 | ||
112 | USE_NAMESPACE(std)queue<RefPciePacket> fc_q; ///< Ingress TLP recvd queue | |
113 | }; | |
114 | ||
115 | } // namespace pcie_tl | |
116 | ||
117 | #endif // INC_itl_hpp__ |