SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
concurrency_group_simics_adapter.h
Go to the documentation of this file.
1/*
2 © 2019 Intel Corporation
3
4 This software and the related documents are Intel copyrighted materials, and
5 your use of them is governed by the express license under which they were
6 provided to you ("License"). Unless the License provides otherwise, you may
7 not use, modify, copy, publish, distribute, disclose or transmit this software
8 or the related documents without Intel's prior written permission.
9
10 This software and the related documents are provided as is, with no express or
11 implied warranties, other than those that are expressly stated in the License.
12*/
13
14#ifndef SIMICS_SYSTEMC_IFACE_CONCURRENCY_GROUP_SIMICS_ADAPTER_H
15#define SIMICS_SYSTEMC_IFACE_CONCURRENCY_GROUP_SIMICS_ADAPTER_H
16
17#include <simics/model-iface/concurrency.h>
20#include <simics/attribute-traits.h>
21
22#include <string>
23#include <vector>
24
25namespace simics {
26namespace systemc {
27namespace iface {
28
30template<typename TBase, typename TInterface = ConcurrencyGroupInterface>
32 : public SimicsAdapter<concurrency_group_interface_t> {
33 public:
35 : SimicsAdapter<concurrency_group_interface_t>(
36 CONCURRENCY_GROUP_INTERFACE, init_iface()) {}
37
38 protected:
39 static attr_value_t serialized_memory_group(conf_object_t *NOTNULL obj,
40 unsigned group_index) {
41 std::vector<conf_object_t *> v = adapter<TBase, TInterface>(
42 obj)->serialized_memory_group(group_index);
43 return vectorToList(v);
44 }
45 static attr_value_t execution_group(conf_object_t *NOTNULL obj,
46 unsigned group_index) {
47 std::vector<conf_object_t *> v = adapter<TBase, TInterface>(
48 obj)->execution_group(group_index);
49 return vectorToList(v);
50 }
51
52 private:
53 static attr_value_t vectorToList(const std::vector<conf_object_t *> &v) {
54 if (v.empty())
55 return SIM_make_attr_nil();
56 return simics::std_to_attr(
57 std::vector<simics::ConfObjectRef>(v.begin(), v.end()));
58 }
59 std::vector<std::string> description(conf_object_t *obj,
60 DescriptionType type) override {
61 return descriptionBase<TBase, TInterface>(obj, type);
62 }
63 concurrency_group_interface_t init_iface() {
64 concurrency_group_interface_t iface = {};
65 iface.serialized_memory_group = serialized_memory_group;
66 iface.execution_group = execution_group;
67 return iface;
68 }
69};
70
71} // namespace iface
72} // namespace systemc
73} // namespace simics
74
75#endif
Adapter for concurrency mode interface.
Definition: concurrency_group_simics_adapter.h:32
static attr_value_t execution_group(conf_object_t *NOTNULL obj, unsigned group_index)
Definition: concurrency_group_simics_adapter.h:45
ConcurrencyGroupSimicsAdapter()
Definition: concurrency_group_simics_adapter.h:34
static attr_value_t serialized_memory_group(conf_object_t *NOTNULL obj, unsigned group_index)
Definition: concurrency_group_simics_adapter.h:39
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:45
DescriptionType
Definition: description_interface.h:23
Definition: adapter.h:79