本文整理汇总了C++中sc_event类的典型用法代码示例。如果您正苦于以下问题:C++ sc_event类的具体用法?C++ sc_event怎么用?C++ sc_event使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sc_event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_static_event
//------------------------------------------------------------------------------
//"sc_process_b::add_static_event"
//
// This method adds an event to the list of static events, and sets the
// event up to call back this process when it fires.
//------------------------------------------------------------------------------
void sc_process_b::add_static_event( const sc_event& e )
{
sc_method_handle method_h; // This process as a method.
sc_thread_handle thread_h; // This process as a thread.
// CHECK TO SEE IF WE ARE ALREADY REGISTERED WITH THE EVENT:
for( int i = m_static_events.size() - 1; i >= 0; -- i ) {
if( &e == m_static_events[i] ) {
return;
}
}
// REMEMBER THE EVENT AND THEN REGISTER OUR OBJECT INSTANCE WITH IT:
m_static_events.push_back( &e );
switch ( m_process_kind )
{
case SC_THREAD_PROC_:
case SC_CTHREAD_PROC_:
thread_h = SCAST<sc_thread_handle>( this );
e.add_static( thread_h );
break;
case SC_METHOD_PROC_:
method_h = SCAST<sc_method_handle>( this );
e.add_static( method_h );
break;
default:
assert( false );
break;
}
}
示例2: round_robin
int round_robin(const char *str, sc_event& receive, sc_event& send, int cnt)
{
while (--cnt >= 0)
{
wait(receive);
cout << "Round robin thread " << str <<
" at time " << sc_time_stamp() << endl;
wait(10, SC_NS);
send.notify();
}
return 0;
}
示例3: control
void control()
{
wait(SC_ZERO_TIME);
count = 1;
ev.notify();
wait(10, SC_NS);
count = 2;
ev.notify();
t.disable();
wait(SC_ZERO_TIME);
count = 3;
ev.notify();
wait(SC_ZERO_TIME);
count = 4;
t.enable();
ev.notify();
wait(10, SC_NS);
count = 5;
t.disable();
t.reset();
wait(10, SC_NS);
count = 6;
t.reset();
wait(10, SC_NS);
sc_stop();
}
示例4: ctrl
void ctrl()
{
count = 1;
ph = sc_spawn(sc_bind(&Top::parent_proc, this));
wait(10, SC_NS);
count = 2;
ph.reset(SC_INCLUDE_DESCENDANTS);
wait(10, SC_NS);
count = 3;
ev.notify();
wait(10, SC_NS);
count = 4;
ph.suspend(SC_INCLUDE_DESCENDANTS);
wait(10, SC_NS);
count = 5;
ev.notify();
wait(10, SC_NS);
count = 6;
ph.resume(SC_INCLUDE_DESCENDANTS);
wait(10, SC_NS);
count = 7;
ph.kill(SC_INCLUDE_DESCENDANTS);
wait(10, SC_NS);
}
示例5: ctrl
void ctrl()
{
ts3.resume();
wait(10, SC_NS);
ts1.resume();
ev.notify();
wait(10, SC_NS);
ts2.resume();
tr2.sync_reset_off();
tr4.sync_reset_off();
wait(10, SC_NS);
td2.enable();
wait(10, SC_NS);
ev.notify();
wait(10, SC_NS);
ev.notify();
td2.disable();
wait(10, SC_NS);
td4.enable();
ts4.resume();
ev.notify();
}
示例6: schedule_events_while_paused
void schedule_events_while_paused()
{
sig4.write(4);
immed_event.notify();
delta_event.notify(SC_ZERO_TIME);
// Should be able to instantiate an sc_object while paused
mut = new sc_mutex("mut");
sem = new sc_semaphore("sem", 1);
}
示例7: f
void f()
{
while(true)
{
e2.notify(sc_time(1,sc_ns));
wait(e2);
e3.notify(sc_time(10,sc_ns));
wait(e3);
}
}
示例8: getmsg
void getmsg() {
if (m<max) {
wait(msg_event);
msg = (++m) * 11 + 5;
msg_event.notify();
}
}
示例9: write
virtual void write(sc_uint<8> data)
{
if (data == 255)
eop.notify(0, SC_MS);
else
write_buf.write(data);
}
示例10: topEntry
void topEntry() {
while(true) {
x = x*2;
if (x>5){
wait(1, SC_NS);
}
v++;
wait(1, SC_NS);
w++;
y = y + 1;
for (int i = 0; i<10; i++) {
x++;
if (x>3){
x = y-2;
wait(1, SC_NS);
}
}
x = x *2;
oev.notify(1, SC_NS);
wait(ev);
y = x-2;
f(x, y);
out_port.write(y);
wait(4, SC_NS);
}
}
示例11:
void f3() {
while(true) {
global = 4;
wait(15, SC_NS);
e1.notify();
}
}
示例12: send_byte
void send_byte()
{
out_port->write(x);
send.notify(5, SC_NS);
wait();
// cout << "send " << x << '\n';
}
示例13: gen
void gen()
{
for (;;)
{
wait(10, SC_NS);
ev.notify();
}
}
示例14: ticker
void ticker()
{
for (;;)
{
wait(10, SC_NS);
ev.notify();
}
}
示例15: before_end_of_elaboration
void before_end_of_elaboration()
{
cout << "sc_get_status() == " << hex << sc_get_status() << " before_end_of_elaboration in " << name() << endl;
sc_assert( sc_get_status() == SC_BEFORE_END_OF_ELABORATION );
sc_assert( sc_is_running() == false );
sig1.write(1);
timed_event.notify(1234, SC_NS);
sc_pause(); // Should be ignored
}