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 --- 16 unchanged lines hidden (view full) --- 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * 27 * Authors: Gabe Black 28 */ 29 30#ifndef __SYSTEMC_EXT_CORE_SC_PORT_HH__ 31#define __SYSTEMC_EXT_CORE_SC_PORT_HH__ 32 |
33#include "sc_module.hh" // for sc_gen_unique_name |
34#include "sc_object.hh" 35 36namespace sc_core 37{ 38 39class sc_interface; 40 41enum sc_port_policy 42{ 43 SC_ONE_OR_MORE_BOUND, // Default 44 SC_ZERO_OR_MORE_BOUND, 45 SC_ALL_BOUND 46}; 47 48class sc_port_base : public sc_object 49{ 50 public: |
51 sc_port_base(const char *name, int n, sc_port_policy p) : sc_object(name) 52 {} 53 54 void warn_unimpl(const char *func) const; |
55}; 56 57template <class IF> 58class sc_port_b : public sc_port_base 59{ 60 public: 61 void 62 operator () (IF &) --- 69 unchanged lines hidden (view full) --- 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() {} 139 |
140 explicit sc_port_b(int n, sc_port_policy p) : 141 sc_port_base(sc_gen_unique_name("sc_port"), n, p) 142 {} 143 sc_port_b(const char *name, int n, sc_port_policy p) : 144 sc_port_base(name, n, p) 145 {} 146 virtual ~sc_port_b() {} |
147 |
148 private: 149 // Disabled 150 sc_port_b() {} 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) {} 160 explicit sc_port(const char *name) : sc_port_b<IF>(name, N, P) {} 161 virtual ~sc_port() {} |
162 |
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__ |