scc  2022.4.0
SystemC components library
axi_initiator.h
1 /*******************************************************************************
2  * Copyright 2021 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 #pragma once
18 
19 #ifndef SC_INCLUDE_DYNAMIC_PROCESSES
20 #define SC_INCLUDE_DYNAMIC_PROCESSES
21 #endif
22 
23 #include <axi/axi_tlm.h>
24 #include <axi/pe/simple_initiator.h>
25 
26 #include <systemc>
27 #include <tlm>
28 #include <tlm_utils/simple_target_socket.h>
29 
30 namespace axi {
35 class axi_initiator_base : public sc_core::sc_module {
36 public:
37  sc_core::sc_in<bool> clk_i{"clk_i"};
38  tlm_utils::simple_target_socket<axi_initiator_base> b_tsck{"b_tsck"};
39 
45  tlm::tlm_generic_payload* create_axi_trans(tlm::tlm_generic_payload& p);
46 
47  void b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& delay);
48 
49  axi_initiator_base(const sc_core::sc_module_name& nm, axi::pe::simple_initiator_b& pe, uint32_t width);
50 
51  virtual ~axi_initiator_base() {}
52 
53  void setTxSetupCb(const std::function<void(tlm::tlm_generic_payload& p)>& setupCb) { setup_cb = setupCb; }
54 
55 private:
57  uint32_t buswidth{0};
58  unsigned id{0};
59  std::function<void(tlm::tlm_generic_payload& p)> setup_cb;
60 };
61 
62 template <unsigned int BUSWIDTH = 32> class axi_initiator : public axi_initiator_base {
63 public:
65 
66  axi_initiator(sc_core::sc_module_name nm)
67  : axi_initiator_base(nm, pe, BUSWIDTH) {
68  pe.clk_i(clk_i);
69  };
70 
71  virtual ~axi_initiator(){};
72 
74 };
75 
76 } // namespace axi
axi_initiator class provides an input_socket for incoming TLM transactions. It attaches AXI extension...
Definition: axi_initiator.h:35
tlm::tlm_generic_payload * create_axi_trans(tlm::tlm_generic_payload &p)
TLM2.0 components modeling AHB.
Definition: axi_initiator.h:30