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