Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00014 #include <systemc>
00015 #include "during.h"
00016 #include <unistd.h>
00017 #include "utils/io-lock.h"
00018
00019 using namespace std;
00020 using namespace sc_core;
00021
00022 SC_MODULE(A), sc_during
00023 {
00024
00025 int x;
00026 void compute() {
00027 L_COUT << "A 1: " << sc_time_stamp() << endl;
00028 wait(10, SC_NS);
00029 L_COUT << "A 2: " << sc_time_stamp() << endl;
00030 during(10, SC_NS, boost::bind(&A::f));
00031 L_COUT << "A 3: " << sc_time_stamp() << endl;
00032 }
00033
00034 SC_CTOR(A) {
00035 SC_THREAD(compute);
00036 }
00037
00038 static void f(void) {
00039 L_COUT << "A.f()" << endl;
00040 };
00041 };
00042
00043 SC_MODULE(B), sc_during
00044 {
00045
00046 int x;
00047 void compute() {
00048 wait(1, SC_NS);
00049 L_COUT << "B 1: " << sc_time_stamp() << endl;
00050 during(8, SC_NS, boost::bind(&B::f));
00051 L_COUT << "B 2: " << sc_time_stamp() << endl;
00052
00053
00054 usleep(400000);
00055 L_COUT << "B 3: " << sc_time_stamp() << endl;
00056 wait(14, SC_NS);
00057 L_COUT << "B 4: " << sc_time_stamp() << endl;
00058 }
00059
00060 SC_CTOR(B) {
00061 SC_THREAD(compute);
00062 }
00063
00064 static void f(void) {
00065 L_COUT << "B.f() start" << endl;
00066
00067
00068
00069 usleep(400000);
00070 L_COUT << "B.f() end" << endl;
00071 };
00072 };
00073
00074 int sc_main(int argc, char *argv[])
00075 {
00076 (void)argc; (void)argv;
00077 A a("a");
00078 B b("b");
00079 {
00080 measure_time t;
00081 sc_start();
00082 }
00083
00084 return 0;
00085 }