C++ Device API Reference Manual
Reference documentation for the Simics C++ Device API.
 
Loading...
Searching...
No Matches
event-interface.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2023 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_EVENT_INTERFACE_H
17#define SIMICS_EVENT_INTERFACE_H
18
19#include <simics/base/event.h> // pc_step_t
20#include <simics/base/time.h> // cycles_t
21
22#include <type_traits> // add_pointer_t
23
24namespace simics {
25
30 public:
31 virtual ~EventInterface() = default;
33 virtual void callback(void *data) = 0;
36 virtual void destroy(void *data) = 0;
39 virtual attr_value_t get_value(void *data) = 0;
41 virtual void *set_value(attr_value_t value) = 0;
44 virtual char *describe(void *data) const = 0;
45};
46
48 public:
49 virtual ~TimeEventInterface() = default;
51 virtual void remove(void *match_data) const = 0;
53 virtual bool posted(void *match_data) const = 0;
56 virtual double next(void *data) const = 0;
58 virtual void post(double seconds, void *data) = 0;
59};
60
62 public:
63 virtual ~CycleEventInterface() = default;
65 virtual void remove(void *match_data) const = 0;
67 virtual bool posted(void *match_data) const = 0;
70 virtual cycles_t next(void *match_data) const = 0;
72 virtual void post(cycles_t cycles, void *data) = 0;
73};
74
76 public:
77 virtual ~StepEventInterface() = default;
79 virtual void remove(void *match_data) const = 0;
81 virtual bool posted(void *match_data) const = 0;
84 virtual pc_step_t next(void *match_data) const = 0;
86 virtual void post(pc_step_t steps, void *data) = 0;
87};
88
89} // namespace simics
90
91#endif
Definition: event-interface.h:61
virtual void remove(void *match_data) const =0
Removes all events of this type with matching data from the queue.
virtual bool posted(void *match_data) const =0
Returns true if the event is in the queue, and false otherwise.
virtual cycles_t next(void *match_data) const =0
Returns the cycles to the next occurrence of the event in the queue (relative to the current time)
virtual ~CycleEventInterface()=default
virtual void post(cycles_t cycles, void *data)=0
Posts the event on the associated queue of the device.
An event is required to implement the interface.
Definition: event-interface.h:29
virtual void * set_value(attr_value_t value)=0
Called to convert a configuration value into event data.
virtual void destroy(void *data)=0
Called when the event is removed from the queue without being called.
virtual ~EventInterface()=default
virtual attr_value_t get_value(void *data)=0
Called to convert the event data into a value that can be saved in a configuration.
virtual void callback(void *data)=0
Called when the event expires.
virtual char * describe(void *data) const =0
Called to generate a human-readable description of the event to be used in the print-event-queue comm...
Definition: event-interface.h:75
virtual pc_step_t next(void *match_data) const =0
Returns the steps to the next occurrence of the event in the queue (relative to the current time)
virtual bool posted(void *match_data) const =0
Returns true if the event is in the queue, and false otherwise.
virtual void remove(void *match_data) const =0
Removes all events of this type with matching data from the queue.
virtual ~StepEventInterface()=default
virtual void post(pc_step_t steps, void *data)=0
Posts the event on the associated queue of the device.
Definition: event-interface.h:47
virtual void post(double seconds, void *data)=0
Posts the event on the associated queue of the device.
virtual double next(void *data) const =0
Returns the time to the next occurrence of the event in the queue (relative to the current time)
virtual void remove(void *match_data) const =0
Removes all events of this type with matching data from the queue.
virtual bool posted(void *match_data) const =0
Returns true if the event is in the queue, and false otherwise.
virtual ~TimeEventInterface()=default
Definition: after-bank.h:33