1 #ifndef SCD_SIMULATOR_H
2 #define SCD_SIMULATOR_H
7 #include "scd_sock_poller.h"
8 #include "scd_chan_man.h"
9 #include "scd_cont_man.h"
12 /* forward declaration */
14 class scd_cont_man_if;
18 * Simulator to run a distributed SystemC simulation. First the
19 * channel with remote endpoints, the slave controllers and the
20 * master controller have to be registered with the channel manager
21 * and the control manager. Second the simulation has to be
22 * initialized and third the simulation can be started.
29 * Constructor. Binds the simulator to the specified TCP port
30 * only on the specified network interface.
31 * \param name the name of this simulator
32 * \param loc_host IP or domain name of the interface to bind to
33 * \param loc_port TCP port to bind to
34 * \bool master SCD_MASTER if this simulator is the master, else
37 scd_simulator(const std::string& name, const std::string &loc_host,
38 uint16_t loc_port, bool master);
41 * Constructor. Binds the simulator to the specified TCP port on all
42 * available network interfaces.
43 * \param name the name of this simulator
44 * \param loc_port TCP port to bind to
45 * \bool master SCD_MASTER if this simulator is the master, else
48 scd_simulator(const std::string& name, uint16_t loc_port, bool master);
50 virtual ~scd_simulator();
54 * Returns the name of this simulator.
56 const std::string& get_name() const;
59 * Returns the socket poller of this simulation.
61 scd_sock_poller& get_poller();
64 * Returns the channel manager of this simulation.
66 scd_chan_man& get_chan_man();
69 * Returns the control manager of this simulation.
71 scd_cont_man& get_cont_man();
74 * Initializes the distributed simulation. Connects all remote channels
75 * and the control infrastructure. The channels, the slaves and the master
76 * have to be registered before initializating. A simulation can only
77 * be initialized once.
82 * Runs the simulation until an error occures or no more events
83 * exist globally. A simulation can only be started once.
89 scd_sock_poller* _poller;
90 scd_chan_man* _chan_man;
91 scd_cont_man* _cont_man;
94 std::string _loc_host;
97 /* member functions */
100 * Indicates if events exist for the current simulation time.
101 * \return true if events exist for the current time
106 * Indicates if events exist in the event queues.
107 * \return true if events exist
112 * Returns the absolute time of the next event in the queues.
113 * \retunrs the absoulte time of the next event or 0 if no such event exists
115 const sc_core::sc_time _next_time();