scc  2024.06
SystemC components library
axi_target.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_target.h>
25 #include <scc/peq.h>
26 
27 #include <systemc>
28 #include <tlm>
29 #include <tlm_utils/simple_initiator_socket.h>
30 
31 namespace axi {
37 class axi_target_base : public sc_core::sc_module {
38 public:
39  sc_core::sc_in<bool> clk_i{"clk_i"};
40 #ifdef CWR_SYSTEMC
41  tlm_utils::simple_initiator_socket<axi_target_base, 32> isck{"isck"};
42 #else
43  tlm_utils::simple_initiator_socket<axi_target_base, scc::LT> isck{"isck"};
44 #endif
45  axi_target_base(const sc_core::sc_module_name& nm, axi::pe::axi_target_pe& pe);
46  virtual ~axi_target_base(){};
47 
48 protected:
49  unsigned access(tlm::tlm_generic_payload& trans);
50 
51 private:
54 
55  void trans_queue();
56 };
57 
58 template <unsigned int BUSWIDTH = 32> class axi_target : public axi_target_base {
59 public:
61 
62  axi_target(sc_core::sc_module_name nm)
63  : axi_target_base(nm, pe) {
64  pe.clk_i(clk_i);
65  pe.set_operation_cb([this](tlm::tlm_generic_payload& trans) -> unsigned { return access(trans); });
66  };
67 
68  virtual ~axi_target(){};
69 
70  axi::pe::simple_target<BUSWIDTH> pe{"pe", tsck};
71 };
72 
73 } // namespace axi
axi_target class instantiates the AXI Protocol Engine. It accesses the Protocol Engine with access() ...
Definition: axi_target.h:37
TLM2.0 components modeling AHB.
Definition: axi_initiator.h:30