00001
00002
00003
00004
00005
00006
00013 #include <systemc>
00014 #include "during.h"
00015 #include <boost/bind.hpp>
00016 #include "utils/io-lock.h"
00017
00018 using namespace std;
00019 using namespace sc_core;
00020
00021 SC_MODULE(A), sc_during
00022 {
00023 void compute() {
00024 L_COUT << name() << ": before task" << endl;
00025 during(5, SC_MS, bind_this(&A::f));
00026 L_COUT << name() << ": after task" << endl;
00027 }
00028
00029 SC_CTOR(A) {
00030 SC_THREAD(compute);
00031 }
00032
00033 void f() {
00034 while(true) {
00035 extra_time(10, SC_MS);
00036 catch_up();
00037
00038
00039
00040
00041
00042 L_COUT << "extra_time(1, SC_MS)" << endl;
00043 }
00044 };
00045 };
00046
00047 int sc_main(int argc, char *argv[])
00048 {
00049 (void)argc; (void)argv;
00050 A a("a");
00051 A b("b");
00052 L_COUT << "elaboration done, start simulation" << endl;
00053 {
00054 measure_time t;
00055 sc_start(30, SC_MS);
00056 }
00057 L_COUT << "Simulation terminated. Terminating threads" << endl;
00058 return 0;
00059 }