SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
event_delta_simics_adapter.h
Go to the documentation of this file.
1/*
2 © 2018 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_EVENT_DELTA_SIMICS_ADAPTER_H
15#define SIMICS_SYSTEMC_IFACE_EVENT_DELTA_SIMICS_ADAPTER_H
16
17#include <simics/model-iface/event-delta.h>
20
21#include <string>
22#include <vector>
23
24namespace simics {
25namespace systemc {
26namespace iface {
27
40template<typename TBase, typename TInterface = EventDeltaInterface>
41class EventDeltaSimicsAdapter : public SimicsAdapter<event_delta_interface_t> {
42 public:
44 : SimicsAdapter<event_delta_interface_t>(EVENT_DELTA_INTERFACE,
45 init_iface()) {
46 }
47
48 protected:
49 // The event_delta interface is only invoked from two contexts:
50 // 1. Within co-execute.run() after acquire - already holding the adapter's
51 // TD
52 // 2. From clock-src dispatch (Cell Context) - all TDs held
53 //
54 // Therefore, re-acquiring the TD here via SimicsLock would:
55 // - Be redundant (already held in both cases)
56 // - Block the signaling mechanism that notifies the adapter when
57 // other threads try to acquire its domain (threading performance issue)
58 //
59 // This is consistent with ExecuteSimicsAdapter and
60 // ExecuteControlSimicsAdapter, which use adapterWithoutLocking for the
61 // same architectural reason. See multithreading-threaded-cpu.md for
62 // details on TD signaling.
63 static ::uint64 set_delta(conf_object_t *NOTNULL obj,
64 conf_object_t *NOTNULL event_handler_obj,
65 const event_class_t *next_event_ec,
66 ::uint64 delta) {
67 return adapterWithoutLocking<TBase, TInterface>(obj)->set_delta(
68 event_handler_obj, next_event_ec, delta);
69 }
70 static ::uint64 get_delta(conf_object_t *NOTNULL obj,
71 conf_object_t *NOTNULL event_handler_obj) {
72 return adapterWithoutLocking<TBase, TInterface>(obj)->get_delta(
73 event_handler_obj);
74 }
75
76 private:
77 std::vector<std::string> description(conf_object_t *obj,
78 DescriptionType type) override {
79 return descriptionBase<TBase, TInterface>(obj, type);
80 }
81 event_delta_interface_t init_iface() {
82 event_delta_interface_t iface = {};
83 iface.set_delta = set_delta;
84 iface.get_delta = get_delta;
85 return iface;
86 }
87};
88
89} // namespace iface
90} // namespace systemc
91} // namespace simics
92
93#endif
Definition: event_delta_simics_adapter.h:41
EventDeltaSimicsAdapter()
Definition: event_delta_simics_adapter.h:43
::uint64 set_delta(conf_object_t *NOTNULL obj, conf_object_t *NOTNULL event_handler_obj, const event_class_t *next_event_ec, ::uint64 delta)
Definition: event_delta_simics_adapter.h:63
::uint64 get_delta(conf_object_t *NOTNULL obj, conf_object_t *NOTNULL event_handler_obj)
Definition: event_delta_simics_adapter.h:70
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