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