scc 2025.09
SystemC components library
ocp_tlm.cpp
1/*******************************************************************************
2 * Copyright 2019-2024 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 <apb/apb_tlm.h>
18#include <array>
19
20namespace ocp {
21namespace {
22const std::array<std::string, 3> cmd_str{"R", "W", "I"};
23}
24std::ostream& operator<<(std::ostream& os, const tlm::tlm_generic_payload& t) {
25 os << "CMD:" << cmd_str[t.get_command()] << ", "
26 << "ADDR:0x" << std::hex << t.get_address() << ", TXLEN:0x" << t.get_data_length();
27 if(auto e = t.get_extension<apb::apb_extension>()) {
28 os << ", "
29 << "PROT:0x" << std::hex << static_cast<unsigned>(e->get_protection()) << "NSE:" << (e->is_nse() ? "True" : "False");
30 }
31 os << " [ptr:" << &t << "]";
32 return os;
33}
34
35} // namespace ocp
TLM2.0 components modeling OCP.
Definition ocp_tlm.cpp:20