#include <sc_fifo.h>
Public メソッド | |
sc_fifo (int size_=16) | |
sc_fifo (const char *name_, int size_=16) | |
virtual | ~sc_fifo () |
virtual void | register_port (sc_port_base &, const char *) |
virtual void | read (T &) |
virtual T | read () |
virtual bool | nb_read (T &) |
virtual int | num_available () const |
virtual const sc_event & | data_written_event () const |
virtual void | write (const T &) |
virtual bool | nb_write (const T &) |
virtual int | num_free () const |
virtual const sc_event & | data_read_event () const |
operator T () | |
sc_fifo< T > & | operator= (const T &a) |
void | trace (sc_trace_file *tf) const |
virtual void | print (::std::ostream &=::std::cout) const |
virtual void | dump (::std::ostream &=::std::cout) const |
virtual const char * | kind () const |
Protected メソッド | |
virtual void | update () |
void | init (int) |
void | buf_init (int) |
bool | buf_write (const T &) |
bool | buf_read (T &) |
Protected 変数 | |
int | m_size |
T * | m_buf |
int | m_free |
int | m_ri |
int | m_wi |
sc_port_base * | m_reader |
sc_port_base * | m_writer |
int | m_num_readable |
int | m_num_read |
int | m_num_written |
sc_event | m_data_read_event |
sc_event | m_data_written_event |
Private メソッド | |
sc_fifo (const sc_fifo< T > &) | |
sc_fifo & | operator= (const sc_fifo< T > &) |
sc_core::sc_fifo< T >::sc_fifo | ( | int | size_ = 16 |
) | [inline, explicit] |
sc_core::sc_fifo< T >::sc_fifo | ( | const char * | name_, | |
int | size_ = 16 | |||
) | [inline, explicit] |
virtual sc_core::sc_fifo< T >::~sc_fifo | ( | ) | [inline, virtual] |
sc_core::sc_fifo< T >::sc_fifo | ( | const sc_fifo< T > & | ) | [private] |
void sc_core::sc_fifo< T >::register_port | ( | sc_port_base & | port_, | |
const char * | if_typename_ | |||
) | [inline, virtual] |
sc_core::sc_interfaceを再定義しています。
00215 { 00216 std::string nm( if_typename_ ); 00217 if( nm == typeid( sc_fifo_in_if<T> ).name() ) { 00218 // only one reader can be connected 00219 if( m_reader != 0 ) { 00220 SC_REPORT_ERROR( SC_ID_MORE_THAN_ONE_FIFO_READER_, 0 ); 00221 } 00222 m_reader = &port_; 00223 } else { // nm == typeid( sc_fifo_out_if<T> ).name() 00224 // only one writer can be connected 00225 if( m_writer != 0 ) { 00226 SC_REPORT_ERROR( SC_ID_MORE_THAN_ONE_FIFO_WRITER_, 0 ); 00227 } 00228 m_writer = &port_; 00229 } 00230 }
void sc_core::sc_fifo< T >::read | ( | T & | val_ | ) | [inline, virtual] |
sc_core::sc_fifo_blocking_in_if< T >を実装しています。
00239 { 00240 while( num_available() == 0 ) { 00241 sc_core::wait( m_data_written_event ); 00242 } 00243 m_num_read ++; 00244 buf_read( val_ ); 00245 request_update(); 00246 }
T sc_core::sc_fifo< T >::read | ( | ) | [inline, virtual] |
sc_core::sc_fifo_blocking_in_if< T >を実装しています。
00252 { 00253 T tmp; 00254 read( tmp ); 00255 return tmp; 00256 }
bool sc_core::sc_fifo< T >::nb_read | ( | T & | val_ | ) | [inline, virtual] |
sc_core::sc_fifo_nonblocking_in_if< T >を実装しています。
00264 { 00265 if( num_available() == 0 ) { 00266 return false; 00267 } 00268 m_num_read ++; 00269 buf_read( val_ ); 00270 request_update(); 00271 return true; 00272 }
virtual int sc_core::sc_fifo< T >::num_available | ( | ) | const [inline, virtual] |
virtual const sc_event& sc_core::sc_fifo< T >::data_written_event | ( | ) | const [inline, virtual] |
void sc_core::sc_fifo< T >::write | ( | const T & | val_ | ) | [inline, virtual] |
sc_core::sc_fifo_blocking_out_if< T >を実装しています。
00281 { 00282 while( num_free() == 0 ) { 00283 sc_core::wait( m_data_read_event ); 00284 } 00285 m_num_written ++; 00286 buf_write( val_ ); 00287 request_update(); 00288 }
bool sc_core::sc_fifo< T >::nb_write | ( | const T & | val_ | ) | [inline, virtual] |
sc_core::sc_fifo_nonblocking_out_if< T >を実装しています。
00296 { 00297 if( num_free() == 0 ) { 00298 return false; 00299 } 00300 m_num_written ++; 00301 buf_write( val_ ); 00302 request_update(); 00303 return true; 00304 }
virtual int sc_core::sc_fifo< T >::num_free | ( | ) | const [inline, virtual] |
virtual const sc_event& sc_core::sc_fifo< T >::data_read_event | ( | ) | const [inline, virtual] |
sc_core::sc_fifo< T >::operator T | ( | ) | [inline] |
sc_fifo<T>& sc_core::sc_fifo< T >::operator= | ( | const T & | a | ) | [inline] |
void sc_core::sc_fifo< T >::trace | ( | sc_trace_file * | tf | ) | const [inline, virtual] |
void sc_core::sc_fifo< T >::print | ( | ::std::ostream & | os = ::std::cout |
) | const [inline, virtual] |
void sc_core::sc_fifo< T >::dump | ( | ::std::ostream & | os = ::std::cout |
) | const [inline, virtual] |
sc_core::sc_objectを再定義しています。
00341 { 00342 os << "name = " << name() << ::std::endl; 00343 if( m_free != m_size ) { 00344 int i = m_ri; 00345 int j = 0; 00346 do { 00347 os << "value[" << i << "] = " << m_buf[i] << ::std::endl; 00348 i = ( i + 1 ) % m_size; 00349 j ++; 00350 } while( i != m_wi ); 00351 } 00352 }
virtual const char* sc_core::sc_fifo< T >::kind | ( | ) | const [inline, virtual] |
void sc_core::sc_fifo< T >::update | ( | ) | [inline, protected, virtual] |
sc_core::sc_prim_channelを再定義しています。
00359 { 00360 if( m_num_read > 0 ) { 00361 m_data_read_event.notify(SC_ZERO_TIME); 00362 } 00363 00364 if( m_num_written > 0 ) { 00365 m_data_written_event.notify(SC_ZERO_TIME); 00366 } 00367 00368 m_num_readable = m_size - m_free; 00369 m_num_read = 0; 00370 m_num_written = 0; 00371 }
void sc_core::sc_fifo< T >::init | ( | int | size_ | ) | [inline, protected] |
00380 { 00381 buf_init( size_ ); 00382 00383 m_reader = 0; 00384 m_writer = 0; 00385 00386 m_num_readable = 0; 00387 m_num_read = 0; 00388 m_num_written = 0; 00389 }
void sc_core::sc_fifo< T >::buf_init | ( | int | size_ | ) | [inline, protected] |
bool sc_core::sc_fifo< T >::buf_write | ( | const T & | val_ | ) | [inline, protected] |
bool sc_core::sc_fifo< T >::buf_read | ( | T & | val_ | ) | [inline, protected] |
sc_fifo& sc_core::sc_fifo< T >::operator= | ( | const sc_fifo< T > & | ) | [private] |
int sc_core::sc_fifo< T >::m_size [protected] |
T* sc_core::sc_fifo< T >::m_buf [protected] |
int sc_core::sc_fifo< T >::m_free [protected] |
int sc_core::sc_fifo< T >::m_ri [protected] |
int sc_core::sc_fifo< T >::m_wi [protected] |
sc_port_base* sc_core::sc_fifo< T >::m_reader [protected] |
sc_port_base* sc_core::sc_fifo< T >::m_writer [protected] |
int sc_core::sc_fifo< T >::m_num_readable [protected] |
int sc_core::sc_fifo< T >::m_num_read [protected] |
int sc_core::sc_fifo< T >::m_num_written [protected] |
sc_event sc_core::sc_fifo< T >::m_data_read_event [protected] |
sc_event sc_core::sc_fifo< T >::m_data_written_event [protected] |