99d891f958b2c4cc24527178fc6215419ae038cf
2 * Copyright (c) 2008 Princeton University
3 * Copyright (c) 2016 Georgia Institute of Technology
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "mem/ruby/network/garnet2.0/GarnetLink.hh"
33 #include "debug/RubyNetwork.hh"
34 #include "mem/ruby/network/garnet2.0/CreditLink.hh"
35 #include "mem/ruby/network/garnet2.0/NetworkBridge.hh"
36 #include "mem/ruby/network/garnet2.0/NetworkLink.hh"
38 GarnetIntLink::GarnetIntLink(const Params
*p
)
43 m_network_link
= p
->network_link
;
44 m_credit_link
= p
->credit_link
;
46 srcCdcEn
= p
->src_cdc
;
47 dstCdcEn
= p
->dst_cdc
;
49 srcSerdesEn
= p
->src_serdes
;
50 dstSerdesEn
= p
->dst_serdes
;
55 if (srcCdcEn
|| srcSerdesEn
) {
57 srcNetBridge
= p
->src_net_bridge
;
58 srcCredBridge
= p
->src_cred_bridge
;
60 if (dstCdcEn
|| dstSerdesEn
) {
62 dstNetBridge
= p
->dst_net_bridge
;
63 dstCredBridge
= p
->dst_cred_bridge
;
72 assert(srcNetBridge
&& srcCredBridge
);
73 srcNetBridge
->initBridge(srcCredBridge
, srcCdcEn
, srcSerdesEn
);
74 srcCredBridge
->initBridge(srcNetBridge
, srcCdcEn
, srcSerdesEn
);
78 assert(dstNetBridge
&& dstCredBridge
);
79 dstNetBridge
->initBridge(dstCredBridge
, dstCdcEn
, dstSerdesEn
);
80 dstCredBridge
->initBridge(dstNetBridge
, dstCdcEn
, dstSerdesEn
);
85 GarnetIntLink::print(std::ostream
& out
) const
91 GarnetIntLinkParams::create()
93 return new GarnetIntLink(this);
96 GarnetExtLink::GarnetExtLink(const Params
*p
)
102 m_network_links
[0] = p
->network_links
[0];
103 m_credit_links
[0] = p
->credit_links
[0];
106 m_network_links
[1] = p
->network_links
[1];
107 m_credit_links
[1] = p
->credit_links
[1];
110 extCdcEn
= p
->ext_cdc
;
111 intCdcEn
= p
->int_cdc
;
113 extSerdesEn
= p
->ext_serdes
;
114 intSerdesEn
= p
->int_serdes
;
119 if (extCdcEn
|| extSerdesEn
) {
121 extNetBridge
[0] = p
->ext_net_bridge
[0];
122 extCredBridge
[0] = p
->ext_cred_bridge
[0];
123 extNetBridge
[1] = p
->ext_net_bridge
[1];
124 extCredBridge
[1] = p
->ext_cred_bridge
[1];
127 if (intCdcEn
|| intSerdesEn
) {
129 intNetBridge
[0] = p
->int_net_bridge
[0];
130 intNetBridge
[1] = p
->int_net_bridge
[1];
131 intCredBridge
[0] = p
->int_cred_bridge
[0];
132 intCredBridge
[1] = p
->int_cred_bridge
[1];
138 GarnetExtLink::init()
141 assert(extNetBridge
[0] && extCredBridge
[0] &&
142 extNetBridge
[1] && extCredBridge
[1]);
143 extNetBridge
[0]->initBridge(extCredBridge
[0], extCdcEn
, extSerdesEn
);
144 extCredBridge
[0]->initBridge(extNetBridge
[0], extCdcEn
, extSerdesEn
);
145 extNetBridge
[1]->initBridge(extCredBridge
[1], extCdcEn
, extSerdesEn
);
146 extCredBridge
[1]->initBridge(extNetBridge
[1], extCdcEn
, extSerdesEn
);
150 assert(intNetBridge
[0] && intCredBridge
[0] &&
151 intNetBridge
[1] && intCredBridge
[1]);
152 intNetBridge
[0]->initBridge(intCredBridge
[0], intCdcEn
, intSerdesEn
);
153 intCredBridge
[0]->initBridge(intNetBridge
[0], intCdcEn
, intSerdesEn
);
154 intNetBridge
[1]->initBridge(intCredBridge
[1], intCdcEn
, intSerdesEn
);
155 intCredBridge
[1]->initBridge(intNetBridge
[1], intCdcEn
, intSerdesEn
);
160 GarnetExtLink::print(std::ostream
& out
) const
166 GarnetExtLinkParams::create()
168 return new GarnetExtLink(this);