using analysis::delayed_analysis_if
;
using analysis::analysis_port
;
// No lt_sctime operator required, since we have operator< defined for
// bool operator<( const sc_time &a , const sc_time &b ) {
// This peq implements a delayed write and has an analysis port
// If you post many transactions to the same time slot, this will result in
// many transactions coming out of the analysis port in a single delta
// If you want event driven semantics, stuff the output of the analysis port
// into an analysis fifo ( if you want to guarantee no losses ) or
// analysis buffer ( if you don't mind losses but you can't be bothered or are
// not able to clear the fifo out ).
// For example, you can arrive at a blocking get interface by doing get on
// an analysis fifo attached to the analysis port shown below
// We could even design a tlm_peq_fifo and/or tlm_peq_buffer with these
public virtual delayed_analysis_if
< T
>
sc_export
< delayed_analysis_if
< T
> > delayed_analysis_export
;
SC_HAS_PROCESS( tlm_peq
);
tlm_peq( sc_module_name nm
) : sc_module( nm
) , ap("ap") {
delayed_analysis_export( *this );
SC_METHOD( wake_up_method
);
int size() const { return m_map
.size(); }
int posted_before( const sc_time
&time
) const {
for( typename multimap
< sc_time
, T
>::const_iterator iter
= m_map
.begin();
if( (*iter
).first
< time
) {
int posted_at( const sc_time
&time
) const {
return m_map
.count( time
);
void write( const T
&transaction
, const sc_time
&time
) {
m_map
.insert( pair_type( time
+ sc_time_stamp() , transaction
) );
m_wake_up
.notify( time
);
typedef pair
<sc_time
,T
> pair_type
;
sc_time now
= sc_time_stamp();
// must be something there, and it must be scheduled for now
assert( m_map
.size() > 0 );
assert( (*(m_map
.begin())).first
== now
);
for( p
= *(m_map
.begin());
m_map
.erase( m_map
.begin() );
if( m_map
.size() == 0 ) {
m_wake_up
.notify( p
.first
- now
);
multimap
< sc_time
, T
> m_map
;