SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
extension_receiver.h
Go to the documentation of this file.
1/*
2 © 2015 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_EXTENSION_RECEIVER_H
15#define SIMICS_SYSTEMC_IFACE_EXTENSION_RECEIVER_H
16
17#include <tlm>
18
20
21namespace simics {
22namespace systemc {
23namespace iface {
24
33//:: pre ExtensionReceiver {{
34template<class TExtension, class TInterface>
36 public:
37 explicit ExtensionReceiver(TInterface *device)
38 : device_(device) {}
39 bool handle(tlm::tlm_generic_payload *payload) override {
40 TExtension *extension = payload->get_extension<TExtension>();
41 if (extension && extension->valid()) {
42 payload->set_response_status(tlm::TLM_OK_RESPONSE);
43 extension->method_call(device_);
44 return true;
45 }
46
47 return false;
48 }
49 bool probe(tlm::tlm_generic_payload *payload) override {
50 TExtension *extension = payload->get_extension<TExtension>();
51 return extension && extension->valid();
52 }
53
54 private:
55 TInterface *device_;
56};
57// }}
58
59} // namespace iface
60} // namespace systemc
61} // namespace simics
62
63#endif
Receiver of protocol specific extensions.
Definition: extension_receiver.h:35
bool handle(tlm::tlm_generic_payload *payload) override
Definition: extension_receiver.h:39
bool probe(tlm::tlm_generic_payload *payload) override
Definition: extension_receiver.h:49
ExtensionReceiver(TInterface *device)
Definition: extension_receiver.h:37
Interface implemented by the ExtensionReceiver class, used by the ExtensionDispatcher.
Definition: receiver_interface.h:27
Definition: adapter.h:79