SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
transaction_extension.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2018 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_TRANSACTION_EXTENSION_H
17#define SIMICS_SYSTEMC_IFACE_TRANSACTION_EXTENSION_H
18
19#include <tlm>
20
21namespace simics {
22namespace systemc {
23namespace iface {
24
25class Transaction;
26
28 public:
29 enum Status {
33 ACTIVE
34 };
35 TransactionStatus() : status_(INVALID) {}
36 TransactionStatus(Status status) : status_(status) {} // NOLINT
37 bool invalid() {
38 return status_ == INVALID;
39 }
40 bool ok() {
41 return status_ == OK;
42 }
43 bool fail() {
44 return status_ == FAIL;
45 }
46 bool active() {
47 return status_ == ACTIVE;
48 }
49
50 private:
51 Status status_;
52};
53
54class TransactionExtension : public tlm::tlm_extension<TransactionExtension> {
55 public:
56 class Callback {
57 public:
58 virtual bool is_async(iface::Transaction *transaction) = 0;
59 virtual void defer(iface::Transaction *transaction) = 0;
60 virtual void complete(iface::Transaction *transaction,
61 bool success) = 0;
62 virtual ~Callback() {}
63 };
65 reset();
66 }
68 return status_;
69 }
70 void reset() {
72 transport_debug_ = false;
73 callback_ = NULL;
74 }
76 status_ = status;
77 }
79 return transport_debug_;
80 }
83 transport_debug_ = transport_debug;
84 }
86 callback_ = callback;
87 }
89 return callback_;
90 }
91 virtual tlm::tlm_extension_base *clone() const {
92 return new TransactionExtension(*this);
93 }
94 virtual void copy_from(tlm::tlm_extension_base const &ext) {
95 *this = static_cast<const TransactionExtension &>(ext);
96 }
97
98 private:
99 TransactionStatus status_;
100 bool transport_debug_;
101 Callback *callback_;
102};
103
104} // namespace iface
105} // namespace systemc
106} // namespace simics
107
108#endif
Definition: transaction_extension.h:56
virtual void defer(iface::Transaction *transaction)=0
virtual bool is_async(iface::Transaction *transaction)=0
virtual ~Callback()
Definition: transaction_extension.h:62
virtual void complete(iface::Transaction *transaction, bool success)=0
Definition: transaction_extension.h:54
void set_callback(Callback *callback)
Definition: transaction_extension.h:85
void set_status(TransactionStatus status)
Definition: transaction_extension.h:75
void reset()
Definition: transaction_extension.h:70
TransactionExtension()
Definition: transaction_extension.h:64
void set_transport_debug(bool transport_debug)
For true, the gasket uses transport_dbg instead of b_transport.
Definition: transaction_extension.h:82
virtual tlm::tlm_extension_base * clone() const
Definition: transaction_extension.h:91
virtual void copy_from(tlm::tlm_extension_base const &ext)
Definition: transaction_extension.h:94
bool transport_debug()
Definition: transaction_extension.h:78
TransactionStatus status()
Definition: transaction_extension.h:67
Callback * callback()
Definition: transaction_extension.h:88
Definition: transaction_extension.h:27
bool invalid()
Definition: transaction_extension.h:37
bool active()
Definition: transaction_extension.h:46
bool fail()
Definition: transaction_extension.h:43
bool ok()
Definition: transaction_extension.h:40
Status
Definition: transaction_extension.h:29
@ ACTIVE
Definition: transaction_extension.h:33
@ INVALID
Definition: transaction_extension.h:30
@ OK
Definition: transaction_extension.h:31
@ FAIL
Definition: transaction_extension.h:32
TransactionStatus(Status status)
Definition: transaction_extension.h:36
TransactionStatus()
Definition: transaction_extension.h:35
Class that encapsulates a generic_payload and returns it to the TransactionPool when the Transaction ...
Definition: transaction.h:31
Definition: pci_bus_interface.h:24