Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00013 #ifndef DURING_SEQ_H
00014 #define DURING_SEQ_H
00015
00016 #include "during-if.h"
00017 #include <map>
00018
00019 class sc_during_seq : public sc_during_if {
00020 public:
00021 sc_during_seq();
00022
00023 using sc_during_if::during;
00024 using sc_during_if::extra_time;
00025 using sc_during_if::catch_up;
00026
00027 void extra_time(const sc_core::sc_time & t);
00028
00029 void catch_up(const sc_core::sc_time & t) {
00030 (void)t;
00031 sc_core::sc_process_b *current = sc_core::sc_get_curr_simcontext()
00032 ->get_curr_proc_info()
00033 ->process_handle;
00034 time_map_t::iterator it =
00035 m_duration_map.find(current);
00036 sc_core::sc_time time = it->second;
00037 it->second = sc_core::SC_ZERO_TIME;
00038 sc_core::wait(time);
00039 }
00040
00041 void sc_call(const boost::function<void()> & f);
00042
00043 void during(const sc_core::sc_time & time,
00044 const boost::function<void()> & routine) {
00045 sc_core::sc_process_b *current = sc_core::sc_get_curr_simcontext()
00046 ->get_curr_proc_info()
00047 ->process_handle;
00048 m_duration_map[current] = time;
00049 routine();
00050 sc_core::wait(m_duration_map[current]);
00051 }
00052
00053 virtual ~sc_during_seq() {};
00054
00055 mode get_mode() { return seq; }
00056 private:
00060 typedef std::map<sc_core::sc_process_b *, sc_core::sc_time> time_map_t;
00061 time_map_t m_duration_map;
00062 };
00063
00064
00065
00066 #endif // DURING_SEQ_H