30 #ifndef __SYSTEMC_EXT_CORE_SC_PORT_HH__ 31 #define __SYSTEMC_EXT_CORE_SC_PORT_HH__ 36 #include "../channel/messages.hh" 37 #include "../utils/sc_report_handler.hh" 82 void warn_port_constructor()
const;
87 const char *
kind()
const {
return "sc_port_base"; }
94 friend class ::sc_gem5::Module;
100 virtual void before_end_of_elaboration() = 0;
101 virtual void end_of_elaboration() = 0;
102 virtual void start_of_simulation() = 0;
103 virtual void end_of_simulation() = 0;
105 void report_error(
const char *
id,
const char *add_msg)
const;
108 friend class ::sc_gem5::Port;
109 friend class ::sc_gem5::Kernel;
115 virtual const char *_ifTypeName()
const = 0;
123 void operator () (IF &
i) { bind(i); }
126 virtual void bind(IF &
i) { sc_port_base::bind(i); }
132 if (_interfaces.empty()) {
136 return _interfaces[0];
141 if (_interfaces.empty()) {
145 return _interfaces[0];
151 if (n < 0 || n >= size()) {
155 return _interfaces[
n];
158 operator [] (
int n)
const 160 if (n < 0 || n >= size()) {
164 return _interfaces[
n];
170 if (_interfaces.empty())
172 return _interfaces[0];
177 if (_interfaces.empty())
179 return _interfaces[0];
200 IF *
interface = dynamic_cast<IF *>(&
i);
203 sc_port_base::bind(*interface);
212 sc_port_base::bind(*p);
222 if (n < 0 || n >= size()) {
226 return _interfaces[
n];
231 IF *
interface = dynamic_cast<IF *>(iface);
233 for (
unsigned i = 0;
i < _interfaces.size();
i++) {
234 if (interface == _interfaces[
i]) {
236 "interface already bound to port");
239 _interfaces.push_back(interface);
250 template <
class IF,
int N=1, sc_port_policy P=SC_ONE_OR_MORE_BOUND>
261 this->warn_port_constructor();
266 this->warn_port_constructor();
271 this->warn_port_constructor();
277 this->warn_port_constructor();
282 this->warn_port_constructor();
288 this->warn_port_constructor();
292 virtual const char *
kind()
const override {
return "sc_port"; }
304 #endif //__SYSTEMC_EXT_CORE_SC_PORT_HH__ sc_port(const char *name, const IF &interface)
Ports are used to interface objects to each other.
void before_end_of_elaboration() override
const char * _ifTypeName() const override
const std::string & name()
sc_trace_params(sc_trace_file *tf, const std::string &name)
sc_interface * get_interface()
void start_of_simulation() override
sc_port(sc_port< IF, N, P > &parent)
void end_of_elaboration() override
const char * kind() const
virtual const char * kind() const override
const char * sc_gen_unique_name(const char *seed)
int vbind(sc_interface &i) override
const char SC_ID_GET_IF_[]
sc_port(const IF &interface)
sc_port_b(const char *name, int n, sc_port_policy p)
sc_interface * _gem5Interface(int n) const override
virtual sc_port_policy _portPolicy() const override
sc_port_b(int n, sc_port_policy p)
virtual void bind(sc_port_b< IF > &p)
void end_of_simulation() override
sc_port(const char *name, sc_port< IF, N, P > &parent)
const char SC_ID_BIND_IF_TO_PORT_[]
void _gem5AddInterface(sc_interface *iface) override
sc_port_b(const sc_port_b< IF > &)
sc_port(const sc_port< IF, N, P > &)
sc_port(const char *name)
std::vector< IF * > _interfaces
sc_port(sc_port_b< IF > &parent)
std::vector< sc_trace_params * > sc_trace_params_vec
const sc_interface * get_interface() const
int vbind(sc_port_base &pb) override
::sc_gem5::Port * _gem5Port
sc_port(const char *name, sc_port_b< IF > &parent)