scc  2022.4.0
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  tlm_utils::simple_initiator_socket<axi_target_base, 0> isck{"isck"};
41 
42  axi_target_base(const sc_core::sc_module_name& nm, axi::pe::axi_target_pe& pe);
43  virtual ~axi_target_base(){};
44 
45 protected:
46  unsigned access(tlm::tlm_generic_payload& trans);
47 
48 private:
51 
52  void trans_queue();
53 };
54 
55 template <unsigned int BUSWIDTH = 32> class axi_target : public axi_target_base {
56 public:
58 
59  axi_target(sc_core::sc_module_name nm)
60  : axi_target_base(nm, pe) {
61  pe.clk_i(clk_i);
62  pe.set_operation_cb([this](tlm::tlm_generic_payload& trans) -> unsigned { return access(trans); });
63  };
64 
65  virtual ~axi_target(){};
66 
67  axi::pe::simple_target<BUSWIDTH> pe{"pe", tsck};
68 };
69 
70 } // 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