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