gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
fastmodel.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Google, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer;
8  * redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution;
11  * neither the name of the copyright holders nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
29 #include "scx/scx.h"
30 #include "sim/init.hh"
31 
32 namespace
33 {
34 
35 void
36 arm_fast_model_pybind(pybind11::module &m_internal)
37 {
38  auto arm_fast_model = m_internal.def_submodule("arm_fast_model");
39  arm_fast_model
40  .def("scx_initialize", [](std::string id) {
41  scx::scx_initialize(id);
42  })
43 
44  // Loading of applications or raw data.
45  .def("scx_load_application", &scx::scx_load_application)
46  .def("scx_load_application_all", &scx::scx_load_application_all)
47  .def("scx_load_data", &scx::scx_load_data)
48  .def("scx_load_data_all", &scx::scx_load_data_all)
49 
50  // Only expose the string based versions of these functions. Exposing
51  // specializations of the templated versions is likely overkill,
52  // especially since there are other preferred methods for setting up
53  // the parameters of a component.
54  .def("scx_set_parameter",
55  static_cast<bool (*)(const std::string &, const std::string &)>(
56  &scx::scx_set_parameter))
57  .def("scx_get_parameter",
58  static_cast<bool (*)(const std::string &, std::string &)>(
59  &scx::scx_get_parameter))
60  .def("scx_get_parameter_list", &scx::scx_get_parameter_list)
61 
62  .def("scx_set_cpi_file", &scx::scx_set_cpi_file)
63 
64  // These might be used internally by the gem5 fast model wrapper, and
65  // may not be worth exposing.
66  .def("scx_cpulimit", &scx::scx_cpulimit)
67  .def("scx_timelimit", &scx::scx_timelimit)
68  .def("scx_simlimit", &scx::scx_simlimit)
69 
70  .def("scx_parse_and_configure",
71  [](int argc, std::vector<char *> argv,
72  const char *trailer=NULL, bool sig_handler=true) {
73  scx::scx_parse_and_configure(argc, argv.data(),
74  trailer, sig_handler);
75  },
76  pybind11::arg("argc"),
77  pybind11::arg("argv"),
78  pybind11::arg("trailer") = NULL,
79  pybind11::arg("sig_handler") = true)
80 
81  // CADI stuff.
82  .def("scx_start_cadi_server", &scx::scx_start_cadi_server,
83  pybind11::arg("start") = true,
84  pybind11::arg("run") = true,
85  pybind11::arg("debug") = false)
86  .def("scx_enable_cadi_log", &scx::scx_enable_cadi_log,
87  pybind11::arg("log") = true)
88  .def("scx_prefix_appli_output", &scx::scx_prefix_appli_output,
89  pybind11::arg("prefix") = true)
90  .def("scx_print_port_number", &scx::scx_print_port_number,
91  pybind11::arg("print") = true)
92 
93  .def("scx_print_statistics", &scx::scx_print_statistics,
94  pybind11::arg("print") = true)
95  .def("scx_load_plugin", &scx::scx_load_plugin)
96  .def("scx_sync", &scx::scx_sync)
97  .def("scx_set_min_sync_latency",
98  static_cast<void (*)(double)>(&scx::scx_set_min_sync_latency))
99  .def("scx_set_min_sync_latency",
100  static_cast<void (*)(sg::ticks_t)>(
101  &scx::scx_set_min_sync_latency))
102  .def("scx_get_min_sync_latency",
103  static_cast<double (*)()>(&scx::scx_get_min_sync_latency))
104  .def("scx_get_min_sync_latency",
105  static_cast<sg::ticks_t (*)(sg::Tag<sg::ticks_t> *)>(
106  &scx::scx_get_min_sync_latency))
107  ;
108 }
109 EmbeddedPyBind embed_("arm_fast_model", &arm_fast_model_pybind);
110 
111 } // anonymous namespace
STL vector class.
Definition: stl.hh:37
static EmbeddedPyBind embed_("stattest", stattest_init_pybind)

Generated on Mon Jun 8 2020 15:34:38 for gem5 by doxygen 1.8.13