scc  2022.4.0
SystemC components library
axi_target.cpp
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 #include "axi_target.h"
18 #include <scc/report.h>
19 #include <tlm/scc/tlm_gp_shared.h>
20 
21 using namespace axi;
22 
23 axi_target_base::axi_target_base(const sc_core::sc_module_name& nm, axi::pe::axi_target_pe& pe)
24 : sc_module(nm)
25 , pe(pe) {
26  SC_HAS_PROCESS(axi_target_base);
27  SC_THREAD(trans_queue);
28 }
29 
30 unsigned axi_target_base::access(tlm::tlm_generic_payload& trans) {
31  peq.notify(&trans);
32  return std::numeric_limits<unsigned>::max();
33 }
34 
35 void axi_target_base::trans_queue() {
36  auto delay = sc_core::SC_ZERO_TIME;
37  while(true) {
38  tlm::scc::tlm_gp_shared_ptr trans = peq.get();
39  isck->b_transport(*trans, delay);
40  pe.operation_resp(*trans, trans->is_write() ? pe.wr_resp_delay.get_value() : pe.rd_resp_delay.get_value());
41  }
42 }
axi_target class instantiates the AXI Protocol Engine. It accesses the Protocol Engine with access() ...
Definition: axi_target.h:37
scc::sc_attribute_randomized< int > rd_resp_delay
the latency between request and response phase. Will be overwritten by the return of the callback fun...
Definition: axi_target_pe.h:82
void operation_resp(payload_type &trans, unsigned clk_delay=0)
scc::sc_attribute_randomized< int > wr_resp_delay
the latency between request and response phase. Will be overwritten by the return of the callback fun...
Definition: axi_target_pe.h:87
TLM2.0 components modeling AHB.
Definition: axi_initiator.h:30
void notify(const TYPE &entry, const sc_core::sc_time &t)
non-blocking push.
Definition: peq.h:77
TYPE get()
blocking get
Definition: peq.h:128