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); |
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); |
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); |
166 } 167 168 private: 169 ScExport& port_; 170}; 171 172} // namespace sc_gem5 173 174#endif // __SYSTEMC_SC_PORT_WRAPPER_HH__ |