00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 #ifndef SC_SIGNAL_RV_PORTS_H
00054 #define SC_SIGNAL_RV_PORTS_H
00055
00056
00057 #include <cstdio>
00058
00059 #include "sysc/communication/sc_communication_ids.h"
00060 #include "sysc/communication/sc_signal_ports.h"
00061 #include "sysc/communication/sc_signal_rv.h"
00062 #include "sysc/datatypes/bit/sc_lv.h"
00063
00064 namespace sc_core {
00065
00066
00067
00068
00069
00070
00071
00072 template <int W>
00073 class sc_in_rv
00074 : public sc_in<sc_dt::sc_lv<W> >
00075 {
00076 public:
00077
00078
00079
00080 typedef sc_dt::sc_lv<W> data_type;
00081
00082 typedef sc_in_rv<W> this_type;
00083 typedef sc_in<data_type> base_type;
00084
00085 typedef typename base_type::in_if_type in_if_type;
00086 typedef typename base_type::in_port_type in_port_type;
00087 typedef typename base_type::inout_port_type inout_port_type;
00088
00089 public:
00090
00091
00092
00093 sc_in_rv()
00094 : base_type()
00095 {}
00096
00097 explicit sc_in_rv( const char* name_ )
00098 : base_type( name_ )
00099 {}
00100
00101 explicit sc_in_rv( const in_if_type& interface_ )
00102 : base_type( interface_ )
00103 {}
00104
00105 sc_in_rv( const char* name_, const in_if_type& interface_ )
00106 : base_type( name_, interface_ )
00107 {}
00108
00109 explicit sc_in_rv( in_port_type& parent_ )
00110 : base_type( parent_ )
00111 {}
00112
00113 sc_in_rv( const char* name_, in_port_type& parent_ )
00114 : base_type( name_, parent_ )
00115 {}
00116
00117 explicit sc_in_rv( inout_port_type& parent_ )
00118 : base_type( parent_ )
00119 {}
00120
00121 sc_in_rv( const char* name_, inout_port_type& parent_ )
00122 : base_type( name_, parent_ )
00123 {}
00124
00125 sc_in_rv( this_type& parent_ )
00126 : base_type( parent_ )
00127 {}
00128
00129 sc_in_rv( const char* name_, this_type& parent_ )
00130 : base_type( name_, parent_ )
00131 {}
00132
00133
00134
00135
00136 virtual ~sc_in_rv()
00137 {}
00138
00139
00140
00141
00142
00143
00144 virtual void end_of_elaboration();
00145
00146 virtual const char* kind() const
00147 { return "sc_in_rv"; }
00148
00149 private:
00150
00151
00152 sc_in_rv( const this_type& );
00153 this_type& operator = ( const this_type& );
00154 };
00155
00156
00157
00158
00159
00160
00161
00162 template <int W>
00163 void
00164 sc_in_rv<W>::end_of_elaboration()
00165 {
00166 base_type::end_of_elaboration();
00167
00168 if( DCAST<sc_signal_rv<W>*>( this->get_interface() ) == 0 ) {
00169 char msg[BUFSIZ];
00170 std::sprintf( msg, "%s (%s)", this->name(), kind() );
00171 SC_REPORT_ERROR( SC_ID_RESOLVED_PORT_NOT_BOUND_, msg );
00172 }
00173 }
00174
00175
00176
00177
00178
00179
00180
00181
00182 template <int W>
00183 class sc_inout_rv
00184 : public sc_inout<sc_dt::sc_lv<W> >
00185 {
00186 public:
00187
00188
00189
00190 typedef sc_dt::sc_lv<W> data_type;
00191
00192 typedef sc_inout_rv<W> this_type;
00193 typedef sc_inout<data_type> base_type;
00194
00195 typedef typename base_type::in_if_type in_if_type;
00196 typedef typename base_type::in_port_type in_port_type;
00197 typedef typename base_type::inout_if_type inout_if_type;
00198 typedef typename base_type::inout_port_type inout_port_type;
00199
00200 public:
00201
00202
00203
00204 sc_inout_rv()
00205 : base_type()
00206 {}
00207
00208 explicit sc_inout_rv( const char* name_ )
00209 : base_type( name_ )
00210 {}
00211
00212 explicit sc_inout_rv( inout_if_type& interface_ )
00213 : base_type( interface_ )
00214 {}
00215
00216 sc_inout_rv( const char* name_, inout_if_type& interface_ )
00217 : base_type( name_, interface_ )
00218 {}
00219
00220 explicit sc_inout_rv( inout_port_type& parent_ )
00221 : base_type( parent_ )
00222 {}
00223
00224 sc_inout_rv( const char* name_, inout_port_type& parent_ )
00225 : base_type( name_, parent_ )
00226 {}
00227
00228 sc_inout_rv( this_type& parent_ )
00229 : base_type( parent_ )
00230 {}
00231
00232 sc_inout_rv( const char* name_, this_type& parent_ )
00233 : base_type( name_, parent_ )
00234 {}
00235
00236
00237
00238
00239 virtual ~sc_inout_rv()
00240 {}
00241
00242
00243
00244
00245 this_type& operator = ( const data_type& value_ )
00246 { (*this)->write( value_ ); return *this; }
00247
00248 this_type& operator = ( const in_if_type& interface_ )
00249 { (*this)->write( interface_.read() ); return *this; }
00250
00251 this_type& operator = ( const in_port_type& port_ )
00252 { (*this)->write( port_->read() ); return *this; }
00253
00254 this_type& operator = ( const inout_port_type& port_ )
00255 { (*this)->write( port_->read() ); return *this; }
00256
00257 this_type& operator = ( const this_type& port_ )
00258 { (*this)->write( port_->read() ); return *this; }
00259
00260
00261
00262
00263
00264
00265 virtual void end_of_elaboration();
00266
00267 virtual const char* kind() const
00268 { return "sc_inout_rv"; }
00269
00270 private:
00271
00272
00273 sc_inout_rv( const this_type& );
00274 };
00275
00276
00277
00278
00279
00280
00281
00282 template <int W>
00283 void
00284 sc_inout_rv<W>::end_of_elaboration()
00285 {
00286 base_type::end_of_elaboration();
00287
00288 if( DCAST<sc_signal_rv<W>*>( this->get_interface() ) == 0 ) {
00289 char msg[BUFSIZ];
00290 std::sprintf( msg, "%s (%s)", this->name(), kind() );
00291 SC_REPORT_ERROR( SC_ID_RESOLVED_PORT_NOT_BOUND_, msg );
00292 }
00293 }
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306 template <int W>
00307 class sc_out_rv
00308 : public sc_inout_rv<W>
00309 {
00310 public:
00311
00312
00313
00314 typedef sc_out_rv<W> this_type;
00315 typedef sc_inout_rv<W> base_type;
00316
00317 typedef typename base_type::data_type data_type;
00318
00319 typedef typename base_type::in_if_type in_if_type;
00320 typedef typename base_type::in_port_type in_port_type;
00321 typedef typename base_type::inout_if_type inout_if_type;
00322 typedef typename base_type::inout_port_type inout_port_type;
00323
00324 public:
00325
00326
00327
00328 sc_out_rv()
00329 : base_type()
00330 {}
00331
00332 explicit sc_out_rv( const char* name_ )
00333 : base_type( name_ )
00334 {}
00335
00336 explicit sc_out_rv( inout_if_type& interface_ )
00337 : base_type( interface_ )
00338 {}
00339
00340 sc_out_rv( const char* name_, inout_if_type& interface_ )
00341 : base_type( name_, interface_ )
00342 {}
00343
00344 explicit sc_out_rv( inout_port_type& parent_ )
00345 : base_type( parent_ )
00346 {}
00347
00348 sc_out_rv( const char* name_, inout_port_type& parent_ )
00349 : base_type( name_, parent_ )
00350 {}
00351
00352 sc_out_rv( this_type& parent_ )
00353 : base_type( parent_ )
00354 {}
00355
00356 sc_out_rv( const char* name_, this_type& parent_ )
00357 : base_type( name_, parent_ )
00358 {}
00359
00360
00361
00362
00363 virtual ~sc_out_rv()
00364 {}
00365
00366
00367
00368
00369 this_type& operator = ( const data_type& value_ )
00370 { (*this)->write( value_ ); return *this; }
00371
00372 this_type& operator = ( const in_if_type& interface_ )
00373 { (*this)->write( interface_.read() ); return *this; }
00374
00375 this_type& operator = ( const in_port_type& port_ )
00376 { (*this)->write( port_->read() ); return *this; }
00377
00378 this_type& operator = ( const inout_port_type& port_ )
00379 { (*this)->write( port_->read() ); return *this; }
00380
00381 this_type& operator = ( const this_type& port_ )
00382 { (*this)->write( port_->read() ); return *this; }
00383
00384 virtual const char* kind() const
00385 { return "sc_out_rv"; }
00386
00387 private:
00388
00389
00390 sc_out_rv( const this_type& );
00391 };
00392
00393
00394
00395
00396 }
00397
00398 #endif
00399
00400