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