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