diff --git a/src/sysc/CMakeLists.txt b/src/sysc/CMakeLists.txt index 4e6a8298..ed2fb3e7 100644 --- a/src/sysc/CMakeLists.txt +++ b/src/sysc/CMakeLists.txt @@ -49,6 +49,7 @@ set(LIB_SOURCES tlm/scc/scv/tlm_recorder.cpp tlm/scc/pe/parallel_pe.cpp tlm/scc/lwtr/tlm2_lwtr.cpp + tlm/scc/memory_map_collector.cpp ) if(DEFINED SC_VERSION_MAJOR AND SC_VERSION_MAJOR GREATER 2) diff --git a/src/sysc/scc/ordered_semaphore.cpp b/src/sysc/scc/ordered_semaphore.cpp index f1578eeb..4b6b8078 100644 --- a/src/sysc/scc/ordered_semaphore.cpp +++ b/src/sysc/scc/ordered_semaphore.cpp @@ -102,7 +102,7 @@ auto ordered_semaphore::wait(unsigned priority) -> int { // lock (take) the semaphore, return -1 if not available auto ordered_semaphore::trywait() -> int { - if(in_use()) { + if(value == 0) { return -1; } --value; diff --git a/src/sysc/tlm/scc/memory_map_collector.cpp b/src/sysc/tlm/scc/memory_map_collector.cpp new file mode 100644 index 00000000..575a0f6a --- /dev/null +++ b/src/sysc/tlm/scc/memory_map_collector.cpp @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright 2026 MINRES Technologies GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *******************************************************************************/ + +#include "memory_map_collector.h" +#include + +namespace tlm { +namespace scc { +std::string memory_node::to_string(const std::string& prefix) const { + std::ostringstream os; + std::string filler(16 - prefix.length(), ' '); + os << fmt::format("{} 0x{:016x}:0x{:016x}{}{}\n", prefix, start, end, filler, name); + for(auto e : elemets) + os << e.to_string(prefix + " "); + return os.str(); +} + +} // namespace scc +} // namespace tlm diff --git a/src/sysc/tlm/scc/memory_map_collector.h b/src/sysc/tlm/scc/memory_map_collector.h index 08f4f3bf..eecd87a2 100644 --- a/src/sysc/tlm/scc/memory_map_collector.h +++ b/src/sysc/tlm/scc/memory_map_collector.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright 2016, 2018 MINRES Technologies GmbH + * Copyright 2026 MINRES Technologies GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,12 +18,10 @@ #define _TLM_SCC_MEMORY_MAP_COLLECTOR_H_ #include -#include #include #include #include #include -#include //! @brief SystemC TLM namespace tlm { @@ -38,14 +36,7 @@ struct memory_node { : start(start) , end(end) {} memory_node() = default; - std::string to_string(std::string const& prefix = "") const { - std::ostringstream os; - std::string filler(16 - prefix.length(), ' '); - os << fmt::format("{} 0x{:016x}:0x{:016x}{}{}\n", prefix, start, end, filler, name); - for(auto e : elemets) - os << e.to_string(prefix + " "); - return os.str(); - } + std::string to_string(const std::string& prefix = "") const; }; struct memory_map_extension : tlm::tlm_extension { @@ -70,6 +61,7 @@ memory_node gather_memory(sc_core::sc_port_b>& p trans.set_extension(nullptr); return std::move(root); } + } // namespace scc } // namespace tlm -#endif // _TLM_SCC_MEMORY_MAP_COLLECTOR_H_ \ No newline at end of file +#endif // _TLM_SCC_MEMORY_MAP_COLLECTOR_H_