scc  2022.4.0
SystemC components library
tlm_recorder_module.h
1 /*******************************************************************************
2  * Copyright 2016, 2017 MINRES Technologies GmbH
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *******************************************************************************/
16 
17 #ifndef TLM2_RECORDER_MODULE_H_
18 #define TLM2_RECORDER_MODULE_H_
19 
20 #include <tlm/scc/scv/tlm_recorder.h>
21 #include <tlm_utils/simple_initiator_socket.h>
22 #include <tlm_utils/simple_target_socket.h>
23 
25 namespace tlm {
27 namespace scc {
29 namespace scv {
40 template <unsigned int BUSWIDTH = 32, typename TYPES = tlm::tlm_base_protocol_types> class tlm_recorder_module : public sc_core::sc_module {
41 public:
42  SC_HAS_PROCESS(tlm_recorder_module); // NOLINT
44  tlm::tlm_target_socket<BUSWIDTH, TYPES, 1> ts{"ts"};
46  tlm::tlm_initiator_socket<BUSWIDTH, TYPES, 1> is{"is"};
56  tlm_recorder_module(sc_core::sc_module_name name, bool recording_enabled = true,
57  SCVNS scv_tr_db* tr_db = SCVNS scv_tr_db::get_default_db())
58  : sc_module(name) {
59  recorder.reset(
60  new tlm_recorder<TYPES>(sc_core::sc_object::name(), is.get_base_port(), ts.get_base_port(), recording_enabled, tr_db));
61  add_attribute(recorder->enableBlTracing);
62  add_attribute(recorder->enableNbTracing);
63  add_attribute(recorder->enableTimedTracing);
64  add_attribute(recorder->enableDmiTracing);
65  // bind the sockets to the module
66  is.bind(*recorder);
67  ts.bind(*recorder);
68  }
69 
70  sc_core::sc_attribute<bool> enableTimedTracing() { return recorder->enableBlTracing; }
71 
72  virtual ~tlm_recorder_module() {}
73 
74  std::unique_ptr<tlm_recorder<TYPES>> recorder;
75 
76 private:
77  void start_of_simulation() override { recorder->initialize_streams(); }
78 };
79 } // namespace scv
80 } // namespace scc
81 } // namespace tlm
82 
83 #endif /* TLM2_RECORDER_MODULE_H_ */
The TLM2 transaction recorder.
tlm_recorder_module(sc_core::sc_module_name name, bool recording_enabled=true, SCVNS scv_tr_db *tr_db=SCVNS scv_tr_db::get_default_db())
The constructor of the component.
tlm::tlm_target_socket< BUSWIDTH, TYPES, 1 > ts
The target socket of the recorder to be bound to the initiator.
tlm::tlm_initiator_socket< BUSWIDTH, TYPES, 1 > is
The initiator to be bound to the target socket.
The TLM2 transaction recorder.
Definition: tlm_recorder.h:81
SCC SystemC utilities.
SystemC TLM.