65 explicit sc_fifo(
const char* name_,
int size_ = 16 )
86 virtual void read( T& );
106 virtual void write(
const T& );
131 {
write( a );
return *
this; }
137 virtual void print( ::std::ostream& = ::std::cout )
const;
138 virtual void dump( ::std::ostream& = ::std::cout )
const;
140 virtual const char*
kind()
const
141 {
return "sc_fifo"; }
187 const char* if_typename_ )
189 std::string nm( if_typename_ );
194 if( m_reader != 0 ) {
202 if( m_writer != 0 ) {
210 "sc_fifo<T> port not recognized" );
222 while( num_available() == 0 ) {
247 if( num_available() == 0 ) {
264 while( num_free() == 0 ) {
279 if( num_free() == 0 ) {
294 #if defined(DEBUG_SYSTEMC)
296 std::string nm = name();
297 for(
int i = 0; i < m_size; ++ i ) {
298 std::sprintf( buf,
"_%d", i );
310 if( m_free != m_size ) {
313 os << m_buf[i] << ::std::endl;
314 i = ( i + 1 ) % m_size;
315 }
while( i != m_wi );
324 os <<
"name = " << name() << ::std::endl;
325 if( m_free != m_size ) {
329 os <<
"value[" << i <<
"] = " << m_buf[i] << ::std::endl;
330 i = ( i + 1 ) % m_size;
332 }
while( i != m_wi );
342 if( m_num_read > 0 ) {
346 if( m_num_written > 0 ) {
350 m_num_readable = m_size - m_free;
383 m_buf =
new T[m_size];
398 m_wi = ( m_wi + 1 ) % m_size;
408 if( m_free == m_size ) {
413 m_ri = ( m_ri + 1 ) % m_size;
424 operator << ( ::std::ostream& os, const sc_fifo<T>& a )
void wait(int, sc_simcontext *)
sc_fifo(const char *name_, int size_=16)
virtual void write(const T &)
virtual const char * kind() const
virtual void register_port(sc_port_base &, const char *)
virtual bool nb_write(const T &)
virtual const sc_event & data_read_event() const
sc_event m_data_written_event
sc_fifo< T > & operator=(const T &a)
const char * sc_gen_unique_name(const char *, bool preserve_first)
virtual int num_available() const
sc_event m_data_read_event
virtual void print(::std::ostream &=::std::cout) const
virtual bool nb_read(T &)
bool buf_write(const T &)
const sc_time SC_ZERO_TIME
#define SC_REPORT_ERROR(msg_type, msg)
virtual const sc_event & data_written_event() const
void sc_trace(sc_trace_file *tf, const sc_in< T > &port, const std::string &name)
virtual int num_free() const
#define SC_KERNEL_EVENT_PREFIX
virtual void dump(::std::ostream &=::std::cout) const
void trace(sc_trace_file *tf) const