
sc_time_stamp ()
The function sc_time_stamp return's the current simulation time. During elaboration and initialization the function will return a value of zero.
Example : sc_time_stamp()
1 #include
2
3 int sc_main (int argc, char* argv[]) {
4 cout<<"Current time is "<< sc_time_stamp() << endl;
5 sc_start(1);
6 cout<<"Current time is "<< sc_time_stamp() << endl;
7 sc_start(100);
8 cout<<"Current time is "<< sc_time_stamp() << endl;
9 sc_stop();
10 cout<<"Current time is "<< sc_time_stamp() << endl;
11 return 0;// Terminate simulation
12 }
Simulation Output : sc_time_stamp()
Current time is 0 s
Current time is 1 ns
Current time is 101 ns
SystemC: simulation stopped by user.
Current time is 101 ns
Bạn Có Đam Mê Với Vi Mạch hay Nhúng - Bạn Muốn Trau Dồi Thêm Kĩ Năng
Mong Muốn Có Thêm Cơ Hội Trong Công Việc
Và Trở Thành Một Người Có Giá Trị Hơn