16#ifndef SIMICS_SYSTEMC_CCI_GLOBAL_H
17#define SIMICS_SYSTEMC_CCI_GLOBAL_H
19#include <simics/cc-api.h>
20#include <simics/simulator/sim-get-class.h>
37 explicit CciGlobal(ConfObjectRef o) : ConfObject(o), attributes_(NULL) {
40 attributes_ = attributes;
43 static attr_value_t
getAttribute(lang_void *ptr, conf_object_t *obj,
45 uintptr_t key =
reinterpret_cast<intptr_t
>(ptr);
47 attr_value_t result = o->attributes_->
attribute<
52 static set_error_t
setAttribute(lang_void *ptr, conf_object_t *obj,
53 attr_value_t *val, attr_value_t *idx) {
54 uintptr_t key =
reinterpret_cast<intptr_t
>(ptr);
56 set_error_t result = o->attributes_->
attribute<
61 static conf_class_t *
initClass(
const char *module_name,
63 assert(module_name != NULL);
64 std::string cls_name(module_name);
65 cls_name +=
"_cci_global";
66 std::replace(cls_name.begin(), cls_name.end(),
'-',
'_');
68 if (SIM_clear_exception() == SimExc_No_Exception) {
72 auto new_cls = make_class<CciGlobal>(
74 "Global CCI parameters.",
75 "All CCI parameters on a global level.",
76 Sim_Class_Kind_Pseudo);
77#if INTC_EXT && USE_SIMICS_CCI
79 std::vector <cci::cci_param_handle> parameters =
80 cfg.getParameters(NULL);
81 std::vector <cci::cci_param_handle>::iterator i;
82 for (i = parameters.begin(); i != parameters.end(); ++i) {
83 const char *type = cfg.simicsType(*i);
91 "CCI Attribute %s is now %s.", i->name(),
92 attribute_name.c_str());
101 SIM_register_typed_attribute(
102 *new_cls.get(), attribute_name.c_str(),
105 Sim_Attr_Pseudo, cfg.simicsType(*i), 0,
106 i->get_description().c_str());
107 if (SIM_clear_exception() != SimExc_No_Exception) {
109 "Failed to register CCI attribute: '%s'",
110 attribute_name.c_str());
Definition: cci_configuration.h:37
Definition: cci_global.h:35
static attr_value_t getAttribute(lang_void *ptr, conf_object_t *obj, attr_value_t *idx)
Definition: cci_global.h:43
CciGlobal(ConfObjectRef o)
Definition: cci_global.h:37
static conf_class_t * initClass(const char *module_name, ConfObjectRef obj)
Definition: cci_global.h:61
static set_error_t setAttribute(lang_void *ptr, conf_object_t *obj, attr_value_t *val, attr_value_t *idx)
Definition: cci_global.h:52
void init(awareness::Attributes *attributes)
Definition: cci_global.h:39
Definition: attributes.h:28
T * attribute(int key)
Definition: attributes.h:39
Definition: cci_attribute.h:34
static int define(std::string parameter_name)
Definition: proxy_attribute_name.h:32
conf_class_t * SIM_get_class(const char *NOTNULL name)
@ Log_Awareness
Definition: adapter_log_groups.h:26