Belle II Software  release-05-02-19
xsi_loader.h
1 #ifndef _XSI_LOADER_H_
2 #define _XSI_LOADER_H_
3 
4 #include "xsi.h"
5 #include "xsi_shared_lib.h"
6 
7 #include <string>
8 #include <exception>
9 
10 namespace Xsi {
11 
12  class LoaderException : public std::exception {
13  public:
14  explicit LoaderException(const std::string& msg) : _msg("ISim engine error: " + msg) { }
15 
16  virtual ~LoaderException() throw() { }
17 
18  virtual const char* what() const throw() { return _msg.c_str(); }
19  private:
20  std::string _msg;
21  };
22 
23  class Loader {
24  public:
25  Loader(const std::string& dll_name, const std::string& simkernel_libname);
26  ~Loader();
27 
28  bool isopen() const;
29  void open(p_xsi_setup_info setup_info);
30  void close();
31  void run(XSI_INT64 step);
32  void restart();
33  int get_value(int port_number, void* value);
34  int get_port_number(const char* port_name);
35  int get_port_number_or_exit(std::string name);
36  void put_value(int port_number, const void* value);
37  int get_status();
38  const char* get_error_info();
39  void trace_all();
40 
41  private:
42  bool initialize();
43 
44  Xsi::SharedLibrary _design_lib;
45  Xsi::SharedLibrary _simkernel_lib;
46  std::string _design_libname;
47  std::string _simkernel_libname;
48 
49  xsiHandle _design_handle;
50 
51  t_fp_xsi_open _xsi_open;
52  t_fp_xsi_close _xsi_close;
53  t_fp_xsi_run _xsi_run;
54  t_fp_xsi_get_value _xsi_get_value;
55  t_fp_xsi_put_value _xsi_put_value;
56  t_fp_xsi_get_status _xsi_get_status;
57  t_fp_xsi_get_error_info _xsi_get_error_info;
58  t_fp_xsi_restart _xsi_restart;
59  t_fp_xsi_get_port_number _xsi_get_port_number;
60  t_fp_xsi_trace_all _xsi_trace_all;
61 
62  }; // class Loader
63 
64 } // namespace Xsi
65 
66 #endif // _XSI_LOADER_H_
67 
68 // 67d7842dbbe25473c3c32b93c0da8047785f30d78e8a024de1b57352245f9689
Xsi::LoaderException
Definition: xsi_loader.h:12
t_xsi_setup_info
Note: VHDL std_logic value is stored in a byte (char).
Definition: xsi.h:137
Xsi::Loader
Definition: xsi_loader.h:23
Xsi::SharedLibrary
Definition: xsi_shared_lib.h:21