sc_port_wrapper.hh (14126:cbb7113b701a) sc_port_wrapper.hh (14189:a363edac6a12)
1/*
2 * Copyright 2019 Google LLC.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 71 unchanged lines hidden (view full) ---

80 port_.bind(beer->port());
81 } else if (auto* iface =
82 dynamic_cast<ScInterfaceWrapper<IF>*>(&peer)) {
83 port_.bind(iface->interface());
84 } else {
85 fatal("Attempt to bind sc_port %s to incompatible port %s.",
86 name(), peer.name());
87 }
1/*
2 * Copyright 2019 Google LLC.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 71 unchanged lines hidden (view full) ---

80 port_.bind(beer->port());
81 } else if (auto* iface =
82 dynamic_cast<ScInterfaceWrapper<IF>*>(&peer)) {
83 port_.bind(iface->interface());
84 } else {
85 fatal("Attempt to bind sc_port %s to incompatible port %s.",
86 name(), peer.name());
87 }
88 Port::bind(peer);
88 }
89
90 private:
91 ScPort& port_;
92};
93
94template <typename IF>
95class ScInterfaceWrapper : public ::Port

--- 22 unchanged lines hidden (view full) ---

118 fatal_if(!dynamic_cast<ScPortWrapper<IF>*>(&peer) &&
119 !dynamic_cast<ScExportWrapper<IF>*>(&peer),
120 "Attempt to bind sc_interface %s to incompatible port %s.",
121 name(), peer.name());
122
123 // Don't bind to peer otherwise we may have error messages saying that
124 // this interface has already be bound since the peer may already did
125 // that. Just let sc_port or sc_export do the binding
89 }
90
91 private:
92 ScPort& port_;
93};
94
95template <typename IF>
96class ScInterfaceWrapper : public ::Port

--- 22 unchanged lines hidden (view full) ---

119 fatal_if(!dynamic_cast<ScPortWrapper<IF>*>(&peer) &&
120 !dynamic_cast<ScExportWrapper<IF>*>(&peer),
121 "Attempt to bind sc_interface %s to incompatible port %s.",
122 name(), peer.name());
123
124 // Don't bind to peer otherwise we may have error messages saying that
125 // this interface has already be bound since the peer may already did
126 // that. Just let sc_port or sc_export do the binding
127 Port::bind(peer);
126 }
127
128 private:
129 IF& iface_;
130};
131
132template <typename IF>
133class ScExportWrapper : public ::Port

--- 21 unchanged lines hidden (view full) ---

155 bind(::Port& peer) override
156 {
157 auto* iface = dynamic_cast<ScInterfaceWrapper<IF>*>(&peer);
158 fatal_if(!iface,
159 "Attempt to bind sc_export %s to incompatible port %s.",
160 name(), peer.name());
161
162 port_.bind(iface->interface());
128 }
129
130 private:
131 IF& iface_;
132};
133
134template <typename IF>
135class ScExportWrapper : public ::Port

--- 21 unchanged lines hidden (view full) ---

157 bind(::Port& peer) override
158 {
159 auto* iface = dynamic_cast<ScInterfaceWrapper<IF>*>(&peer);
160 fatal_if(!iface,
161 "Attempt to bind sc_export %s to incompatible port %s.",
162 name(), peer.name());
163
164 port_.bind(iface->interface());
165 Port::bind(peer);
163 }
164
165 private:
166 ScExport& port_;
167};
168
169} // namespace sc_gem5
170
171#endif // __SYSTEMC_SC_PORT_WRAPPER_HH__
166 }
167
168 private:
169 ScExport& port_;
170};
171
172} // namespace sc_gem5
173
174#endif // __SYSTEMC_SC_PORT_WRAPPER_HH__