Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00014 #include <systemc>
00015 #include "during.h"
00016 #include <boost/bind.hpp>
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 void compute() {
00025 L_COUT << "A 1: " << sc_time_stamp() << endl;
00026 wait(10, SC_NS);
00027 L_COUT << "A 2: " << sc_time_stamp() << endl;
00028 during(10, SC_NS, boost::bind(&A::f, this));
00029 L_COUT << "A 3: " << sc_time_stamp() << endl;
00030 }
00031
00032 void g() {
00033 L_COUT << "A.g()" << endl;
00034 }
00035
00036 SC_CTOR(A) {
00037 SC_THREAD(compute);
00038 }
00039
00040 void A_wait(sc_time t) {
00041 sc_module::wait(t);
00042 }
00043
00044 void f() {
00045 L_COUT << "A.f()" << endl;
00046 sc_call(boost::bind(&A::g, this));
00047 sc_call(boost::bind(&A::A_wait, this, sc_time(10, SC_NS)));
00048 L_COUT << "A.f() end" << endl;
00049 };
00050 };
00051
00052 int sc_main(int argc, char *argv[])
00053 {
00054 (void)argc; (void)argv;
00055 A a("a");
00056 L_COUT << "elaboration done, start simulation" << endl;
00057 {
00058 measure_time t;
00059 sc_start();
00060 }
00061 L_COUT << "Simulation terminated. Terminating threads" << endl;
00062 return 0;
00063 }