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_FIFO_PORTS_H
00054 #define SC_FIFO_PORTS_H
00055
00056
00057 #include "sysc/communication/sc_port.h"
00058 #include "sysc/communication/sc_fifo_ifs.h"
00059
00060 namespace sc_core {
00061
00062
00063
00064
00065
00066
00067
00068 template <class T>
00069 class sc_fifo_in
00070 : public sc_port<sc_fifo_in_if<T>,0,SC_ONE_OR_MORE_BOUND>
00071 {
00072 public:
00073
00074
00075
00076 typedef T data_type;
00077
00078 typedef sc_fifo_in_if<data_type> if_type;
00079 typedef sc_port<if_type,0,SC_ONE_OR_MORE_BOUND> base_type;
00080 typedef sc_fifo_in<data_type> this_type;
00081
00082 typedef if_type in_if_type;
00083 typedef sc_port_b<in_if_type> in_port_type;
00084
00085 public:
00086
00087
00088
00089 sc_fifo_in()
00090 : base_type()
00091 {}
00092
00093 explicit sc_fifo_in( const char* name_ )
00094 : base_type( name_ )
00095 {}
00096
00097 explicit sc_fifo_in( in_if_type& interface_ )
00098 : base_type( interface_ )
00099 {}
00100
00101 sc_fifo_in( const char* name_, in_if_type& interface_ )
00102 : base_type( name_, interface_ )
00103 {}
00104
00105 explicit sc_fifo_in( in_port_type& parent_ )
00106 : base_type( parent_ )
00107 {}
00108
00109 sc_fifo_in( const char* name_, in_port_type& parent_ )
00110 : base_type( name_, parent_ )
00111 {}
00112
00113 sc_fifo_in( this_type& parent_ )
00114 : base_type( parent_ )
00115 {}
00116
00117 sc_fifo_in( const char* name_, this_type& parent_ )
00118 : base_type( name_, parent_ )
00119 {}
00120
00121
00122
00123
00124 virtual ~sc_fifo_in()
00125 {}
00126
00127
00128
00129
00130
00131
00132 void read( data_type& value_ )
00133 { (*this)->read( value_ ); }
00134
00135 data_type read()
00136 { return (*this)->read(); }
00137
00138
00139
00140
00141 bool nb_read( data_type& value_ )
00142 { return (*this)->nb_read( value_ ); }
00143
00144
00145
00146
00147 int num_available() const
00148 { return (*this)->num_available(); }
00149
00150
00151
00152
00153 const sc_event& data_written_event() const
00154 { return (*this)->data_written_event(); }
00155
00156
00157
00158
00159 sc_event_finder& data_written() const
00160 {
00161 return *new sc_event_finder_t<in_if_type>(
00162 *this, &in_if_type::data_written_event );
00163 }
00164
00165 virtual const char* kind() const
00166 { return "sc_fifo_in"; }
00167
00168 private:
00169
00170
00171 sc_fifo_in( const this_type& );
00172 this_type& operator = ( const this_type& );
00173 };
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184 template <class T>
00185 class sc_fifo_out
00186 : public sc_port<sc_fifo_out_if<T>,0,SC_ONE_OR_MORE_BOUND>
00187 {
00188 public:
00189
00190
00191
00192 typedef T data_type;
00193
00194 typedef sc_fifo_out_if<data_type> if_type;
00195 typedef sc_port<if_type,0,SC_ONE_OR_MORE_BOUND> base_type;
00196 typedef sc_fifo_out<data_type> this_type;
00197
00198 typedef if_type out_if_type;
00199 typedef sc_port_b<out_if_type> out_port_type;
00200
00201 public:
00202
00203
00204
00205 sc_fifo_out()
00206 : base_type()
00207 {}
00208
00209 explicit sc_fifo_out( const char* name_ )
00210 : base_type( name_ )
00211 {}
00212
00213 explicit sc_fifo_out( out_if_type& interface_ )
00214 : base_type( interface_ )
00215 {}
00216
00217 sc_fifo_out( const char* name_, out_if_type& interface_ )
00218 : base_type( name_, interface_ )
00219 {}
00220
00221 explicit sc_fifo_out( out_port_type& parent_ )
00222 : base_type( parent_ )
00223 {}
00224
00225 sc_fifo_out( const char* name_, out_port_type& parent_ )
00226 : base_type( name_, parent_ )
00227 {}
00228
00229 sc_fifo_out( this_type& parent_ )
00230 : base_type( parent_ )
00231 {}
00232
00233 sc_fifo_out( const char* name_, this_type& parent_ )
00234 : base_type( name_, parent_ )
00235 {}
00236
00237
00238
00239
00240 virtual ~sc_fifo_out()
00241 {}
00242
00243
00244
00245
00246
00247
00248 void write( const data_type& value_ )
00249 { (*this)->write( value_ ); }
00250
00251
00252
00253
00254 bool nb_write( const data_type& value_ )
00255 { return (*this)->nb_write( value_ ); }
00256
00257
00258
00259
00260 int num_free() const
00261 { return (*this)->num_free(); }
00262
00263
00264
00265
00266 const sc_event& data_read_event() const
00267 { return (*this)->data_read_event(); }
00268
00269
00270
00271
00272 sc_event_finder& data_read() const
00273 {
00274 return *new sc_event_finder_t<out_if_type>(
00275 *this, &out_if_type::data_read_event );
00276 }
00277
00278 virtual const char* kind() const
00279 { return "sc_fifo_out"; }
00280
00281 private:
00282
00283
00284 sc_fifo_out( const this_type& );
00285 this_type& operator = ( const this_type& );
00286 };
00287
00288
00289
00290
00291 }
00292
00293 #endif
00294
00295