00001
00002
00003
00004
00005
00006
00013 #include <systemc>
00014 #include "during.h"
00015
00016 using namespace std;
00017 using namespace sc_core;
00018
00019 SC_MODULE(A), sc_during
00020 {
00021 void first() {
00022 L_COUT << "A: first: " << sc_time_stamp() << endl;
00023 during(10, SC_NS, bind_this(&A::f));
00024 L_COUT << "// TEST-EXPECT: A: first after during: 20 ns" << endl;
00025 L_COUT << "A: first after during: " << sc_time_stamp() << endl;
00026 }
00027
00028 void second() {
00029 wait(5, SC_NS);
00030 L_COUT << "A: second: " << sc_time_stamp() << endl;
00031 during(1, SC_NS, bind_this(&A::g));
00032 L_COUT << "// TEST-EXPECT: A: second after during: 6 ns" << endl;
00033 L_COUT << "A: second after during: " << sc_time_stamp() << endl;
00034 }
00035
00036 SC_CTOR(A) {
00037 SC_THREAD(first);
00038 SC_THREAD(second);
00039 }
00040
00041 void f(void) {
00042 L_COUT << "// TEST-IGNORE: A: f1: " << sc_time_stamp() << endl;
00043 extra_time(10, SC_NS);
00044
00045 L_COUT << "// TEST-IGNORE: A: f2: " << sc_time_stamp() << endl;
00046 };
00047
00048 void g(void) {
00049 L_COUT << "// TEST-IGNORE: A: g1: " << sc_time_stamp() << endl;
00050 catch_up();
00051 L_COUT << "A: g2: " << sc_time_stamp() << endl;
00052 }
00053 };
00054
00055 int sc_main(int argc, char *argv[])
00056 {
00057 (void)argc; (void)argv;
00058 A a("a");
00059 {
00060 measure_time t;
00061 sc_start();
00062 }
00063
00064 return 0;
00065 }