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

Generated on Wed Sep 30 2020 14:01:58 for gem5 by doxygen 1.8.17