gem5  v19.0.0.0
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  * Authors: Gabe Black
28  */
29 
31 #include "scx/scx.h"
32 #include "sim/init.hh"
33 
34 namespace
35 {
36 
37 void
38 arm_fast_model_pybind(pybind11::module &m_internal)
39 {
40  auto arm_fast_model = m_internal.def_submodule("arm_fast_model");
41  arm_fast_model
42  .def("scx_initialize", [](std::string id) {
43  scx::scx_initialize(id);
44  })
45 
46  // Loading of applications or raw data.
47  .def("scx_load_application", &scx::scx_load_application)
48  .def("scx_load_application_all", &scx::scx_load_application_all)
49  .def("scx_load_data", &scx::scx_load_data)
50  .def("scx_load_data_all", &scx::scx_load_data_all)
51 
52  // Only expose the string based versions of these functions. Exposing
53  // specializations of the templated versions is likely overkill,
54  // especially since there are other preferred methods for setting up
55  // the parameters of a component.
56  .def("scx_set_parameter",
57  static_cast<bool (*)(const std::string &, const std::string &)>(
58  &scx::scx_set_parameter))
59  .def("scx_get_parameter",
60  static_cast<bool (*)(const std::string &, std::string &)>(
61  &scx::scx_get_parameter))
62  .def("scx_get_parameter_list", &scx::scx_get_parameter_list)
63 
64  .def("scx_set_cpi_file", &scx::scx_set_cpi_file)
65 
66  // These might be used internally by the gem5 fast model wrapper, and
67  // may not be worth exposing.
68  .def("scx_cpulimit", &scx::scx_cpulimit)
69  .def("scx_timelimit", &scx::scx_timelimit)
70  .def("scx_simlimit", &scx::scx_simlimit)
71 
72  .def("scx_parse_and_configure",
73  [](int argc, std::vector<char *> argv,
74  const char *trailer=NULL, bool sig_handler=true) {
75  scx::scx_parse_and_configure(argc, argv.data(),
76  trailer, sig_handler);
77  },
78  pybind11::arg("argc"),
79  pybind11::arg("argv"),
80  pybind11::arg("trailer") = NULL,
81  pybind11::arg("sig_handler") = true)
82 
83  // CADI stuff.
84  .def("scx_start_cadi_server", &scx::scx_start_cadi_server,
85  pybind11::arg("start") = true,
86  pybind11::arg("run") = true,
87  pybind11::arg("debug") = false)
88  .def("scx_enable_cadi_log", &scx::scx_enable_cadi_log,
89  pybind11::arg("log") = true)
90  .def("scx_prefix_appli_output", &scx::scx_prefix_appli_output,
91  pybind11::arg("prefix") = true)
92  .def("scx_print_port_number", &scx::scx_print_port_number,
93  pybind11::arg("print") = true)
94 
95  .def("scx_print_statistics", &scx::scx_print_statistics,
96  pybind11::arg("print") = true)
97  .def("scx_load_plugin", &scx::scx_load_plugin)
98  .def("scx_sync", &scx::scx_sync)
99  .def("scx_set_min_sync_latency",
100  static_cast<void (*)(double)>(&scx::scx_set_min_sync_latency))
101  .def("scx_set_min_sync_latency",
102  static_cast<void (*)(sg::ticks_t)>(
103  &scx::scx_set_min_sync_latency))
104  .def("scx_get_min_sync_latency",
105  static_cast<double (*)()>(&scx::scx_get_min_sync_latency))
106  .def("scx_get_min_sync_latency",
107  static_cast<sg::ticks_t (*)(sg::Tag<sg::ticks_t> *)>(
108  &scx::scx_get_min_sync_latency))
109  ;
110 }
111 EmbeddedPyBind embed_("arm_fast_model", &arm_fast_model_pybind);
112 
113 } // anonymous namespace
STL vector class.
Definition: stl.hh:40
static EmbeddedPyBind embed_("stattest", stattest_init_pybind)

Generated on Fri Feb 28 2020 16:26:56 for gem5 by doxygen 1.8.13