65 explicit sc_fifo(
const char* name_,
int size_ = 16 )
95 assert(
false &&
"Should not be called");
106 assert(
false &&
"Should not be called");
138 virtual void write(
const T&,
int );
141 assert(
false &&
"Should not be called");
180 write( a, -5 );
return *
this; }
186 virtual void print( ::std::ostream& = ::std::cout )
const;
187 virtual void dump( ::std::ostream& = ::std::cout )
const;
189 virtual const char*
kind()
const
190 {
return "sc_fifo"; }
236 const char* if_typename_ )
238 std::string nm( if_typename_ );
243 if( m_reader != 0 ) {
251 if( m_writer != 0 ) {
259 "sc_fifo<T> port not recognized" );
276 while( num_available() == 0 ) {
306 if( num_available() == 0 ) {
329 while( num_free() == 0 ) {
348 if( num_free() == 0 ) {
365 #if defined(DEBUG_SYSTEMC)
367 std::string nm = name();
368 for(
int i = 0; i < m_size; ++ i ) {
369 std::sprintf( buf,
"_%d", i );
384 if( m_free != m_size ) {
387 os << m_buf[i] << ::std::endl;
388 i = ( i + 1 ) % m_size;
389 }
while( i != m_wi );
402 os <<
"name = " << name() << ::std::endl;
403 if( m_free != m_size ) {
407 os <<
"value[" << i <<
"] = " << m_buf[i] << ::std::endl;
408 i = ( i + 1 ) % m_size;
410 }
while( i != m_wi );
422 if( m_num_read > 0 ) {
426 if( m_num_written > 0 ) {
430 m_num_readable = m_size - m_free;
465 m_buf =
new T[m_size];
481 m_wi = ( m_wi + 1 ) % m_size;
492 if( m_free == m_size ) {
497 m_ri = ( m_ri + 1 ) % m_size;
508 operator << ( ::std::ostream& os, const sc_fifo<T>& a )
The sc_fifo<T> blocking output interface class.
#define SC_REPORT_ERROR(msg_type, msg)
virtual const sc_event & data_read_event() const
CHNL_MTX_TYPE_ m_mutex
A mutex to protect concurrent communication.
The sc_fifo<T> primitive channel class.
virtual const char * kind() const
virtual void write(const T &, int)
A new parameter segment ID is added for the out-of-order simulation.
void wait(int, sc_simcontext *)
virtual void register_port(sc_port_base &, const char *)
virtual int num_available() const
virtual bool nb_write(const T &)
sc_fifo(const char *name_, int size_=16)
sc_event m_data_written_event
sc_fifo< T > & operator=(const T &a)
This operator is not supported by the out-of-order simulation in the current release.
const char * sc_gen_unique_name(const char *, bool preserve_first)
sc_event m_data_read_event
The sc_fifo<T> input blocking interface class.
virtual bool nb_read(T &)
#define SC_KERNEL_EVENT_PREFIX
virtual void print(::std::ostream &=::std::cout) const
Abstract base class for class sc_port_b.
The sc_fifo<T> input interface class.
virtual int num_free() const
virtual const sc_event & data_written_event() const
const sc_time SC_ZERO_TIME
virtual void update()
The update method (does nothing by default).
bool buf_write(const T &)
void sc_trace(sc_trace_file *tf, const sc_in< T > &port, const std::string &name)
The sc_fifo<T> output interface class.
virtual void dump(::std::ostream &=::std::cout) const
The chnl_scoped_lock class to lock (and automatically release) a mutex.
segment id currently only used for sc_fifo::read(...) as a bug fix
Abstract base class of all primitive channel classes.
void trace(sc_trace_file *tf) const