I have a problem with usinf sc_time_stamp()
I want to do an operation (write the sentence below) just at the time = 20
so:
1t1 = sc_time_stamp();
if (t1.to_string() == "20" ) { cout<<"Current time is "<< t1 << endl; }1
but it does not work.
I have a problem with usinf sc_time_stamp()
I want to do an operation (write the sentence below) just at the time = 20
so:
1t1 = sc_time_stamp();
if (t1.to_string() == "20" ) { cout<<"Current time is "<< t1 << endl; }1
but it does not work.
I don't know that function but... according to this page... the method to_string()
of sc_time
(the type of t1
, I suppose) print non only numeric value of the the time, but also the unit of measure ("s"? "ms"? "ns"?).
So, by example (if the unit of measure is second), could work
if ( t1.to_string() == "20 s" )
cout<<"Current time is "<< t1 << endl;
But I suggest (fixed the time resolution with sc_set_time_resolution()
) to check numerical values, not string values; if I undestand well, something like
if ( t1 == 20 )
cout<<"Current time is "<< t1.to_string() << endl;
p.s.: sorry for my bad English.