1 | /* -*- c++ -*- |
---|
2 | * |
---|
3 | * SOCLIB_LGPL_HEADER_BEGIN |
---|
4 | * |
---|
5 | * This file is part of SoCLib, GNU LGPLv2.1. |
---|
6 | * |
---|
7 | * SoCLib is free software; you can redistribute it and/or modify it |
---|
8 | * under the terms of the GNU Lesser General Public License as published |
---|
9 | * by the Free Software Foundation; version 2.1 of the License. |
---|
10 | * |
---|
11 | * SoCLib is distributed in the hope that it will be useful, but |
---|
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
14 | * Lesser General Public License for more details. |
---|
15 | * |
---|
16 | * You should have received a copy of the GNU Lesser General Public |
---|
17 | * License along with SoCLib; if not, write to the Free Software |
---|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
---|
19 | * 02110-1301 USA |
---|
20 | * |
---|
21 | * SOCLIB_LGPL_HEADER_END |
---|
22 | * |
---|
23 | * Copyright (c) UPMC, Lip6, Asim |
---|
24 | * Alain Greiner <nipo@ssji.net>, 2013 |
---|
25 | * |
---|
26 | * Maintainers: alain |
---|
27 | */ |
---|
28 | |
---|
29 | //////////////////////////////////////////////////////////////////////////////// |
---|
30 | // This component emulates an external IO bus such as PCIe or Hypertransport, |
---|
31 | // but respect the VCI protocol. It can be attached to one OR SEVERAL clusters, |
---|
32 | // using a vci_io_bridge component. |
---|
33 | // It is considered as a local interconnect, for the ADDRESS or SRCID |
---|
34 | // decoding tables: |
---|
35 | // - the CMD routing_table decodes the local field of the VCI ADDRESS |
---|
36 | // to return the local target port |
---|
37 | // - The RSP routing_table decodes the local field of the VCI SRCID |
---|
38 | // to return the initator port |
---|
39 | // It is implemented as two independant crossbars, for VCI commands and |
---|
40 | // VCI responses respectively. |
---|
41 | // - The CMD crossbar has nb_ini input ports, and nb_tgt output ports, |
---|
42 | // including the ports to the vci_io_bridge component(s). |
---|
43 | // - The RSP crossbar has nb_tgt input ports, and nb_ini output ports. |
---|
44 | // including the ports to the vci_io_bridge component(s). |
---|
45 | // For both crossbars, output ports allocation policy is round robin. |
---|
46 | //////////////////////////////////////////////////////////////////////////////// |
---|
47 | |
---|
48 | #ifndef VCI_IOX_NETWORK_H |
---|
49 | #define VCI_IOX_NETWORK_H |
---|
50 | |
---|
51 | #include <systemc> |
---|
52 | #include "caba_base_module.h" |
---|
53 | #include "vci_initiator.h" |
---|
54 | #include "vci_target.h" |
---|
55 | #include "vci_buffers.h" |
---|
56 | #include "mapping_table.h" |
---|
57 | #include "address_decoding_table.h" |
---|
58 | |
---|
59 | namespace soclib { namespace caba { |
---|
60 | |
---|
61 | using namespace sc_core; |
---|
62 | using namespace soclib::common; |
---|
63 | |
---|
64 | template<typename pkt_t> class IoXbar; |
---|
65 | |
---|
66 | /////////////////////////////////////// |
---|
67 | template<typename vci_param> |
---|
68 | class VciIoxNetwork |
---|
69 | /////////////////////////////////////// |
---|
70 | : public BaseModule |
---|
71 | { |
---|
72 | |
---|
73 | public: |
---|
74 | |
---|
75 | sc_in<bool> p_clk; |
---|
76 | sc_in<bool> p_resetn; |
---|
77 | VciInitiator<vci_param>* p_to_tgt; |
---|
78 | VciTarget<vci_param>* p_to_ini; |
---|
79 | |
---|
80 | private: |
---|
81 | |
---|
82 | typedef IoXbar<VciCmdBuffer<vci_param> > cmd_xbar_t; |
---|
83 | typedef IoXbar<VciRspBuffer<vci_param> > rsp_xbar_t; |
---|
84 | |
---|
85 | size_t m_nb_tgt; |
---|
86 | size_t m_nb_ini; |
---|
87 | |
---|
88 | VciInitiator<vci_param>** m_ports_to_target; |
---|
89 | VciTarget<vci_param>** m_ports_to_initiator; |
---|
90 | |
---|
91 | rsp_xbar_t* m_rsp_xbar; // RSP crossbar |
---|
92 | cmd_xbar_t* m_cmd_xbar; // CMD crossbar |
---|
93 | |
---|
94 | AddressDecodingTable<uint64_t,size_t> m_cmd_rt; // routing table for CMD |
---|
95 | AddressDecodingTable<uint32_t,size_t> m_rsp_rt; // routing table for RSP |
---|
96 | |
---|
97 | void transition(); |
---|
98 | |
---|
99 | void genMealy_cmd_val(); |
---|
100 | void genMealy_cmd_ack(); |
---|
101 | void genMealy_rsp_val(); |
---|
102 | void genMealy_rsp_ack(); |
---|
103 | |
---|
104 | protected: |
---|
105 | SC_HAS_PROCESS(VciIoxNetwork); |
---|
106 | |
---|
107 | public: |
---|
108 | void print_trace(); |
---|
109 | |
---|
110 | VciIoxNetwork( sc_module_name name, |
---|
111 | const soclib::common::MappingTable &mt, |
---|
112 | size_t nb_tgt, |
---|
113 | size_t nb_ini ); |
---|
114 | |
---|
115 | ~VciIoxNetwork(); |
---|
116 | }; |
---|
117 | |
---|
118 | }} |
---|
119 | |
---|
120 | #endif |
---|
121 | |
---|
122 | // Local Variables: |
---|
123 | // tab-width: 4 |
---|
124 | // c-basic-offset: 4 |
---|
125 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
126 | // indent-tabs-mode: nil |
---|
127 | // End: |
---|
128 | |
---|
129 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|