sc_port.hh (12842:79e4e6e731fe) sc_port.hh (12868:23162a436538)
1/*
2 * Copyright 2018 Google, Inc.
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

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

56
57template <class IF>
58class sc_port_b : public sc_port_base
59{
60 public:
61 void
62 operator () (IF &)
63 {
1/*
2 * Copyright 2018 Google, Inc.
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

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

56
57template <class IF>
58class sc_port_b : public sc_port_base
59{
60 public:
61 void
62 operator () (IF &)
63 {
64 warn_unimpl(__PRETTY_FUNCTION__);
64 this->warn_unimpl(__PRETTY_FUNCTION__);
65 }
66
67 void
68 operator () (sc_port_b<IF> &)
69 {
65 }
66
67 void
68 operator () (sc_port_b<IF> &)
69 {
70 warn_unimpl(__PRETTY_FUNCTION__);
70 this->warn_unimpl(__PRETTY_FUNCTION__);
71 }
72
73 virtual void
74 bind(IF &)
75 {
71 }
72
73 virtual void
74 bind(IF &)
75 {
76 warn_unimpl(__PRETTY_FUNCTION__);
76 this->warn_unimpl(__PRETTY_FUNCTION__);
77 }
78
79 virtual void
80 bind(sc_port_b<IF> &)
81 {
77 }
78
79 virtual void
80 bind(sc_port_b<IF> &)
81 {
82 warn_unimpl(__PRETTY_FUNCTION__);
82 this->warn_unimpl(__PRETTY_FUNCTION__);
83 }
84
85 int
86 size() const
87 {
83 }
84
85 int
86 size() const
87 {
88 warn_unimpl(__PRETTY_FUNCTION__);
88 this->warn_unimpl(__PRETTY_FUNCTION__);
89 return 0;
90 }
91
92 IF *
93 operator -> ()
94 {
89 return 0;
90 }
91
92 IF *
93 operator -> ()
94 {
95 warn_unimpl(__PRETTY_FUNCTION__);
95 this->warn_unimpl(__PRETTY_FUNCTION__);
96 return (IF *)nullptr;
97 }
98
99 const IF *
100 operator -> () const
101 {
96 return (IF *)nullptr;
97 }
98
99 const IF *
100 operator -> () const
101 {
102 warn_unimpl(__PRETTY_FUNCTION__);
102 this->warn_unimpl(__PRETTY_FUNCTION__);
103 return (IF *)nullptr;
104 }
105
106 IF *
107 operator [] (int)
108 {
103 return (IF *)nullptr;
104 }
105
106 IF *
107 operator [] (int)
108 {
109 warn_unimpl(__PRETTY_FUNCTION__);
109 this->warn_unimpl(__PRETTY_FUNCTION__);
110 return (IF *)nullptr;
111 }
112
113 const IF *
114 operator [] (int) const
115 {
110 return (IF *)nullptr;
111 }
112
113 const IF *
114 operator [] (int) const
115 {
116 warn_unimpl(__PRETTY_FUNCTION__);
116 this->warn_unimpl(__PRETTY_FUNCTION__);
117 return (IF *)nullptr;
118 }
119
120 virtual sc_interface *
121 get_interface()
122 {
117 return (IF *)nullptr;
118 }
119
120 virtual sc_interface *
121 get_interface()
122 {
123 warn_unimpl(__PRETTY_FUNCTION__);
123 this->warn_unimpl(__PRETTY_FUNCTION__);
124 return (sc_interface *)nullptr;
125 }
126
127 virtual const sc_interface *
128 get_interface() const
129 {
124 return (sc_interface *)nullptr;
125 }
126
127 virtual const sc_interface *
128 get_interface() const
129 {
130 warn_unimpl(__PRETTY_FUNCTION__);
130 this->warn_unimpl(__PRETTY_FUNCTION__);
131 return (sc_interface *)nullptr;
132 }
133
134 protected:
135 virtual void before_end_of_elaboration() {}
136 virtual void end_of_elaboration() {}
137 virtual void start_of_elaboration() {}
138 virtual void end_of_simulation() {}

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

151 sc_port_b(const sc_port_b<IF> &) {}
152 sc_port_b<IF> &operator = (const sc_port_b<IF> &) { return *this; }
153};
154
155template <class IF, int N=1, sc_port_policy P=SC_ONE_OR_MORE_BOUND>
156class sc_port : public sc_port_b<IF>
157{
158 public:
131 return (sc_interface *)nullptr;
132 }
133
134 protected:
135 virtual void before_end_of_elaboration() {}
136 virtual void end_of_elaboration() {}
137 virtual void start_of_elaboration() {}
138 virtual void end_of_simulation() {}

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

151 sc_port_b(const sc_port_b<IF> &) {}
152 sc_port_b<IF> &operator = (const sc_port_b<IF> &) { return *this; }
153};
154
155template <class IF, int N=1, sc_port_policy P=SC_ONE_OR_MORE_BOUND>
156class sc_port : public sc_port_b<IF>
157{
158 public:
159 sc_port() : sc_port_b<IF>(sc_gen_unique_name("sc_port"), N, P) {}
159 sc_port() : sc_port_b(N, P) {}
160 explicit sc_port(const char *name) : sc_port_b<IF>(name, N, P) {}
161 virtual ~sc_port() {}
162
160 explicit sc_port(const char *name) : sc_port_b<IF>(name, N, P) {}
161 virtual ~sc_port() {}
162
163 // Deprecated binding constructors.
164 explicit sc_port(const IF &interface) : sc_port_b<IF>(N, P)
165 {
166 this->warn_unimpl(__PRETTY_FUNCTION__);
167 // Should warn that these are deprecated. See Accellera sc_port.h.
168 sc_port_b<IF>::bind(const_cast<IF &>(interface));
169 }
170 sc_port(const char *name, const IF &interface) : sc_port_b<IF>(name, N, P)
171 {
172 this->warn_unimpl(__PRETTY_FUNCTION__);
173 // Should warn that these are deprecated. See Accellera sc_port.h.
174 sc_port_b<IF>::bind(const_cast<IF &>(interface));
175 }
176 explicit sc_port(sc_port_b<IF> &parent) : sc_port_b<IF>(N, P)
177 {
178 this->warn_unimpl(__PRETTY_FUNCTION__);
179 // Should warn that these are deprecated. See Accellera sc_port.h.
180 sc_port_b<IF>::bind(parent);
181 }
182 sc_port(const char *name, sc_port_b<IF> &parent) :
183 sc_port_b<IF>(name, N, P)
184 {
185 this->warn_unimpl(__PRETTY_FUNCTION__);
186 // Should warn that these are deprecated. See Accellera sc_port.h.
187 sc_port_b<IF>::bind(parent);
188 }
189 explicit sc_port(sc_port<IF, N, P> &parent) : sc_port_b<IF>(N, P)
190 {
191 this->warn_unimpl(__PRETTY_FUNCTION__);
192 // Should warn that these are deprecated. See Accellera sc_port.h.
193 sc_port_b<IF>::bind(parent);
194 }
195 sc_port(const char *name, sc_port<IF, N, P> &parent) :
196 sc_port_b<IF>(name, N, P)
197 {
198 this->warn_unimpl(__PRETTY_FUNCTION__);
199 // Should warn that these are deprecated. See Accellera sc_port.h.
200 sc_port_b<IF>::bind(parent);
201 }
202
163 virtual const char *kind() const { return "sc_port"; }
164
165 private:
166 // Disabled
167 sc_port(const sc_port<IF, N, P> &) {}
168 sc_port<IF, N, P> &operator = (const sc_port<IF, N, P> &) { return *this; }
169};
170
171} // namespace sc_core
172
173#endif //__SYSTEMC_EXT_CORE_SC_PORT_HH__
203 virtual const char *kind() const { return "sc_port"; }
204
205 private:
206 // Disabled
207 sc_port(const sc_port<IF, N, P> &) {}
208 sc_port<IF, N, P> &operator = (const sc_port<IF, N, P> &) { return *this; }
209};
210
211} // namespace sc_core
212
213#endif //__SYSTEMC_EXT_CORE_SC_PORT_HH__