gem5  v21.2.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 gem5
45 {
46 
47 namespace
48 {
49 
50 void
51 arm_fast_model_pybind(pybind11::module_ &m_internal)
52 {
53  auto arm_fast_model = m_internal.def_submodule("arm_fast_model");
54  arm_fast_model
55  .def("scx_initialize", [](std::string id) {
56  scx::scx_initialize(id);
57  })
58 
59  // Loading of applications or raw data.
60  .def("scx_load_application", &scx::scx_load_application)
61  .def("scx_load_application_all", &scx::scx_load_application_all)
62  .def("scx_load_data", &scx::scx_load_data)
63  .def("scx_load_data_all", &scx::scx_load_data_all)
64 
65  // Only expose the string based versions of these functions. Exposing
66  // specializations of the templated versions is likely overkill,
67  // especially since there are other preferred methods for setting up
68  // the parameters of a component.
69  .def("scx_set_parameter",
70  static_cast<bool (*)(const std::string &, const std::string &)>(
71  &scx::scx_set_parameter))
72  .def("scx_get_parameter",
73  static_cast<bool (*)(const std::string &, std::string &)>(
74  &scx::scx_get_parameter))
75  .def("scx_get_parameter_list", &scx::scx_get_parameter_list)
76 
77  .def("scx_set_cpi_file", &scx::scx_set_cpi_file)
78 
79  // These might be used internally by the gem5 fast model wrapper, and
80  // may not be worth exposing.
81  .def("scx_cpulimit", &scx::scx_cpulimit)
82  .def("scx_timelimit", &scx::scx_timelimit)
83  .def("scx_simlimit", &scx::scx_simlimit)
84 
85  .def("scx_parse_and_configure",
86  [](int argc, std::vector<char *> argv,
87  const char *trailer=NULL, bool sig_handler=true) {
88  scx::scx_parse_and_configure(argc, argv.data(),
89  trailer, sig_handler);
90  },
91  pybind11::arg("argc"),
92  pybind11::arg("argv"),
93  pybind11::arg("trailer") = NULL,
94  pybind11::arg("sig_handler") = true)
95 
96  // CADI stuff.
97  .def("scx_start_cadi_server", &scx::scx_start_cadi_server,
98  pybind11::arg("start") = true,
99  pybind11::arg("run") = true,
100  pybind11::arg("debug") = false)
101  .def("scx_enable_cadi_log", &scx::scx_enable_cadi_log,
102  pybind11::arg("log") = true)
103  .def("scx_print_port_number", &scx::scx_print_port_number,
104  pybind11::arg("print") = true)
105 
106  .def("scx_print_statistics", &scx::scx_print_statistics,
107  pybind11::arg("print") = true)
108  .def("scx_load_plugin", &scx::scx_load_plugin)
109  .def("scx_sync", &scx::scx_sync)
110  .def("scx_set_min_sync_latency",
111  static_cast<void (*)(double)>(&scx::scx_set_min_sync_latency))
112  .def("scx_set_min_sync_latency",
113  static_cast<void (*)(sg::ticks_t)>(
114  &scx::scx_set_min_sync_latency))
115  .def("scx_get_min_sync_latency",
116  static_cast<double (*)()>(&scx::scx_get_min_sync_latency))
117  .def("scx_get_min_sync_latency",
118  static_cast<sg::ticks_t (*)(sg::Tag<sg::ticks_t> *)>(
119  &scx::scx_get_min_sync_latency))
120  ;
121 }
122 EmbeddedPyBind embed_("arm_fast_model", &arm_fast_model_pybind);
123 
124 } // anonymous namespace
125 } // namespace gem5
std::vector< char * >
pybind.hh
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: tlb.cc:60
init.hh

Generated on Tue Dec 21 2021 11:34:19 for gem5 by doxygen 1.8.17