00001 /***************************************************************************** 00002 00003 The following code is derived, directly or indirectly, from the SystemC 00004 source code Copyright (c) 1996-2014 by all Contributors. 00005 All Rights reserved. 00006 00007 The contents of this file are subject to the restrictions and limitations 00008 set forth in the SystemC Open Source License (the "License"); 00009 You may not use this file except in compliance with such restrictions and 00010 limitations. You may obtain instructions on how to receive a copy of the 00011 License at http://www.accellera.org/. Software distributed by Contributors 00012 under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 00013 ANY KIND, either express or implied. See the License for the specific 00014 language governing rights and limitations under the License. 00015 00016 *****************************************************************************/ 00017 00018 /***************************************************************************** 00019 00020 sc_signal_ifs.h -- The sc_signal<T> interface classes. 00021 00022 Original Author: Martin Janssen, Synopsys, Inc., 2001-05-21 00023 00024 CHANGE LOG IS AT THE END OF THE FILE 00025 *****************************************************************************/ 00026 00027 #ifndef SC_SIGNAL_IFS_H 00028 #define SC_SIGNAL_IFS_H 00029 00030 00031 #include "sysc/communication/sc_interface.h" 00032 #include "sysc/communication/sc_writer_policy.h" 00033 00034 00035 namespace sc_dt 00036 { 00037 class sc_logic; 00038 } 00039 00040 namespace sc_core { 00041 00042 class sc_signal_bool_deval; 00043 class sc_signal_logic_deval; 00044 00045 00046 /**************************************************************************/ 00052 template <class T> 00053 class sc_signal_in_if 00054 : virtual public sc_interface 00055 { 00056 public: 00057 00058 // get the value changed event 00059 virtual const sc_event& value_changed_event() const = 0; 00060 00061 00062 // read the current value 00063 virtual const T& read() const = 0; 00064 00065 // get a reference to the current value (for tracing) 00066 virtual const T& get_data_ref() const = 0; 00067 00068 00069 // was there a value changed event? 00070 virtual bool event() const = 0; 00071 00072 protected: 00073 00074 // constructor 00075 00076 sc_signal_in_if() 00077 {} 00078 00079 private: 00080 00081 // disabled 00082 sc_signal_in_if( const sc_signal_in_if<T>& ); 00083 sc_signal_in_if<T>& operator = ( const sc_signal_in_if<T>& ); 00084 }; 00085 00086 00087 /**************************************************************************/ 00093 class sc_reset; 00094 00095 template <> 00096 class sc_signal_in_if<bool> 00097 : virtual public sc_interface 00098 { 00099 friend class sc_reset; 00100 public: 00101 00102 // get the value changed event 00103 virtual const sc_event& value_changed_event() const = 0; 00104 00105 // get the positive edge event 00106 virtual const sc_event& posedge_event() const = 0; 00107 00108 // get the negative edge event 00109 virtual const sc_event& negedge_event() const = 0; 00110 00111 00112 // read the current value 00113 virtual const bool& read() const = 0; 00114 00115 // get a reference to the current value (for tracing) 00116 virtual const bool& get_data_ref() const = 0; 00117 00118 00119 // was there a value changed event? 00120 virtual bool event() const = 0; 00121 00122 // was there a positive edge event? 00123 virtual bool posedge() const = 0; 00124 00125 // was there a negative edge event? 00126 virtual bool negedge() const = 0; 00127 00128 protected: 00129 00130 // constructor 00131 00132 sc_signal_in_if() 00133 {} 00134 00135 private: 00136 00137 // disabled 00138 sc_signal_in_if( const sc_signal_in_if<bool>& ); 00139 sc_signal_in_if<bool>& operator = ( const sc_signal_in_if<bool>& ); 00140 00141 // designate this object as a reset signal 00142 virtual sc_reset* is_reset() const 00143 { return NULL; } 00144 }; 00145 00146 00147 /**************************************************************************/ 00153 template <> 00154 class sc_signal_in_if<sc_dt::sc_logic> 00155 : virtual public sc_interface 00156 { 00157 public: 00158 00159 // get the value changed event 00160 virtual const sc_event& value_changed_event() const = 0; 00161 00162 // get the positive edge event 00163 virtual const sc_event& posedge_event() const = 0; 00164 00165 // get the negative edge event 00166 virtual const sc_event& negedge_event() const = 0; 00167 00168 00169 // read the current value 00170 virtual const sc_dt::sc_logic& read() const = 0; 00171 00172 // get a reference to the current value (for tracing) 00173 virtual const sc_dt::sc_logic& get_data_ref() const = 0; 00174 00175 00176 // was there a value changed event? 00177 virtual bool event() const = 0; 00178 00179 // was there a positive edge event? 00180 virtual bool posedge() const = 0; 00181 00182 // was there a negative edge event? 00183 virtual bool negedge() const = 0; 00184 00185 00186 protected: 00187 00188 // constructor 00189 00190 sc_signal_in_if() 00191 {} 00192 00193 private: 00194 00195 // disabled 00196 sc_signal_in_if( const sc_signal_in_if<sc_dt::sc_logic>& ); 00197 sc_signal_in_if<sc_dt::sc_logic>& operator = ( 00198 const sc_signal_in_if<sc_dt::sc_logic>& ); 00199 }; 00200 00201 00202 /**************************************************************************/ 00207 template< typename T > 00208 class sc_signal_write_if : public virtual sc_interface 00209 { 00210 public: 00211 sc_signal_write_if() {} 00212 // write the new value 00213 virtual void write( const T& ) = 0; 00214 virtual sc_writer_policy get_writer_policy() const 00215 { return SC_DEFAULT_WRITER_POLICY; } 00216 private: 00217 // disabled 00218 sc_signal_write_if( const sc_signal_write_if<T>& ); 00219 sc_signal_write_if<T>& operator = ( const sc_signal_write_if<T>& ); 00220 }; 00221 00222 00223 /**************************************************************************/ 00229 template <class T> 00230 class sc_signal_inout_if 00231 : public sc_signal_in_if<T>, public sc_signal_write_if<T> 00232 { 00233 00234 protected: 00235 00236 // constructor 00237 00238 sc_signal_inout_if() 00239 {} 00240 00241 private: 00242 00243 // disabled 00244 sc_signal_inout_if( const sc_signal_inout_if<T>& ); 00245 sc_signal_inout_if<T>& operator = ( const sc_signal_inout_if<T>& ); 00246 }; 00247 00248 00249 /**************************************************************************/ 00255 // sc_signal_out_if can also be read from, hence no difference with 00256 // sc_signal_inout_if. 00257 00258 #define sc_signal_out_if sc_signal_inout_if 00259 00260 } // namespace sc_core 00261 00262 //$Log: sc_signal_ifs.h,v $ 00263 //Revision 1.4 2011/08/26 20:45:43 acg 00264 // Andy Goodrich: moved the modification log to the end of the file to 00265 // eliminate source line number skew when check-ins are done. 00266 // 00267 //Revision 1.3 2011/02/18 20:23:45 acg 00268 // Andy Goodrich: Copyright update. 00269 // 00270 //Revision 1.2 2010/12/07 19:50:37 acg 00271 // Andy Goodrich: addition of writer policies, courtesy of Philipp Hartmann. 00272 // 00273 //Revision 1.1.1.1 2006/12/15 20:20:04 acg 00274 //SystemC 2.3 00275 // 00276 //Revision 1.4 2006/08/29 23:35:00 acg 00277 // Andy Goodrich: added bind_count() method to allow users to determine which 00278 // ports are connected in before_end_of_elaboration(). 00279 // 00280 //Revision 1.3 2006/04/11 23:11:57 acg 00281 // Andy Goodrich: Changes for reset support that only includes 00282 // sc_cthread_process instances. 00283 // 00284 //Revision 1.2 2006/01/03 23:18:26 acg 00285 //Changed copyright to include 2006. 00286 // 00287 //Revision 1.1.1.1 2005/12/19 23:16:43 acg 00288 //First check in of SystemC 2.1 into its own archive. 00289 // 00290 //Revision 1.10 2005/09/15 23:01:51 acg 00291 //Added std:: prefix to appropriate methods and types to get around 00292 //issues with the Edison Front End. 00293 // 00294 //Revision 1.9 2005/06/29 18:12:12 acg 00295 //Added $log. 00296 // 00297 //Revision 1.8 2005/06/10 22:43:55 acg 00298 //Added CVS change log annotation. 00299 // 00300 00301 #endif 00302 00303 // Taf!