SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
tlm_spy_factory.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_AWARENESS_TLM_SPY_FACTORY_H
15#define SIMICS_SYSTEMC_AWARENESS_TLM_SPY_FACTORY_H
16#if INTC_EXT
17
18#include <tlm>
19
27
28#include <set>
29#include <vector>
30
31namespace simics {
32namespace systemc {
33namespace awareness {
34
35class TlmSpyFactoryInterface {
36 public:
37 virtual TlmSpyFactoryInterface *create() = 0;
38 virtual TraverserInterface *traverser() = 0;
39 virtual ~TlmSpyFactoryInterface() {}
40};
41
42template <typename TYPES = tlm::tlm_base_protocol_types,
43 typename INITIATORPORT = TlmFwTransportIfHandler<intc::sc_port_spy<
44 tlm::tlm_fw_transport_if<TYPES> >, TYPES >,
45 typename TARGETPORT = TlmBwTransportIfHandler<intc::sc_port_spy<
46 tlm::tlm_bw_transport_if<TYPES> >, TYPES >,
47 typename INITIATOREXPORT = TlmBwTransportIfHandler<
48 intc::sc_export_spy<tlm::tlm_bw_transport_if<TYPES> >, TYPES >,
49 typename TARGETEXPORT = TlmFwTransportIfHandler<intc::sc_export_spy<
50 tlm::tlm_fw_transport_if<TYPES> >, TYPES > >
51class TlmSpyFactory : public TlmSpyFactoryInterface, public MultiTraverser {
52 public:
53 TlmSpyFactory() {
54 add(&export_bw_);
55 add(&export_fw_);
56 add(&port_bw_);
57 add(&port_fw_);
58 add(&multi_target_);
59 add(&multi_initiator_);
60 }
61 TlmSpyFactory(const TlmSpyFactory &f) {
62 deep_copy(f);
63 }
64 TlmSpyFactory &operator = (const TlmSpyFactory &f) {
65 return deep_copy(f);
66 }
67 TlmSpyFactoryInterface *create() override {
68 return new TlmSpyFactory(*this);
69 }
70 TraverserInterface *traverser() override {
71 return this;
72 }
73 void done() override {
74 port_bw_.bindSpies(export_bw_.get_spies());
75 port_fw_.bindSpies(export_fw_.get_spies());
76
77 multi_target_.bind_spies(export_bw_.get_spies());
78 port_fw_.bindSpies(multi_target_.get_spies());
79
80 multi_initiator_.bind_spies(export_fw_.get_spies());
81 port_bw_.bindSpies(multi_initiator_.get_spies());
82 }
83 virtual ~TlmSpyFactory() = default;
84
85 private:
86 TlmSpyFactory &deep_copy(const TlmSpyFactory &f) {
87 if (&f == this)
88 return *this;
89
90 add(&export_bw_);
91 add(&export_fw_);
92 add(&port_bw_);
93 add(&port_fw_);
94 add(&multi_target_);
95 add(&multi_initiator_);
96 return *this;
97 }
98
99 PortSpyFactory<tlm::tlm_fw_transport_if<TYPES>, INITIATORPORT> port_fw_;
100 ExportSpyFactory<tlm::tlm_bw_transport_if<TYPES>, INITIATOREXPORT>
101 export_bw_;
102 PortSpyFactory<tlm::tlm_bw_transport_if<TYPES>, TARGETPORT> port_bw_;
103 ExportSpyFactory<tlm::tlm_fw_transport_if<TYPES>, TARGETEXPORT> export_fw_;
104 MultiTargetSpyFactory<tlm::tlm_bw_transport_if<TYPES>,
105 TARGETEXPORT, TYPES> multi_target_;
106 MultiInitiatorSpyFactory<tlm::tlm_fw_transport_if<TYPES>,
107 INITIATOREXPORT, TYPES> multi_initiator_;
108};
109
110} // namespace awareness
111} // namespace systemc
112} // namespace simics
113
114#endif // INTC_EXT
115#endif
Definition: adapter.h:79