applies cklang-tidy fixes
This commit is contained in:
parent
288f0577f1
commit
b9c9e15166
@ -1,4 +1,3 @@
|
|||||||
---
|
|
||||||
Language: Cpp
|
Language: Cpp
|
||||||
# BasedOnStyle: LLVM
|
# BasedOnStyle: LLVM
|
||||||
# should be in line with IndentWidth
|
# should be in line with IndentWidth
|
||||||
@ -13,8 +12,8 @@ AllowAllParametersOfDeclarationOnNextLine: true
|
|||||||
AllowShortBlocksOnASingleLine: false
|
AllowShortBlocksOnASingleLine: false
|
||||||
AllowShortCaseLabelsOnASingleLine: false
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
AllowShortFunctionsOnASingleLine: All
|
AllowShortFunctionsOnASingleLine: All
|
||||||
AllowShortIfStatementsOnASingleLine: true
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
AllowShortLoopsOnASingleLine: true
|
AllowShortLoopsOnASingleLine: false
|
||||||
AlwaysBreakAfterDefinitionReturnType: None
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
AlwaysBreakAfterReturnType: None
|
AlwaysBreakAfterReturnType: None
|
||||||
AlwaysBreakBeforeMultilineStrings: false
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
@ -39,8 +38,8 @@ BreakBeforeTernaryOperators: true
|
|||||||
BreakConstructorInitializersBeforeComma: true
|
BreakConstructorInitializersBeforeComma: true
|
||||||
BreakAfterJavaFieldAnnotations: false
|
BreakAfterJavaFieldAnnotations: false
|
||||||
BreakStringLiterals: true
|
BreakStringLiterals: true
|
||||||
ColumnLimit: 120
|
ColumnLimit: 140
|
||||||
CommentPragmas: '^ IWYU pragma:'
|
CommentPragmas: '^( IWYU pragma:| @suppress)'
|
||||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
ConstructorInitializerIndentWidth: 0
|
ConstructorInitializerIndentWidth: 0
|
||||||
ContinuationIndentWidth: 4
|
ContinuationIndentWidth: 4
|
||||||
@ -76,13 +75,13 @@ PenaltyBreakFirstLessLess: 120
|
|||||||
PenaltyBreakString: 1000
|
PenaltyBreakString: 1000
|
||||||
PenaltyExcessCharacter: 1000000
|
PenaltyExcessCharacter: 1000000
|
||||||
PenaltyReturnTypeOnItsOwnLine: 60
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
PointerAlignment: Right
|
PointerAlignment: Left
|
||||||
ReflowComments: true
|
ReflowComments: true
|
||||||
SortIncludes: true
|
SortIncludes: true
|
||||||
SpaceAfterCStyleCast: false
|
SpaceAfterCStyleCast: false
|
||||||
SpaceAfterTemplateKeyword: true
|
SpaceAfterTemplateKeyword: true
|
||||||
SpaceBeforeAssignmentOperators: true
|
SpaceBeforeAssignmentOperators: true
|
||||||
SpaceBeforeParens: ControlStatements
|
SpaceBeforeParens: Never
|
||||||
SpaceInEmptyParentheses: false
|
SpaceInEmptyParentheses: false
|
||||||
SpacesBeforeTrailingComments: 1
|
SpacesBeforeTrailingComments: 1
|
||||||
SpacesInAngles: false
|
SpacesInAngles: false
|
||||||
|
3
.clang-tidy
Normal file
3
.clang-tidy
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
Checks: 'clang-diagnostic-*,clang-analyzer-*,clang-diagnostic-*,clang-analyzer-*'
|
||||||
|
WarningsAsErrors: ''
|
104
.cproject
104
.cproject
@ -28,6 +28,42 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
|
<storageModule buildDir="build/${ConfigName}" dirtyTs="1703253448607" moduleId="de.marw.cmake4eclipse.mbs.settings">
|
||||||
|
<options/>
|
||||||
|
<defs>
|
||||||
|
<def name="CMAKE_BUILD_TYPE" type="STRING" val="Debug"/>
|
||||||
|
<def name="BUILD_SCC_DOCUMENTATION" type="BOOL" val="OFF"/>
|
||||||
|
<def name="ENABLE_CLANG_TIDY" type="STRING" val="ON"/>
|
||||||
|
</defs>
|
||||||
|
</storageModule>
|
||||||
|
</cconfiguration>
|
||||||
|
<cconfiguration id="cmake4eclipse.mbs.toolchain.cmake.134761605.1785168986">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cmake4eclipse.mbs.toolchain.cmake.134761605.1785168986" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.PE64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactName="${ProjName}" buildProperties="" description="" id="cmake4eclipse.mbs.toolchain.cmake.134761605.1785168986" name="Release" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||||
|
<folderInfo id="cmake4eclipse.mbs.toolchain.cmake.134761605.1785168986." name="/" resourcePath="">
|
||||||
|
<toolChain id="cmake4eclipse.mbs.toolchain.cmake.16485475" name="CMake driven" superClass="cmake4eclipse.mbs.toolchain.cmake">
|
||||||
|
<targetPlatform id="cmake4eclipse.mbs.targetPlatform.cmake.1713261153" name="Any Platform" superClass="cmake4eclipse.mbs.targetPlatform.cmake"/>
|
||||||
|
<builder buildPath="/SystemC-Components-Test/build/Debug" id="cmake4eclipse.mbs.builder.322228822" keepEnvironmentInBuildfile="false" name="CMake Builder" superClass="cmake4eclipse.mbs.builder"/>
|
||||||
|
<tool id="cmake4eclipse.mbs.toolchain.tool.dummy.944613359" name="CMake" superClass="cmake4eclipse.mbs.toolchain.tool.dummy">
|
||||||
|
<inputType id="cmake4eclipse.mbs.inputType.c.1854920030" superClass="cmake4eclipse.mbs.inputType.c"/>
|
||||||
|
<inputType id="cmake4eclipse.mbs.inputType.cpp.525905746" superClass="cmake4eclipse.mbs.inputType.cpp"/>
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
<storageModule buildDir="build/${ConfigName}" dirtyTs="1673562408113" moduleId="de.marw.cmake4eclipse.mbs.settings">
|
<storageModule buildDir="build/${ConfigName}" dirtyTs="1673562408113" moduleId="de.marw.cmake4eclipse.mbs.settings">
|
||||||
<options/>
|
<options/>
|
||||||
<defs>
|
<defs>
|
||||||
@ -36,26 +72,56 @@
|
|||||||
</defs>
|
</defs>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
</cconfiguration>
|
</cconfiguration>
|
||||||
|
<cconfiguration id="cmake4eclipse.mbs.toolchain.cmake.134761605.1198783022">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cmake4eclipse.mbs.toolchain.cmake.134761605.1198783022" moduleId="org.eclipse.cdt.core.settings" name="ClangTidy">
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.PE64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactName="${ProjName}" buildProperties="" description="" id="cmake4eclipse.mbs.toolchain.cmake.134761605.1198783022" name="ClangTidy" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.dockerdpath=,org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.connection=ssh://eyck@kraftwerk02:22" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||||
|
<folderInfo id="cmake4eclipse.mbs.toolchain.cmake.134761605.1198783022." name="/" resourcePath="">
|
||||||
|
<toolChain id="cmake4eclipse.mbs.toolchain.cmake.1529597056" name="CMake driven" superClass="cmake4eclipse.mbs.toolchain.cmake">
|
||||||
|
<targetPlatform id="cmake4eclipse.mbs.targetPlatform.cmake.157305521" name="Any Platform" superClass="cmake4eclipse.mbs.targetPlatform.cmake"/>
|
||||||
|
<builder buildPath="/SystemC-Components-Test/build/Debug" id="cmake4eclipse.mbs.builder.407860995" keepEnvironmentInBuildfile="false" name="CMake Builder" superClass="cmake4eclipse.mbs.builder"/>
|
||||||
|
<tool id="cmake4eclipse.mbs.toolchain.tool.dummy.1269675407" name="CMake" superClass="cmake4eclipse.mbs.toolchain.tool.dummy">
|
||||||
|
<inputType id="cmake4eclipse.mbs.inputType.c.2145364949" superClass="cmake4eclipse.mbs.inputType.c"/>
|
||||||
|
<inputType id="cmake4eclipse.mbs.inputType.cpp.143816444" superClass="cmake4eclipse.mbs.inputType.cpp"/>
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
|
<storageModule buildDir="build/${ConfigName}" dirtyTs="1703253448607" moduleId="de.marw.cmake4eclipse.mbs.settings">
|
||||||
|
<options/>
|
||||||
|
<defs>
|
||||||
|
<def name="CMAKE_BUILD_TYPE" type="STRING" val="Debug"/>
|
||||||
|
<def name="BUILD_SCC_DOCUMENTATION" type="BOOL" val="OFF"/>
|
||||||
|
<def name="ENABLE_CLANG_TIDY" type="STRING" val="ON"/>
|
||||||
|
</defs>
|
||||||
|
</storageModule>
|
||||||
|
</cconfiguration>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
<project id="SystemC-Components-Test.null.276784792" name="SystemC-Components-Test"/>
|
<project id="SystemC-Components-Test.null.276784792" name="SystemC-Components-Test"/>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||||
|
<configuration configurationName="ClangTidy">
|
||||||
|
<resource resourceType="PROJECT" workspacePath="/SystemC-Components-Test"/>
|
||||||
|
</configuration>
|
||||||
<configuration configurationName="Default">
|
<configuration configurationName="Default">
|
||||||
<resource resourceType="PROJECT" workspacePath="/SystemC-Components-Test"/>
|
<resource resourceType="PROJECT" workspacePath="/SystemC-Components-Test"/>
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration configurationName="Debug"/>
|
<configuration configurationName="Debug"/>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="scannerConfiguration">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
|
||||||
<scannerConfigBuildInfo instanceId="cmake4eclipse.mbs.toolchain.cmake.134761605;cmake4eclipse.mbs.toolchain.cmake.134761605.1159094612;cmake4eclipse.mbs.toolchain.tool.dummy.326050058;cmake4eclipse.mbs.inputType.cpp.459033018">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
|
||||||
</scannerConfigBuildInfo>
|
|
||||||
<scannerConfigBuildInfo instanceId="cmake4eclipse.mbs.toolchain.cmake.134761605;cmake4eclipse.mbs.toolchain.cmake.134761605.1159094612;cmake4eclipse.mbs.toolchain.tool.dummy.326050058;cmake4eclipse.mbs.inputType.c.1524512146">
|
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
|
||||||
</scannerConfigBuildInfo>
|
|
||||||
</storageModule>
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
||||||
<buildTargets>
|
<buildTargets>
|
||||||
@ -69,4 +135,24 @@
|
|||||||
</target>
|
</target>
|
||||||
</buildTargets>
|
</buildTargets>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
|
<storageModule cmakelistsFolder="" moduleId="de.marw.cmake4eclipse.mbs.settings">
|
||||||
|
<targets>
|
||||||
|
<target name=""/>
|
||||||
|
</targets>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="scannerConfiguration">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
<scannerConfigBuildInfo instanceId="cmake4eclipse.mbs.toolchain.cmake.134761605;cmake4eclipse.mbs.toolchain.cmake.134761605.1159094612;cmake4eclipse.mbs.toolchain.tool.dummy.326050058;cmake4eclipse.mbs.inputType.c.1524512146">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cmake4eclipse.mbs.toolchain.cmake.134761605.1198783022;cmake4eclipse.mbs.toolchain.cmake.134761605.1198783022.;cmake4eclipse.mbs.toolchain.tool.dummy.1269675407;cmake4eclipse.mbs.inputType.c.2145364949">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cmake4eclipse.mbs.toolchain.cmake.134761605;cmake4eclipse.mbs.toolchain.cmake.134761605.1159094612;cmake4eclipse.mbs.toolchain.tool.dummy.326050058;cmake4eclipse.mbs.inputType.cpp.459033018">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cmake4eclipse.mbs.toolchain.cmake.134761605.1198783022;cmake4eclipse.mbs.toolchain.cmake.134761605.1198783022.;cmake4eclipse.mbs.toolchain.tool.dummy.1269675407;cmake4eclipse.mbs.inputType.cpp.143816444">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
</storageModule>
|
||||||
</cproject>
|
</cproject>
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -43,3 +43,4 @@
|
|||||||
/*.fst
|
/*.fst
|
||||||
/*.gtkw
|
/*.gtkw
|
||||||
/.envrc.*
|
/.envrc.*
|
||||||
|
/.direnv/
|
||||||
|
@ -42,21 +42,21 @@ if(ENABLE_COVERAGE)
|
|||||||
set(COVERAGE_EXCLUDES "osci-lib/scc/*" "/engr/dev/tools/*")
|
set(COVERAGE_EXCLUDES "osci-lib/scc/*" "/engr/dev/tools/*")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_program(CLANG_TIDY_EXE NAMES "clang-tidy-9")
|
find_program(CLANG_TIDY_EXE NAMES "clang-tidy")
|
||||||
if(ENABLE_CLANG_TIDY)
|
if(ENABLE_CLANG_TIDY)
|
||||||
if(CLANG_TIDY_EXE)
|
if(CLANG_TIDY_EXE)
|
||||||
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
|
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
|
||||||
set(CLANG_TIDY_CHECKS "-*,modernize-*,-modernize-use-trailing-return-type,clang-analyzer-core.*,clang-analyzer-cplusplus.*")
|
#set(CLANG_TIDY_CHECKS "-*,modernize-*,-modernize-use-trailing-return-type,clang-analyzer-core.*,clang-analyzer-cplusplus.*")
|
||||||
set(CMAKE_CXX_CLANG_TIDY
|
set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXE};-fix)
|
||||||
${CLANG_TIDY_EXE};
|
|
||||||
-checks=${CLANG_TIDY_CHECKS};
|
|
||||||
-fix;)
|
|
||||||
else()
|
else()
|
||||||
message(AUTHOR_WARNING "clang-tidy not found!")
|
message(AUTHOR_WARNING "clang-tidy not found!")
|
||||||
set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE) # delete it
|
set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE) # delete it
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(CLANG_FORMAT_EXCLUDE_PATTERNS "/third_party/")
|
||||||
|
find_package(ClangFormat)
|
||||||
|
|
||||||
set(CONAN_CMAKE_SILENT_OUTPUT ON)
|
set(CONAN_CMAKE_SILENT_OUTPUT ON)
|
||||||
conan_check()
|
conan_check()
|
||||||
conan_configure(REQUIRES fmt/8.0.1 spdlog/1.9.2 boost/1.75.0 gsl-lite/0.37.0 systemc/2.3.3 catch2/3.1.0 zlib/1.2.11 lz4/1.9.4
|
conan_configure(REQUIRES fmt/8.0.1 spdlog/1.9.2 boost/1.75.0 gsl-lite/0.37.0 systemc/2.3.3 catch2/3.1.0 zlib/1.2.11 lz4/1.9.4
|
||||||
|
2
scc
2
scc
@ -1 +1 @@
|
|||||||
Subproject commit ffa0f2f7ef98790984fa3786c36b8778c5b52237
|
Subproject commit 6063f8da997247d68aec9422e39c93458f18bba0
|
@ -7,10 +7,9 @@ auto factory::get_instance() -> factory& {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory::factory() :
|
factory::factory()
|
||||||
m_constructors{},
|
: m_constructors{}
|
||||||
m_objects{}
|
, m_objects{} {}
|
||||||
{ }
|
|
||||||
|
|
||||||
void factory::create() {
|
void factory::create() {
|
||||||
for(const auto& item : m_constructors) {
|
for(const auto& item : m_constructors) {
|
||||||
@ -18,19 +17,15 @@ void factory::create() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void factory::destroy() {
|
void factory::destroy() { m_objects.clear(); }
|
||||||
m_objects.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void factory::add_object(const std::string& name, constructor create) {
|
void factory::add_object(const std::string& name, constructor create) {
|
||||||
auto it = m_constructors.find(name);
|
auto it = m_constructors.find(name);
|
||||||
|
|
||||||
if(it == m_constructors.cend()) {
|
if(it == m_constructors.cend()) {
|
||||||
m_constructors[name] = create;
|
m_constructors[name] = create;
|
||||||
}
|
} else {
|
||||||
else {
|
throw std::runtime_error("factory::add(): " + name + " object already exist in factory");
|
||||||
throw std::runtime_error("factory::add(): "
|
|
||||||
+ name + " object already exist in factory");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,8 +33,7 @@ auto factory::get_object(const std::string& name) -> void* {
|
|||||||
auto it = m_objects.find(name);
|
auto it = m_objects.find(name);
|
||||||
|
|
||||||
if(it == m_objects.cend()) {
|
if(it == m_objects.cend()) {
|
||||||
throw std::runtime_error("factory::get(): "
|
throw std::runtime_error("factory::get(): " + name + " object doesn't exist in factory");
|
||||||
+ name + " object doesn't exist in factory");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return it->second.get();
|
return it->second.get();
|
||||||
|
@ -9,29 +9,28 @@
|
|||||||
#ifndef SRC_FACTORY_H_
|
#ifndef SRC_FACTORY_H_
|
||||||
#define SRC_FACTORY_H_
|
#define SRC_FACTORY_H_
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <string>
|
|
||||||
#include <memory>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class factory {
|
class factory {
|
||||||
public:
|
public:
|
||||||
static factory& get_instance();
|
static factory& get_instance();
|
||||||
|
|
||||||
template<typename T, typename ...Args>
|
template <typename T, typename... Args> class add {
|
||||||
class add {
|
|
||||||
public:
|
public:
|
||||||
add(Args&&... args);
|
add(Args&&... args);
|
||||||
|
|
||||||
add(const std::string& name, Args&&... args);
|
add(const std::string& name, Args&&... args);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template <typename T> static T& get(const std::string& name = "");
|
||||||
static T& get(const std::string& name = "");
|
|
||||||
|
|
||||||
void create();
|
void create();
|
||||||
|
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using destructor = std::function<void(void*)>;
|
using destructor = std::function<void(void*)>;
|
||||||
using object = std::unique_ptr<void, destructor>;
|
using object = std::unique_ptr<void, destructor>;
|
||||||
@ -51,27 +50,15 @@ private:
|
|||||||
std::map<std::string, object> m_objects;
|
std::map<std::string, object> m_objects;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T, typename ...Args>
|
template <typename T, typename... Args> factory::add<T, Args...>::add(Args&&... args) { add("", args...); }
|
||||||
factory::add<T, Args...>::add(Args&&... args) {
|
|
||||||
add("", args...);
|
template <typename T, typename... Args> factory::add<T, Args...>::add(const std::string& name, Args&&... args) {
|
||||||
|
factory::get_instance().add_object(name, [args...]() -> object {
|
||||||
|
return object{new T(std::forward<Args>(args)...), [](void* obj) { delete static_cast<T*>(obj); }};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename ...Args>
|
template <typename T> auto factory::get(const std::string& name) -> T& {
|
||||||
factory::add<T, Args...>::add(const std::string& name, Args&&... args) {
|
|
||||||
factory::get_instance().add_object(name,
|
|
||||||
[args...] () -> object {
|
|
||||||
return object{
|
|
||||||
new T(std::forward<Args>(args)...),
|
|
||||||
[] (void* obj) {
|
|
||||||
delete static_cast<T*>(obj);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T> auto
|
|
||||||
factory::get(const std::string& name) -> T& {
|
|
||||||
return *static_cast<T*>(factory::get_instance().get_object(name));
|
return *static_cast<T*>(factory::get_instance().get_object(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
#include "factory.h"
|
#include "factory.h"
|
||||||
#include <catch2/catch_session.hpp>
|
#include <catch2/catch_session.hpp>
|
||||||
|
#include <cstdlib>
|
||||||
#include <scc/report.h>
|
#include <scc/report.h>
|
||||||
#include <scc/trace.h>
|
#include <scc/trace.h>
|
||||||
#include <scc/tracer.h>
|
#include <scc/tracer.h>
|
||||||
#include <util/ities.h>
|
#include <util/ities.h>
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
using namespace scc;
|
using namespace scc;
|
||||||
using namespace sc_core;
|
using namespace sc_core;
|
||||||
|
@ -12,7 +12,7 @@ factory::add<testbench> tb;
|
|||||||
|
|
||||||
int snoop_id = 0;
|
int snoop_id = 0;
|
||||||
|
|
||||||
bool operator==(tlm::tlm_generic_payload const& a, tlm::tlm_generic_payload const& b){
|
bool is_equal(tlm::tlm_generic_payload const& a, tlm::tlm_generic_payload const& b) {
|
||||||
auto ret = true;
|
auto ret = true;
|
||||||
ret &= a.get_command() == b.get_command();
|
ret &= a.get_command() == b.get_command();
|
||||||
ret &= a.get_address() == b.get_address();
|
ret &= a.get_address() == b.get_address();
|
||||||
@ -55,16 +55,13 @@ tlm::tlm_generic_payload* prepare_trans_ace(uint64_t start_address, unsigned add
|
|||||||
|
|
||||||
inline void randomize(tlm::tlm_generic_payload& gp) {
|
inline void randomize(tlm::tlm_generic_payload& gp) {
|
||||||
static uint8_t req_cnt{0};
|
static uint8_t req_cnt{0};
|
||||||
auto addr = gp.get_address();
|
|
||||||
uint8_t const* src = reinterpret_cast<uint8_t const*>(&addr);
|
|
||||||
for(size_t i = 0; i < gp.get_data_length(); ++i) {
|
for(size_t i = 0; i < gp.get_data_length(); ++i) {
|
||||||
*(gp.get_data_ptr() + i) = i % 2 ? i : req_cnt;
|
*(gp.get_data_ptr() + i) = i % 2 ? i : req_cnt;
|
||||||
}
|
}
|
||||||
req_cnt++;
|
req_cnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename STATE>
|
template <typename STATE> unsigned run_scenario(STATE& state) {
|
||||||
unsigned run_scenario(STATE& state){
|
|
||||||
auto& dut = factory::get<testbench>();
|
auto& dut = factory::get<testbench>();
|
||||||
|
|
||||||
dut.axi_tgt_pe.set_operation_cb([&state](axi::axi_protocol_types::tlm_payload_type& trans) -> unsigned {
|
dut.axi_tgt_pe.set_operation_cb([&state](axi::axi_protocol_types::tlm_payload_type& trans) -> unsigned {
|
||||||
@ -102,8 +99,10 @@ unsigned run_scenario(STATE& state){
|
|||||||
auto run1 = sc_spawn([&dut, &state]() {
|
auto run1 = sc_spawn([&dut, &state]() {
|
||||||
unsigned int StartAddr{0x0};
|
unsigned int StartAddr{0x0};
|
||||||
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
||||||
// tlm::scc::tlm_gp_shared_ptr trans = prepare_trans<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 1);
|
// tlm::scc::tlm_gp_shared_ptr trans = prepare_trans<testbench::bus_cfg>(StartAddr, 4,
|
||||||
tlm::scc::tlm_gp_shared_ptr trans = prepare_trans_ace<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 1);
|
// state.BurstLengthByte, state.BurstSizeBytes, 1);
|
||||||
|
tlm::scc::tlm_gp_shared_ptr trans =
|
||||||
|
prepare_trans_ace<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 1);
|
||||||
trans->set_command(tlm::TLM_READ_COMMAND);
|
trans->set_command(tlm::TLM_READ_COMMAND);
|
||||||
SCCDEBUG(__FUNCTION__) << "run1, iteration " << i << " TX: " << *trans;
|
SCCDEBUG(__FUNCTION__) << "run1, iteration " << i << " TX: " << *trans;
|
||||||
dut.intor_pe.transport(*trans, false);
|
dut.intor_pe.transport(*trans, false);
|
||||||
@ -115,7 +114,8 @@ unsigned run_scenario(STATE& state){
|
|||||||
auto run2 = sc_spawn([&dut, &state]() {
|
auto run2 = sc_spawn([&dut, &state]() {
|
||||||
unsigned int StartAddr{0x2000};
|
unsigned int StartAddr{0x2000};
|
||||||
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
||||||
tlm::scc::tlm_gp_shared_ptr trans = prepare_trans_ace<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 2);
|
tlm::scc::tlm_gp_shared_ptr trans =
|
||||||
|
prepare_trans_ace<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 2);
|
||||||
trans->set_command(tlm::TLM_WRITE_COMMAND);
|
trans->set_command(tlm::TLM_WRITE_COMMAND);
|
||||||
randomize(*trans);
|
randomize(*trans);
|
||||||
SCCDEBUG(__FUNCTION__) << "run2, iteration " << i << " TX: " << *trans;
|
SCCDEBUG(__FUNCTION__) << "run2, iteration " << i << " TX: " << *trans;
|
||||||
@ -127,7 +127,8 @@ unsigned run_scenario(STATE& state){
|
|||||||
auto run3 = sc_spawn([&dut, &state]() {
|
auto run3 = sc_spawn([&dut, &state]() {
|
||||||
unsigned int StartAddr{0x1000};
|
unsigned int StartAddr{0x1000};
|
||||||
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
||||||
tlm::scc::tlm_gp_shared_ptr trans = prepare_trans_ace<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 3);
|
tlm::scc::tlm_gp_shared_ptr trans =
|
||||||
|
prepare_trans_ace<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 3);
|
||||||
trans->set_command(tlm::TLM_READ_COMMAND);
|
trans->set_command(tlm::TLM_READ_COMMAND);
|
||||||
SCCDEBUG(__FUNCTION__) << "run3, iteration " << i << " TX: " << *trans;
|
SCCDEBUG(__FUNCTION__) << "run3, iteration " << i << " TX: " << *trans;
|
||||||
dut.intor_pe.transport(*trans, false);
|
dut.intor_pe.transport(*trans, false);
|
||||||
@ -138,7 +139,8 @@ unsigned run_scenario(STATE& state){
|
|||||||
auto run4 = sc_spawn([&dut, &state]() {
|
auto run4 = sc_spawn([&dut, &state]() {
|
||||||
unsigned int StartAddr{0x3000};
|
unsigned int StartAddr{0x3000};
|
||||||
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
||||||
tlm::scc::tlm_gp_shared_ptr trans = prepare_trans_ace<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 4);
|
tlm::scc::tlm_gp_shared_ptr trans =
|
||||||
|
prepare_trans_ace<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 4);
|
||||||
trans->set_command(tlm::TLM_WRITE_COMMAND);
|
trans->set_command(tlm::TLM_WRITE_COMMAND);
|
||||||
randomize(*trans);
|
randomize(*trans);
|
||||||
SCCDEBUG(__FUNCTION__) << "run4, iteration " << i << " TX: " << *trans;
|
SCCDEBUG(__FUNCTION__) << "run4, iteration " << i << " TX: " << *trans;
|
||||||
@ -148,11 +150,11 @@ unsigned run_scenario(STATE& state){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
auto run5 = sc_spawn([&dut, &state]() {
|
auto run5 = sc_spawn([&dut, &state]() {
|
||||||
unsigned int StartAddr{0x0};
|
unsigned int StartAddr{0x0};
|
||||||
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
||||||
tlm::scc::tlm_gp_shared_ptr trans = prepare_trans_ace<testbench::bus_cfg>(StartAddr, 4, state.CachelineSizeBytes, state.BurstSizeBytes, 5);
|
tlm::scc::tlm_gp_shared_ptr trans =
|
||||||
|
prepare_trans_ace<testbench::bus_cfg>(StartAddr, 4, state.CachelineSizeBytes, state.BurstSizeBytes, 5);
|
||||||
trans->set_command(tlm::TLM_READ_COMMAND);
|
trans->set_command(tlm::TLM_READ_COMMAND);
|
||||||
SCCDEBUG(__FUNCTION__) << "run1, iteration " << i << "snoop_id = " << snoop_id << " TX: " << *trans;
|
SCCDEBUG(__FUNCTION__) << "run1, iteration " << i << "snoop_id = " << snoop_id << " TX: " << *trans;
|
||||||
dut.ace_tgt_pe.snoop(*trans);
|
dut.ace_tgt_pe.snoop(*trans);
|
||||||
@ -163,7 +165,6 @@ unsigned run_scenario(STATE& state){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
unsigned cycles{0};
|
unsigned cycles{0};
|
||||||
while(cycles < 1000 && !(run1.terminated() && run2.terminated() && run3.terminated() && run4.terminated())) {
|
while(cycles < 1000 && !(run1.terminated() && run2.terminated() && run3.terminated() && run4.terminated())) {
|
||||||
// while(cycles<1000 && !(run5.terminated())){
|
// while(cycles<1000 && !(run5.terminated())){
|
||||||
@ -181,15 +182,17 @@ TEST_CASE("ace_burst_alignment", "[AXI][pin-level]") {
|
|||||||
unsigned int NumberOfIterations{2};
|
unsigned int NumberOfIterations{2};
|
||||||
unsigned int CachelineSizeBytes = {64}; //
|
unsigned int CachelineSizeBytes = {64}; //
|
||||||
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>> read_tx;
|
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>> read_tx;
|
||||||
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>> write_tx;
|
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>>
|
||||||
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>> snoop_tx;
|
write_tx;
|
||||||
|
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>>
|
||||||
|
snoop_tx;
|
||||||
unsigned resp_cnt{0};
|
unsigned resp_cnt{0};
|
||||||
} state;
|
} state;
|
||||||
|
|
||||||
state.resp_cnt = 0;
|
state.resp_cnt = 0;
|
||||||
auto cycles = run_scenario(state);
|
auto cycles = run_scenario(state);
|
||||||
|
|
||||||
// REQUIRE(cycles<1000);
|
REQUIRE(cycles < 1000);
|
||||||
REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0);
|
REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0);
|
||||||
REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0);
|
REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0);
|
||||||
|
|
||||||
@ -201,9 +204,8 @@ TEST_CASE("ace_burst_alignment", "[AXI][pin-level]") {
|
|||||||
REQUIRE(send_tx.size() == recv_tx.size());
|
REQUIRE(send_tx.size() == recv_tx.size());
|
||||||
for(auto i = 0; i < send_tx.size(); ++i) {
|
for(auto i = 0; i < send_tx.size(); ++i) {
|
||||||
REQUIRE(send_tx[i]->get_response_status() == tlm::TLM_OK_RESPONSE);
|
REQUIRE(send_tx[i]->get_response_status() == tlm::TLM_OK_RESPONSE);
|
||||||
CHECK(*send_tx[i] == *recv_tx[i]);
|
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto& e : state.read_tx) {
|
for(auto& e : state.read_tx) {
|
||||||
@ -215,7 +217,7 @@ TEST_CASE("ace_burst_alignment", "[AXI][pin-level]") {
|
|||||||
SCCDEBUG(__FUNCTION__) << " index = " << i;
|
SCCDEBUG(__FUNCTION__) << " index = " << i;
|
||||||
// SCCDEBUG(__FUNCTION__) <<" send value = "<<*send_tx[i];
|
// SCCDEBUG(__FUNCTION__) <<" send value = "<<*send_tx[i];
|
||||||
// SCCDEBUG(__FUNCTION__) <<" received value = "<<*recv_tx[i];
|
// SCCDEBUG(__FUNCTION__) <<" received value = "<<*recv_tx[i];
|
||||||
CHECK(*send_tx[i] == *recv_tx[i]);
|
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +233,6 @@ TEST_CASE("ace_burst_alignment", "[AXI][pin-level]") {
|
|||||||
// CHECK(*snoop_tx[i] == *recv_tx[i]);
|
// CHECK(*snoop_tx[i] == *recv_tx[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("ace_narrow_burst", "[AXI][pin-level]") {
|
TEST_CASE("ace_narrow_burst", "[AXI][pin-level]") {
|
||||||
@ -242,8 +243,10 @@ TEST_CASE("ace_narrow_burst", "[AXI][pin-level]") {
|
|||||||
unsigned int NumberOfIterations{2};
|
unsigned int NumberOfIterations{2};
|
||||||
unsigned int CachelineSizeBytes = {64}; //
|
unsigned int CachelineSizeBytes = {64}; //
|
||||||
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>> read_tx;
|
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>> read_tx;
|
||||||
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>> write_tx;
|
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>>
|
||||||
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>> snoop_tx;
|
write_tx;
|
||||||
|
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>>
|
||||||
|
snoop_tx;
|
||||||
unsigned resp_cnt{0};
|
unsigned resp_cnt{0};
|
||||||
} state;
|
} state;
|
||||||
|
|
||||||
@ -260,17 +263,13 @@ TEST_CASE("ace_narrow_burst", "[AXI][pin-level]") {
|
|||||||
auto const& recv_tx = e.second.second;
|
auto const& recv_tx = e.second.second;
|
||||||
REQUIRE(send_tx.size() == recv_tx.size());
|
REQUIRE(send_tx.size() == recv_tx.size());
|
||||||
for(auto i = 0; i < send_tx.size(); ++i)
|
for(auto i = 0; i < send_tx.size(); ++i)
|
||||||
CHECK(*send_tx[i] == *recv_tx[i]);
|
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
||||||
|
|
||||||
}
|
}
|
||||||
for(auto& e : state.read_tx) {
|
for(auto& e : state.read_tx) {
|
||||||
auto const& send_tx = e.second.first;
|
auto const& send_tx = e.second.first;
|
||||||
auto const& recv_tx = e.second.second;
|
auto const& recv_tx = e.second.second;
|
||||||
REQUIRE(send_tx.size() == recv_tx.size());
|
REQUIRE(send_tx.size() == recv_tx.size());
|
||||||
for(auto i = 0; i < send_tx.size(); ++i)
|
for(auto i = 0; i < send_tx.size(); ++i)
|
||||||
CHECK(*send_tx[i] == *recv_tx[i]);
|
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#define _TESTBENCH_H_
|
#define _TESTBENCH_H_
|
||||||
|
|
||||||
#include <axi/pe/axi_initiator.h>
|
#include <axi/pe/axi_initiator.h>
|
||||||
#include <axi/pe/simple_target.h>
|
|
||||||
#include <axi/pe/simple_ace_target.h>
|
#include <axi/pe/simple_ace_target.h>
|
||||||
|
#include <axi/pe/simple_target.h>
|
||||||
#include <axi/pin/ace_initiator.h>
|
#include <axi/pin/ace_initiator.h>
|
||||||
#include <axi/pin/ace_target.h>
|
#include <axi/pin/ace_target.h>
|
||||||
#include <axi/scv/recorder_modules.h>
|
#include <axi/scv/recorder_modules.h>
|
||||||
@ -13,8 +13,7 @@ using namespace sc_core;
|
|||||||
using namespace axi;
|
using namespace axi;
|
||||||
using namespace axi::pe;
|
using namespace axi::pe;
|
||||||
|
|
||||||
class testbench : public sc_core::sc_module
|
class testbench : public sc_core::sc_module, public tlm::scc::pe::intor_bw_b {
|
||||||
,public tlm::scc::pe::intor_bw_b {
|
|
||||||
public:
|
public:
|
||||||
using bus_cfg = axi::ace_cfg</*BUSWIDTH=*/64, /*ADDRWIDTH=*/32, /*IDWIDTH=*/4, /*USERWIDTH=*/1, /*CACHELINE*/ 64>;
|
using bus_cfg = axi::ace_cfg</*BUSWIDTH=*/64, /*ADDRWIDTH=*/32, /*IDWIDTH=*/4, /*USERWIDTH=*/1, /*CACHELINE*/ 64>;
|
||||||
|
|
||||||
@ -47,7 +46,8 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SC_HAS_PROCESS(testbench);
|
SC_HAS_PROCESS(testbench);
|
||||||
testbench(): testbench("testbench") {}
|
testbench()
|
||||||
|
: testbench("testbench") {}
|
||||||
testbench(sc_core::sc_module_name nm)
|
testbench(sc_core::sc_module_name nm)
|
||||||
: sc_core::sc_module(nm)
|
: sc_core::sc_module(nm)
|
||||||
, intor_pe("ace_intor_pe", intor)
|
, intor_pe("ace_intor_pe", intor)
|
||||||
@ -90,10 +90,14 @@ public:
|
|||||||
ace_tgt_pe.isckt_axi(tgt_axi);
|
ace_tgt_pe.isckt_axi(tgt_axi);
|
||||||
// for updating snooop transaction
|
// for updating snooop transaction
|
||||||
intor_pe.bw_o(bw_i);
|
intor_pe.bw_o(bw_i);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned transport(tlm::tlm_generic_payload& trans) override { if(transport_cb) return transport_cb(trans); else return 0;}
|
unsigned transport(tlm::tlm_generic_payload& trans) override {
|
||||||
|
if(transport_cb)
|
||||||
|
return transport_cb(trans);
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
std::function<unsigned(tlm::tlm_generic_payload&)> transport_cb;
|
std::function<unsigned(tlm::tlm_generic_payload&)> transport_cb;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -10,8 +10,7 @@ using namespace sc_core;
|
|||||||
using namespace ahb;
|
using namespace ahb;
|
||||||
|
|
||||||
factory::add<testbench> tb;
|
factory::add<testbench> tb;
|
||||||
|
bool is_equal(tlm::tlm_generic_payload const& a, tlm::tlm_generic_payload const& b) {
|
||||||
bool operator==(tlm::tlm_generic_payload const& a, tlm::tlm_generic_payload const& b){
|
|
||||||
auto ret = true;
|
auto ret = true;
|
||||||
ret &= a.get_command() == b.get_command();
|
ret &= a.get_command() == b.get_command();
|
||||||
ret &= a.get_address() == b.get_address();
|
ret &= a.get_address() == b.get_address();
|
||||||
@ -27,9 +26,7 @@ bool operator==(tlm::tlm_generic_payload const& a, tlm::tlm_generic_payload cons
|
|||||||
// if(!ret) SCCWARN()<<"Comparison failed: "<<a<<" and "<<b;
|
// if(!ret) SCCWARN()<<"Comparison failed: "<<a<<" and "<<b;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
template <unsigned BUSWIDTH> tlm::tlm_generic_payload* prepare_trans(uint64_t start_address, unsigned len, unsigned width) {
|
||||||
template<unsigned BUSWIDTH>
|
|
||||||
tlm::tlm_generic_payload* prepare_trans(uint64_t start_address, unsigned len, unsigned width) {
|
|
||||||
static unsigned id{0};
|
static unsigned id{0};
|
||||||
auto trans = tlm::scc::tlm_mm<>::get().allocate<ahb::ahb_extension>(len);
|
auto trans = tlm::scc::tlm_mm<>::get().allocate<ahb::ahb_extension>(len);
|
||||||
trans->set_address(start_address);
|
trans->set_address(start_address);
|
||||||
@ -43,16 +40,13 @@ tlm::tlm_generic_payload* prepare_trans(uint64_t start_address, unsigned len, un
|
|||||||
|
|
||||||
inline void randomize(tlm::tlm_generic_payload& gp) {
|
inline void randomize(tlm::tlm_generic_payload& gp) {
|
||||||
static uint8_t req_cnt{0};
|
static uint8_t req_cnt{0};
|
||||||
auto addr = gp.get_address();
|
|
||||||
uint8_t const* src = reinterpret_cast<uint8_t const*>(&addr);
|
|
||||||
for(size_t i = 0; i < gp.get_data_length(); ++i) {
|
for(size_t i = 0; i < gp.get_data_length(); ++i) {
|
||||||
*(gp.get_data_ptr() + i) = i % 2 ? i : req_cnt;
|
*(gp.get_data_ptr() + i) = i % 2 ? i : req_cnt;
|
||||||
}
|
}
|
||||||
req_cnt++;
|
req_cnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename STATE>
|
template <typename STATE> unsigned run_scenario(STATE& state, unsigned wait_states = 0) {
|
||||||
unsigned run_scenario(STATE& state, unsigned wait_states = 0){
|
|
||||||
auto& dut = factory::get<testbench>();
|
auto& dut = factory::get<testbench>();
|
||||||
dut.tsck.register_b_transport([&state, wait_states](tlm::tlm_base_protocol_types::tlm_payload_type& trans, sc_core::sc_time& d) {
|
dut.tsck.register_b_transport([&state, wait_states](tlm::tlm_base_protocol_types::tlm_payload_type& trans, sc_core::sc_time& d) {
|
||||||
if(trans.is_read()) {
|
if(trans.is_read()) {
|
||||||
@ -165,7 +159,7 @@ TEST_CASE("ahb_read_write", "[AHB][pin-level]") {
|
|||||||
REQUIRE(send_tx.size() == recv_tx.size());
|
REQUIRE(send_tx.size() == recv_tx.size());
|
||||||
for(auto i = 0; i < send_tx.size(); ++i) {
|
for(auto i = 0; i < send_tx.size(); ++i) {
|
||||||
REQUIRE(send_tx[i]->get_response_status() == tlm::TLM_OK_RESPONSE);
|
REQUIRE(send_tx[i]->get_response_status() == tlm::TLM_OK_RESPONSE);
|
||||||
CHECK(*send_tx[i] == *recv_tx[i]);
|
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -175,7 +169,7 @@ TEST_CASE("ahb_read_write", "[AHB][pin-level]") {
|
|||||||
REQUIRE(send_tx.size() == recv_tx.size());
|
REQUIRE(send_tx.size() == recv_tx.size());
|
||||||
for(auto i = 0; i < send_tx.size(); ++i) {
|
for(auto i = 0; i < send_tx.size(); ++i) {
|
||||||
REQUIRE(send_tx[i]->get_response_status() == tlm::TLM_OK_RESPONSE);
|
REQUIRE(send_tx[i]->get_response_status() == tlm::TLM_OK_RESPONSE);
|
||||||
CHECK(*send_tx[i] == *recv_tx[i]);
|
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -204,8 +198,7 @@ TEST_CASE("ahb_narrow_read_write", "[AHB][pin-level]") {
|
|||||||
auto const& recv_tx = e.second;
|
auto const& recv_tx = e.second;
|
||||||
REQUIRE(send_tx.size() == recv_tx.size());
|
REQUIRE(send_tx.size() == recv_tx.size());
|
||||||
for(auto i = 0; i < send_tx.size(); ++i)
|
for(auto i = 0; i < send_tx.size(); ++i)
|
||||||
CHECK(*send_tx[i] == *recv_tx[i]);
|
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
||||||
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto& e = state.read_tx;
|
auto& e = state.read_tx;
|
||||||
@ -213,8 +206,7 @@ TEST_CASE("ahb_narrow_read_write", "[AHB][pin-level]") {
|
|||||||
auto const& recv_tx = e.second;
|
auto const& recv_tx = e.second;
|
||||||
REQUIRE(send_tx.size() == recv_tx.size());
|
REQUIRE(send_tx.size() == recv_tx.size());
|
||||||
for(auto i = 0; i < send_tx.size(); ++i)
|
for(auto i = 0; i < send_tx.size(); ++i)
|
||||||
CHECK(*send_tx[i] == *recv_tx[i]);
|
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +235,7 @@ TEST_CASE("ahb_delayed_read_write", "[AHB][pin-level]") {
|
|||||||
REQUIRE(send_tx.size() == recv_tx.size());
|
REQUIRE(send_tx.size() == recv_tx.size());
|
||||||
for(auto i = 0; i < send_tx.size(); ++i) {
|
for(auto i = 0; i < send_tx.size(); ++i) {
|
||||||
REQUIRE(send_tx[i]->get_response_status() == tlm::TLM_OK_RESPONSE);
|
REQUIRE(send_tx[i]->get_response_status() == tlm::TLM_OK_RESPONSE);
|
||||||
CHECK(*send_tx[i] == *recv_tx[i]);
|
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -253,8 +245,7 @@ TEST_CASE("ahb_delayed_read_write", "[AHB][pin-level]") {
|
|||||||
REQUIRE(send_tx.size() == recv_tx.size());
|
REQUIRE(send_tx.size() == recv_tx.size());
|
||||||
for(auto i = 0; i < send_tx.size(); ++i) {
|
for(auto i = 0; i < send_tx.size(); ++i) {
|
||||||
REQUIRE(send_tx[i]->get_response_status() == tlm::TLM_OK_RESPONSE);
|
REQUIRE(send_tx[i]->get_response_status() == tlm::TLM_OK_RESPONSE);
|
||||||
CHECK(*send_tx[i] == *recv_tx[i]);
|
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SC_HAS_PROCESS(testbench);
|
SC_HAS_PROCESS(testbench);
|
||||||
testbench(): testbench("testbench") {}
|
testbench()
|
||||||
|
: testbench("testbench") {}
|
||||||
testbench(sc_core::sc_module_name nm)
|
testbench(sc_core::sc_module_name nm)
|
||||||
: sc_core::sc_module(nm) {
|
: sc_core::sc_module(nm) {
|
||||||
intor_bfm.HCLK_i(clk);
|
intor_bfm.HCLK_i(clk);
|
||||||
@ -71,9 +72,7 @@ public:
|
|||||||
tgt_bfm.isckt(tsck);
|
tgt_bfm.isckt(tsck);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void run1() {}
|
||||||
void run1() {
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _TESTBENCH_H_
|
#endif // _TESTBENCH_H_
|
||||||
|
@ -10,7 +10,7 @@ using namespace sc_core;
|
|||||||
|
|
||||||
factory::add<testbench> tb;
|
factory::add<testbench> tb;
|
||||||
|
|
||||||
bool operator==(tlm::tlm_generic_payload const& a, tlm::tlm_generic_payload const& b){
|
bool is_equal(tlm::tlm_generic_payload const& a, tlm::tlm_generic_payload const& b) {
|
||||||
auto ret = true;
|
auto ret = true;
|
||||||
ret &= a.get_command() == b.get_command();
|
ret &= a.get_command() == b.get_command();
|
||||||
ret &= a.get_address() == b.get_address();
|
ret &= a.get_address() == b.get_address();
|
||||||
@ -49,16 +49,13 @@ tlm::tlm_generic_payload* prepare_trans(uint64_t start_address, unsigned addr_in
|
|||||||
|
|
||||||
inline void randomize(tlm::tlm_generic_payload& gp) {
|
inline void randomize(tlm::tlm_generic_payload& gp) {
|
||||||
static uint8_t req_cnt{0};
|
static uint8_t req_cnt{0};
|
||||||
auto addr = gp.get_address();
|
|
||||||
uint8_t const* src = reinterpret_cast<uint8_t const*>(&addr);
|
|
||||||
for(size_t i = 0; i < gp.get_data_length(); ++i) {
|
for(size_t i = 0; i < gp.get_data_length(); ++i) {
|
||||||
*(gp.get_data_ptr() + i) = i % 2 ? i : req_cnt;
|
*(gp.get_data_ptr() + i) = i % 2 ? i : req_cnt;
|
||||||
}
|
}
|
||||||
req_cnt++;
|
req_cnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename STATE>
|
template <typename STATE> unsigned run_scenario(STATE& state) {
|
||||||
unsigned run_scenario(STATE& state){
|
|
||||||
auto& dut = factory::get<testbench>();
|
auto& dut = factory::get<testbench>();
|
||||||
dut.tgt_pe.set_operation_cb([&state](axi::axi_protocol_types::tlm_payload_type& trans) -> unsigned {
|
dut.tgt_pe.set_operation_cb([&state](axi::axi_protocol_types::tlm_payload_type& trans) -> unsigned {
|
||||||
auto id = axi::get_axi_id(trans);
|
auto id = axi::get_axi_id(trans);
|
||||||
@ -83,7 +80,8 @@ unsigned run_scenario(STATE& state){
|
|||||||
auto run1 = sc_spawn([&dut, &state]() {
|
auto run1 = sc_spawn([&dut, &state]() {
|
||||||
unsigned int StartAddr{0x0};
|
unsigned int StartAddr{0x0};
|
||||||
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
||||||
tlm::scc::tlm_gp_shared_ptr trans = prepare_trans<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 1);
|
tlm::scc::tlm_gp_shared_ptr trans =
|
||||||
|
prepare_trans<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 1);
|
||||||
trans->set_command(tlm::TLM_READ_COMMAND);
|
trans->set_command(tlm::TLM_READ_COMMAND);
|
||||||
SCCDEBUG(__FUNCTION__) << "run1, iteration " << i << " TX: " << *trans;
|
SCCDEBUG(__FUNCTION__) << "run1, iteration " << i << " TX: " << *trans;
|
||||||
dut.intor_pe.transport(*trans, false);
|
dut.intor_pe.transport(*trans, false);
|
||||||
@ -94,7 +92,8 @@ unsigned run_scenario(STATE& state){
|
|||||||
auto run2 = sc_spawn([&dut, &state]() {
|
auto run2 = sc_spawn([&dut, &state]() {
|
||||||
unsigned int StartAddr{0x2000};
|
unsigned int StartAddr{0x2000};
|
||||||
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
||||||
tlm::scc::tlm_gp_shared_ptr trans = prepare_trans<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 2);
|
tlm::scc::tlm_gp_shared_ptr trans =
|
||||||
|
prepare_trans<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 2);
|
||||||
trans->set_command(tlm::TLM_WRITE_COMMAND);
|
trans->set_command(tlm::TLM_WRITE_COMMAND);
|
||||||
randomize(*trans);
|
randomize(*trans);
|
||||||
SCCDEBUG(__FUNCTION__) << "run2, iteration " << i << " TX: " << *trans;
|
SCCDEBUG(__FUNCTION__) << "run2, iteration " << i << " TX: " << *trans;
|
||||||
@ -106,7 +105,8 @@ unsigned run_scenario(STATE& state){
|
|||||||
auto run3 = sc_spawn([&dut, &state]() {
|
auto run3 = sc_spawn([&dut, &state]() {
|
||||||
unsigned int StartAddr{0x1000};
|
unsigned int StartAddr{0x1000};
|
||||||
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
||||||
tlm::scc::tlm_gp_shared_ptr trans = prepare_trans<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 3);
|
tlm::scc::tlm_gp_shared_ptr trans =
|
||||||
|
prepare_trans<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 3);
|
||||||
trans->set_command(tlm::TLM_READ_COMMAND);
|
trans->set_command(tlm::TLM_READ_COMMAND);
|
||||||
SCCDEBUG(__FUNCTION__) << "run3, iteration " << i << " TX: " << *trans;
|
SCCDEBUG(__FUNCTION__) << "run3, iteration " << i << " TX: " << *trans;
|
||||||
dut.intor_pe.transport(*trans, false);
|
dut.intor_pe.transport(*trans, false);
|
||||||
@ -117,7 +117,8 @@ unsigned run_scenario(STATE& state){
|
|||||||
auto run4 = sc_spawn([&dut, &state]() {
|
auto run4 = sc_spawn([&dut, &state]() {
|
||||||
unsigned int StartAddr{0x3000};
|
unsigned int StartAddr{0x3000};
|
||||||
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
for(int i = 0; i < state.NumberOfIterations; ++i) {
|
||||||
tlm::scc::tlm_gp_shared_ptr trans = prepare_trans<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 4);
|
tlm::scc::tlm_gp_shared_ptr trans =
|
||||||
|
prepare_trans<testbench::bus_cfg>(StartAddr, 4, state.BurstLengthByte, state.BurstSizeBytes, 4);
|
||||||
trans->set_command(tlm::TLM_WRITE_COMMAND);
|
trans->set_command(tlm::TLM_WRITE_COMMAND);
|
||||||
randomize(*trans);
|
randomize(*trans);
|
||||||
SCCDEBUG(__FUNCTION__) << "run4, iteration " << i << " TX: " << *trans;
|
SCCDEBUG(__FUNCTION__) << "run4, iteration " << i << " TX: " << *trans;
|
||||||
@ -142,7 +143,8 @@ TEST_CASE("axi4_burst_alignment", "[AXI][pin-level]") {
|
|||||||
unsigned int BurstSizeBytes{8};
|
unsigned int BurstSizeBytes{8};
|
||||||
unsigned int NumberOfIterations{8};
|
unsigned int NumberOfIterations{8};
|
||||||
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>> read_tx;
|
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>> read_tx;
|
||||||
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>> write_tx;
|
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>>
|
||||||
|
write_tx;
|
||||||
unsigned resp_cnt{0};
|
unsigned resp_cnt{0};
|
||||||
} state;
|
} state;
|
||||||
|
|
||||||
@ -159,9 +161,8 @@ TEST_CASE("axi4_burst_alignment", "[AXI][pin-level]") {
|
|||||||
REQUIRE(send_tx.size() == recv_tx.size());
|
REQUIRE(send_tx.size() == recv_tx.size());
|
||||||
for(auto i = 0; i < send_tx.size(); ++i) {
|
for(auto i = 0; i < send_tx.size(); ++i) {
|
||||||
REQUIRE(send_tx[i]->get_response_status() == tlm::TLM_OK_RESPONSE);
|
REQUIRE(send_tx[i]->get_response_status() == tlm::TLM_OK_RESPONSE);
|
||||||
CHECK(*send_tx[i] == *recv_tx[i]);
|
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
for(auto& e : state.read_tx) {
|
for(auto& e : state.read_tx) {
|
||||||
auto const& send_tx = e.second.first;
|
auto const& send_tx = e.second.first;
|
||||||
@ -169,7 +170,7 @@ TEST_CASE("axi4_burst_alignment", "[AXI][pin-level]") {
|
|||||||
REQUIRE(send_tx.size() == recv_tx.size());
|
REQUIRE(send_tx.size() == recv_tx.size());
|
||||||
for(auto i = 0; i < send_tx.size(); ++i) {
|
for(auto i = 0; i < send_tx.size(); ++i) {
|
||||||
REQUIRE(send_tx[i]->get_response_status() == tlm::TLM_OK_RESPONSE);
|
REQUIRE(send_tx[i]->get_response_status() == tlm::TLM_OK_RESPONSE);
|
||||||
CHECK(*send_tx[i] == *recv_tx[i]);
|
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,7 +182,8 @@ TEST_CASE("axi4_narrow_burst", "[AXI][pin-level]") {
|
|||||||
unsigned int BurstSizeBytes{4};
|
unsigned int BurstSizeBytes{4};
|
||||||
unsigned int NumberOfIterations{8};
|
unsigned int NumberOfIterations{8};
|
||||||
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>> read_tx;
|
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>> read_tx;
|
||||||
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>> write_tx;
|
std::unordered_map<unsigned, std::pair<std::vector<tlm::scc::tlm_gp_shared_ptr>, std::vector<tlm::scc::tlm_gp_shared_ptr>>>
|
||||||
|
write_tx;
|
||||||
unsigned resp_cnt{0};
|
unsigned resp_cnt{0};
|
||||||
} state;
|
} state;
|
||||||
|
|
||||||
@ -197,15 +199,13 @@ TEST_CASE("axi4_narrow_burst", "[AXI][pin-level]") {
|
|||||||
auto const& recv_tx = e.second.second;
|
auto const& recv_tx = e.second.second;
|
||||||
REQUIRE(send_tx.size() == recv_tx.size());
|
REQUIRE(send_tx.size() == recv_tx.size());
|
||||||
for(auto i = 0; i < send_tx.size(); ++i)
|
for(auto i = 0; i < send_tx.size(); ++i)
|
||||||
CHECK(*send_tx[i] == *recv_tx[i]);
|
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
||||||
|
|
||||||
}
|
}
|
||||||
for(auto& e : state.read_tx) {
|
for(auto& e : state.read_tx) {
|
||||||
auto const& send_tx = e.second.first;
|
auto const& send_tx = e.second.first;
|
||||||
auto const& recv_tx = e.second.second;
|
auto const& recv_tx = e.second.second;
|
||||||
REQUIRE(send_tx.size() == recv_tx.size());
|
REQUIRE(send_tx.size() == recv_tx.size());
|
||||||
for(auto i = 0; i < send_tx.size(); ++i)
|
for(auto i = 0; i < send_tx.size(); ++i)
|
||||||
CHECK(*send_tx[i] == *recv_tx[i]);
|
CHECK(is_equal(*send_tx[i], *recv_tx[i]));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,8 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SC_HAS_PROCESS(testbench);
|
SC_HAS_PROCESS(testbench);
|
||||||
testbench(): testbench("testbench") {}
|
testbench()
|
||||||
|
: testbench("testbench") {}
|
||||||
testbench(sc_core::sc_module_name nm)
|
testbench(sc_core::sc_module_name nm)
|
||||||
: sc_core::sc_module(nm)
|
: sc_core::sc_module(nm)
|
||||||
, intor_pe("intor_pe", intor)
|
, intor_pe("intor_pe", intor)
|
||||||
@ -70,9 +71,7 @@ public:
|
|||||||
tgt_rec.isckt(tgt);
|
tgt_rec.isckt(tgt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void run1() {}
|
||||||
void run1() {
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _TESTBENCH_H_
|
#endif // _TESTBENCH_H_
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
#define EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_INITIATOR_H_
|
#define EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_INITIATOR_H_
|
||||||
|
|
||||||
#include <cci_configuration>
|
#include <cci_configuration>
|
||||||
#include <tlm>
|
|
||||||
#include <string>
|
|
||||||
#include <tlm_utils/simple_initiator_socket.h>
|
|
||||||
#include <scc/report.h>
|
#include <scc/report.h>
|
||||||
|
#include <string>
|
||||||
|
#include <tlm>
|
||||||
|
#include <tlm_utils/simple_initiator_socket.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class initiator
|
* @class initiator
|
||||||
@ -54,13 +54,13 @@ public:
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
SC_CTOR(initiator)
|
SC_CTOR(initiator)
|
||||||
:
|
: data(0)
|
||||||
data(0), initiator_socket("initiator_socket"), initiator_ID("initiator_ID", "initiator_default") {
|
, initiator_socket("initiator_socket")
|
||||||
|
, initiator_ID("initiator_ID", "initiator_default") {
|
||||||
SCCINFO(SCMOD) << "[" << initiator_ID.get_value() << " C_TOR] ------- [INITIATOR CONSTRUCTOR BEGINS HERE] --------";
|
SCCINFO(SCMOD) << "[" << initiator_ID.get_value() << " C_TOR] ------- [INITIATOR CONSTRUCTOR BEGINS HERE] --------";
|
||||||
|
|
||||||
// initiator's SC_THREAD declaration
|
// initiator's SC_THREAD declaration
|
||||||
SC_THREAD(run_initiator);
|
SC_THREAD(run_initiator);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,14 +73,14 @@ public:
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
static tlm::tlm_command cmds[8] =
|
static tlm::tlm_command cmds[8] = {tlm::TLM_WRITE_COMMAND, tlm::TLM_READ_COMMAND, tlm::TLM_WRITE_COMMAND, tlm::TLM_READ_COMMAND,
|
||||||
{ tlm::TLM_WRITE_COMMAND, tlm::TLM_READ_COMMAND, tlm::TLM_WRITE_COMMAND, tlm::TLM_READ_COMMAND, tlm::TLM_READ_COMMAND,
|
tlm::TLM_READ_COMMAND, tlm::TLM_READ_COMMAND, tlm::TLM_WRITE_COMMAND, tlm::TLM_WRITE_COMMAND};
|
||||||
tlm::TLM_READ_COMMAND, tlm::TLM_WRITE_COMMAND, tlm::TLM_WRITE_COMMAND };
|
|
||||||
while(1) {
|
while(1) {
|
||||||
tlm::tlm_command cmd = cmds[(i >> 2) % 8];
|
tlm::tlm_command cmd = cmds[(i >> 2) % 8];
|
||||||
// static_cast<tlm::tlm_command>(cmd_dist(rng));
|
// static_cast<tlm::tlm_command>(cmd_dist(rng));
|
||||||
|
|
||||||
if (cmd == tlm::TLM_WRITE_COMMAND) data = 0xFF000000 | i;
|
if(cmd == tlm::TLM_WRITE_COMMAND)
|
||||||
|
data = 0xFF000000 | i;
|
||||||
|
|
||||||
trans->set_command(cmd);
|
trans->set_command(cmd);
|
||||||
trans->set_address(i);
|
trans->set_address(i);
|
||||||
@ -105,7 +105,8 @@ public:
|
|||||||
if(trans->is_response_error())
|
if(trans->is_response_error())
|
||||||
SCCERR(SCMOD) << "TLM_2" << trans->get_response_string().c_str();
|
SCCERR(SCMOD) << "TLM_2" << trans->get_response_string().c_str();
|
||||||
|
|
||||||
if (delay.to_double() != 0) wait(delay);
|
if(delay.to_double() != 0)
|
||||||
|
wait(delay);
|
||||||
|
|
||||||
if(cmd == tlm::TLM_WRITE_COMMAND) {
|
if(cmd == tlm::TLM_WRITE_COMMAND) {
|
||||||
SCCINFO(SCMOD) << "[Initiators Message]=>At address " << std::hex << i << " received response of Write transaction "
|
SCCINFO(SCMOD) << "[Initiators Message]=>At address " << std::hex << i << " received response of Write transaction "
|
||||||
@ -124,16 +125,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cci::cci_param<std::string, cci::CCI_MUTABLE_PARAM> initiator_ID; ///< Elab Time Param for assigning initiator ID (initialized by top_module)
|
cci::cci_param<std::string, cci::CCI_MUTABLE_PARAM>
|
||||||
|
initiator_ID; ///< Elab Time Param for assigning initiator ID (initialized by top_module)
|
||||||
/**
|
/**
|
||||||
* @fn void end_of_elaboration()
|
* @fn void end_of_elaboration()
|
||||||
* @brief end of elaboration function to lock structural param
|
* @brief end of elaboration function to lock structural param
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void end_of_elaboration() {
|
void end_of_elaboration() { initiator_ID.lock(); }
|
||||||
initiator_ID.lock();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
// initiator
|
// initiator
|
||||||
|
|
||||||
|
@ -35,13 +35,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cci_configuration>
|
#include <cci_configuration>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <sstream>
|
||||||
#include <tlm>
|
#include <tlm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
|
||||||
#include <iomanip>
|
|
||||||
|
|
||||||
#include <tlm_utils/multi_passthrough_target_socket.h>
|
|
||||||
#include <tlm_utils/multi_passthrough_initiator_socket.h>
|
#include <tlm_utils/multi_passthrough_initiator_socket.h>
|
||||||
|
#include <tlm_utils/multi_passthrough_target_socket.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class router
|
* @class router
|
||||||
@ -59,9 +59,13 @@ public:
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
SC_CTOR(router)
|
SC_CTOR(router)
|
||||||
:
|
: Router_target("Router_target")
|
||||||
Router_target("Router_target"), Router_initiator("Router_initiator"), r_initiators("r_initiators", 0), r_targets("r_targets",
|
, Router_initiator("Router_initiator")
|
||||||
0), addr_limit("addr_max", 64), m_broker(cci::cci_get_broker()), addrSize(0) {
|
, r_initiators("r_initiators", 0)
|
||||||
|
, r_targets("r_targets", 0)
|
||||||
|
, addr_limit("addr_max", 64)
|
||||||
|
, m_broker(cci::cci_get_broker())
|
||||||
|
, addrSize(0) {
|
||||||
SCCINFO(SCMOD) << "[ROUTER C_TOR] ----- [ROUTER CONSTRUCTOR BEGINS HERE] ------";
|
SCCINFO(SCMOD) << "[ROUTER C_TOR] ----- [ROUTER CONSTRUCTOR BEGINS HERE] ------";
|
||||||
|
|
||||||
// Register b_transport
|
// Register b_transport
|
||||||
|
@ -31,10 +31,10 @@
|
|||||||
* @date 29th April, 2011 (Friday)
|
* @date 29th April, 2011 (Friday)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "top_module.h"
|
||||||
#include <cci_configuration>
|
#include <cci_configuration>
|
||||||
#include <cci_utils/broker.h>
|
#include <cci_utils/broker.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "top_module.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fn int sc_main(int argc, char* argv[])
|
* @fn int sc_main(int argc, char* argv[])
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
#define EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_TARGET_H_
|
#define EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_TARGET_H_
|
||||||
|
|
||||||
#include <cci_configuration>
|
#include <cci_configuration>
|
||||||
#include <tlm>
|
|
||||||
#include <string>
|
|
||||||
#include <tlm_utils/simple_target_socket.h>
|
|
||||||
#include <scc/report.h>
|
#include <scc/report.h>
|
||||||
|
#include <string>
|
||||||
|
#include <tlm>
|
||||||
|
#include <tlm_utils/simple_target_socket.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class target
|
* @class target
|
||||||
@ -47,8 +47,10 @@ public:
|
|||||||
sc_core::sc_time read_latency, write_latency;
|
sc_core::sc_time read_latency, write_latency;
|
||||||
|
|
||||||
SC_CTOR(target)
|
SC_CTOR(target)
|
||||||
:
|
: target_socket("target_socket")
|
||||||
target_socket("target_socket"), target_ID("target_ID", "target_default"), s_base_addr("s_base_addr", 0), s_size("s_size", 256) {
|
, target_ID("target_ID", "target_default")
|
||||||
|
, s_base_addr("s_base_addr", 0)
|
||||||
|
, s_size("s_size", 256) {
|
||||||
SCCINFO(SCMOD) << "[" << target_ID.get_value() << " C_TOR] ------- [TARGET CONSTRUCTOR BEGINS HERE] --------";
|
SCCINFO(SCMOD) << "[" << target_ID.get_value() << " C_TOR] ------- [TARGET CONSTRUCTOR BEGINS HERE] --------";
|
||||||
SCCINFO(SCMOD) << "[" << target_ID.get_value() << " C_TOR] : Base Address : " << s_base_addr.get_value();
|
SCCINFO(SCMOD) << "[" << target_ID.get_value() << " C_TOR] : Base Address : " << s_base_addr.get_value();
|
||||||
|
|
||||||
@ -72,8 +74,7 @@ public:
|
|||||||
* @brief The run thread of the modeul (does nothing)
|
* @brief The run thread of the modeul (does nothing)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void run_target(void) {
|
void run_target(void) {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fn void b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& delay)
|
* @fn void b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& delay)
|
||||||
@ -114,8 +115,7 @@ public:
|
|||||||
if(cmd == tlm::TLM_READ_COMMAND) {
|
if(cmd == tlm::TLM_READ_COMMAND) {
|
||||||
memcpy(ptr, &mem[adr], len);
|
memcpy(ptr, &mem[adr], len);
|
||||||
delay = delay + read_latency;
|
delay = delay + read_latency;
|
||||||
} else
|
} else if(cmd == tlm::TLM_WRITE_COMMAND) {
|
||||||
if (cmd == tlm::TLM_WRITE_COMMAND) {
|
|
||||||
memcpy(&mem[adr], ptr, len);
|
memcpy(&mem[adr], ptr, len);
|
||||||
delay = delay + write_latency;
|
delay = delay + write_latency;
|
||||||
}
|
}
|
||||||
@ -124,7 +124,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cci::cci_param<std::string, cci::CCI_MUTABLE_PARAM> target_ID; ///< Elaboration Time Param for assigning target ID (initialized by top_module)
|
cci::cci_param<std::string, cci::CCI_MUTABLE_PARAM>
|
||||||
|
target_ID; ///< Elaboration Time Param for assigning target ID (initialized by top_module)
|
||||||
|
|
||||||
cci::cci_param<int, cci::CCI_MUTABLE_PARAM> s_base_addr; ///< Mutable time param for setting target's base addr (initialized by router)
|
cci::cci_param<int, cci::CCI_MUTABLE_PARAM> s_base_addr; ///< Mutable time param for setting target's base addr (initialized by router)
|
||||||
|
|
||||||
|
@ -32,13 +32,13 @@
|
|||||||
#define EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_TOP_MODULE_H_
|
#define EXAMPLES_EX09_HIERARCHICAL_OVERRIDE_OF_PARAMETER_VALUES_TOP_MODULE_H_
|
||||||
|
|
||||||
#include <cci_configuration>
|
#include <cci_configuration>
|
||||||
|
#include <scc/report.h>
|
||||||
|
#include <sstream>
|
||||||
#include <tlm>
|
#include <tlm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
|
||||||
#include <scc/report.h>
|
|
||||||
|
|
||||||
#include "router.h"
|
|
||||||
#include "initiator.h"
|
#include "initiator.h"
|
||||||
|
#include "router.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,8 +52,9 @@ public:
|
|||||||
* @brief The class constructor
|
* @brief The class constructor
|
||||||
*/
|
*/
|
||||||
SC_CTOR(top_module)
|
SC_CTOR(top_module)
|
||||||
:
|
: n_initiators("number_of_initiators", 0)
|
||||||
n_initiators("number_of_initiators", 0), n_targets("number_of_targets", 0), m_broker(cci::cci_get_broker()) {
|
, n_targets("number_of_targets", 0)
|
||||||
|
, m_broker(cci::cci_get_broker()) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
|
||||||
SCCINFO(SCMOD) << "[TOP_MODULE C_TOR] -- [TOP MODULE CONSTRUCTOR BEGINS HERE]";
|
SCCINFO(SCMOD) << "[TOP_MODULE C_TOR] -- [TOP MODULE CONSTRUCTOR BEGINS HERE]";
|
||||||
@ -214,8 +215,7 @@ private:
|
|||||||
char stringMisc[50]; ///< String to be used for misc things
|
char stringMisc[50]; ///< String to be used for misc things
|
||||||
char targetBaseAddr[50]; ///< The base address of the target
|
char targetBaseAddr[50]; ///< The base address of the target
|
||||||
|
|
||||||
int addrValue
|
int addrValue{0}; ///< Address Value
|
||||||
{ 0 }; ///< Address Value
|
|
||||||
int targetSize; ///< Maximum target Size (preset value)
|
int targetSize; ///< Maximum target Size (preset value)
|
||||||
int r_addr_max; ///< Maximum Router Table's memory range
|
int r_addr_max; ///< Maximum Router Table's memory range
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#define CATCH_CONFIG_MAIN
|
#define CATCH_CONFIG_MAIN
|
||||||
#include <catch2/catch_all.hpp>
|
#include <catch2/catch_all.hpp>
|
||||||
#include <util/io-redirector.h>
|
|
||||||
#include <iostream>
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <iostream>
|
||||||
|
#include <util/io-redirector.h>
|
||||||
|
|
||||||
TEST_CASE("io-redirector", "[io-redirector]") {
|
TEST_CASE("io-redirector", "[io-redirector]") {
|
||||||
util::IoRedirector::get().start();
|
util::IoRedirector::get().start();
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
|
#ifndef SC_INCLUDE_DYNAMIC_PROCESSES
|
||||||
#define SC_INCLUDE_DYNAMIC_PROCESSES
|
#define SC_INCLUDE_DYNAMIC_PROCESSES
|
||||||
|
#endif
|
||||||
|
#include <catch2/catch_all.hpp>
|
||||||
|
#include <factory.h>
|
||||||
#include <scc/ordered_semaphore.h>
|
#include <scc/ordered_semaphore.h>
|
||||||
#include <scc/utilities.h>
|
#include <scc/utilities.h>
|
||||||
#include <factory.h>
|
|
||||||
#include <catch2/catch_all.hpp>
|
|
||||||
#include <systemc>
|
#include <systemc>
|
||||||
|
|
||||||
using namespace sc_core;
|
using namespace sc_core;
|
||||||
|
|
||||||
struct top : public sc_core::sc_module {
|
struct top : public sc_core::sc_module {
|
||||||
top():top("top"){}
|
top()
|
||||||
top(sc_module_name const& nm):sc_core::sc_module(nm) {}
|
: top("top") {}
|
||||||
|
top(sc_module_name const& nm)
|
||||||
|
: sc_core::sc_module(nm) {}
|
||||||
scc::ordered_semaphore sem{"sem", 2};
|
scc::ordered_semaphore sem{"sem", 2};
|
||||||
scc::ordered_semaphore_t<2> sem_t{"sem_t"};
|
scc::ordered_semaphore_t<2> sem_t{"sem_t"};
|
||||||
};
|
};
|
||||||
|
@ -20,9 +20,7 @@ struct packet_ext: public tlm::tlm_extension<packet_ext>, public packet {
|
|||||||
|
|
||||||
packet_ext& operator=(packet_ext const& o) = default;
|
packet_ext& operator=(packet_ext const& o) = default;
|
||||||
|
|
||||||
tlm_extension_base* clone() const override {
|
tlm_extension_base* clone() const override { return new packet_ext(*this); }
|
||||||
return new packet_ext(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void copy_from(tlm_extension_base const& o) override {
|
void copy_from(tlm_extension_base const& o) override {
|
||||||
auto* ext = dynamic_cast<packet_ext const*>(&o);
|
auto* ext = dynamic_cast<packet_ext const*>(&o);
|
||||||
|
@ -18,16 +18,13 @@ pkt_sender::pkt_sender(const sc_core::sc_module_name &nm, unsigned dim, unsigned
|
|||||||
, fw_peq("fw_peq")
|
, fw_peq("fw_peq")
|
||||||
, my_pos{pos_x, pos_y}
|
, my_pos{pos_x, pos_y}
|
||||||
, dim{dim}
|
, dim{dim}
|
||||||
, count{count}
|
, count{count} {
|
||||||
{
|
|
||||||
SCCDEBUG(SCMOD) << "instantiating sender " << pos_x << "/" << pos_y;
|
SCCDEBUG(SCMOD) << "instantiating sender " << pos_x << "/" << pos_y;
|
||||||
SC_HAS_PROCESS(pkt_sender);
|
SC_HAS_PROCESS(pkt_sender);
|
||||||
isck.register_nb_transport_bw([this](tlm::tlm_generic_payload &gp, tlm::tlm_phase &phase, sc_core::sc_time &delay)->tlm::tlm_sync_enum{
|
isck.register_nb_transport_bw([this](tlm::tlm_generic_payload& gp, tlm::tlm_phase& phase,
|
||||||
return this->nb_bw(gp, phase, delay);
|
sc_core::sc_time& delay) -> tlm::tlm_sync_enum { return this->nb_bw(gp, phase, delay); });
|
||||||
});
|
tsck.register_nb_transport_fw([this](tlm::tlm_generic_payload& gp, tlm::tlm_phase& phase,
|
||||||
tsck.register_nb_transport_fw([this](tlm::tlm_generic_payload &gp, tlm::tlm_phase &phase, sc_core::sc_time &delay)->tlm::tlm_sync_enum{
|
sc_core::sc_time& delay) -> tlm::tlm_sync_enum { return this->nb_fw(gp, phase, delay); });
|
||||||
return this->nb_fw(gp, phase, delay);
|
|
||||||
});
|
|
||||||
SC_METHOD(received);
|
SC_METHOD(received);
|
||||||
sensitive << fw_peq.get_event();
|
sensitive << fw_peq.get_event();
|
||||||
dont_initialize();
|
dont_initialize();
|
||||||
|
@ -8,12 +8,11 @@
|
|||||||
#ifndef _SIM_PERFORMANCE_PKT_SENDER_H_
|
#ifndef _SIM_PERFORMANCE_PKT_SENDER_H_
|
||||||
#define _SIM_PERFORMANCE_PKT_SENDER_H_
|
#define _SIM_PERFORMANCE_PKT_SENDER_H_
|
||||||
|
|
||||||
#include <systemc>
|
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
|
#include <systemc>
|
||||||
#include <tlm/scc/initiator_mixin.h>
|
#include <tlm/scc/initiator_mixin.h>
|
||||||
#include <tlm/scc/target_mixin.h>
|
#include <tlm/scc/target_mixin.h>
|
||||||
|
|
||||||
|
|
||||||
class pkt_sender : sc_core::sc_module {
|
class pkt_sender : sc_core::sc_module {
|
||||||
public:
|
public:
|
||||||
sc_core::sc_in<bool> clk_i{"clk_i"};
|
sc_core::sc_in<bool> clk_i{"clk_i"};
|
||||||
@ -22,6 +21,7 @@ public:
|
|||||||
pkt_sender(sc_core::sc_module_name const&, unsigned dim, unsigned pos_x, unsigned pos_y, unsigned count);
|
pkt_sender(sc_core::sc_module_name const&, unsigned dim, unsigned pos_x, unsigned pos_y, unsigned count);
|
||||||
virtual ~pkt_sender() = default;
|
virtual ~pkt_sender() = default;
|
||||||
sc_core::sc_event const& get_finish_event() { return finish_evt; }
|
sc_core::sc_event const& get_finish_event() { return finish_evt; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void run();
|
void run();
|
||||||
void gen_routing(std::vector<uint8_t>& route_vec);
|
void gen_routing(std::vector<uint8_t>& route_vec);
|
||||||
|
@ -14,19 +14,20 @@
|
|||||||
|
|
||||||
using namespace sc_core;
|
using namespace sc_core;
|
||||||
|
|
||||||
pkt_switch::pkt_switch(const sc_core::sc_module_name &nm):sc_module(nm) {
|
pkt_switch::pkt_switch(const sc_core::sc_module_name& nm)
|
||||||
|
: sc_module(nm) {
|
||||||
SC_HAS_PROCESS(pkt_switch);
|
SC_HAS_PROCESS(pkt_switch);
|
||||||
auto index = 0U;
|
auto index = 0U;
|
||||||
for(auto& s : isck) {
|
for(auto& s : isck) {
|
||||||
s.register_nb_transport_bw([this](unsigned id, tlm::tlm_generic_payload &gp, tlm::tlm_phase &phase, sc_core::sc_time &delay)->tlm::tlm_sync_enum{
|
s.register_nb_transport_bw([this](unsigned id, tlm::tlm_generic_payload& gp, tlm::tlm_phase& phase,
|
||||||
return this->nb_bw(id, gp, phase, delay);
|
sc_core::sc_time& delay) -> tlm::tlm_sync_enum { return this->nb_bw(id, gp, phase, delay); },
|
||||||
}, index++);
|
index++);
|
||||||
}
|
}
|
||||||
index = 0U;
|
index = 0U;
|
||||||
for(auto& s : tsck) {
|
for(auto& s : tsck) {
|
||||||
s.register_nb_transport_fw([this](unsigned id, tlm::tlm_generic_payload &gp, tlm::tlm_phase &phase, sc_core::sc_time &delay)->tlm::tlm_sync_enum{
|
s.register_nb_transport_fw([this](unsigned id, tlm::tlm_generic_payload& gp, tlm::tlm_phase& phase,
|
||||||
return this->nb_fw(id, gp, phase, delay);
|
sc_core::sc_time& delay) -> tlm::tlm_sync_enum { return this->nb_fw(id, gp, phase, delay); },
|
||||||
}, index++);
|
index++);
|
||||||
}
|
}
|
||||||
SC_METHOD(clock_cb);
|
SC_METHOD(clock_cb);
|
||||||
sensitive << clk_i.pos();
|
sensitive << clk_i.pos();
|
||||||
@ -41,8 +42,10 @@ pkt_switch::pkt_switch(const sc_core::sc_module_name &nm):sc_module(nm) {
|
|||||||
|
|
||||||
tlm::tlm_sync_enum pkt_switch::nb_fw(unsigned id, tlm::tlm_generic_payload& gp, tlm::tlm_phase& phase, sc_core::sc_time& delay) {
|
tlm::tlm_sync_enum pkt_switch::nb_fw(unsigned id, tlm::tlm_generic_payload& gp, tlm::tlm_phase& phase, sc_core::sc_time& delay) {
|
||||||
in_tx[id].write(&gp);
|
in_tx[id].write(&gp);
|
||||||
if(phase==tlm::BEGIN_REQ) phase=tlm::END_REQ;
|
if(phase == tlm::BEGIN_REQ)
|
||||||
else SCCERR(SCMOD)<<"WTF!?!";
|
phase = tlm::END_REQ;
|
||||||
|
else
|
||||||
|
SCCERR(SCMOD) << "WTF!?!";
|
||||||
return tlm::TLM_UPDATED;
|
return tlm::TLM_UPDATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +60,8 @@ void pkt_switch::clock_cb() {
|
|||||||
nothing_todo = false;
|
nothing_todo = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(nothing_todo) return;
|
if(nothing_todo)
|
||||||
|
return;
|
||||||
for(auto i = 0U; i < SIDES; ++i) {
|
for(auto i = 0U; i < SIDES; ++i) {
|
||||||
if(routing[i].size()) {
|
if(routing[i].size()) {
|
||||||
auto selected_input = routing[i].front();
|
auto selected_input = routing[i].front();
|
||||||
|
@ -8,13 +8,12 @@
|
|||||||
#ifndef _SIM_PERFORMANCE_PKT_SWITCH_H_
|
#ifndef _SIM_PERFORMANCE_PKT_SWITCH_H_
|
||||||
#define _SIM_PERFORMANCE_PKT_SWITCH_H_
|
#define _SIM_PERFORMANCE_PKT_SWITCH_H_
|
||||||
|
|
||||||
#include <systemc>
|
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
|
#include <array>
|
||||||
|
#include <scc/sc_owning_signal.h>
|
||||||
|
#include <systemc>
|
||||||
#include <tlm/scc/tagged_initiator_mixin.h>
|
#include <tlm/scc/tagged_initiator_mixin.h>
|
||||||
#include <tlm/scc/tagged_target_mixin.h>
|
#include <tlm/scc/tagged_target_mixin.h>
|
||||||
#include <scc/sc_owning_signal.h>
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
|
|
||||||
class pkt_switch : sc_core::sc_module {
|
class pkt_switch : sc_core::sc_module {
|
||||||
public:
|
public:
|
||||||
@ -24,6 +23,7 @@ public:
|
|||||||
sc_core::sc_vector<tlm::scc::tagged_initiator_mixin<tlm::tlm_initiator_socket<32>>> isck{"isck", 4};
|
sc_core::sc_vector<tlm::scc::tagged_initiator_mixin<tlm::tlm_initiator_socket<32>>> isck{"isck", 4};
|
||||||
pkt_switch(sc_core::sc_module_name const&);
|
pkt_switch(sc_core::sc_module_name const&);
|
||||||
virtual ~pkt_switch() = default;
|
virtual ~pkt_switch() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clock_cb();
|
void clock_cb();
|
||||||
void output_cb(unsigned);
|
void output_cb(unsigned);
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "top.h"
|
#include "top.h"
|
||||||
|
#include <boost/program_options.hpp>
|
||||||
#include <scc/perf_estimator.h>
|
#include <scc/perf_estimator.h>
|
||||||
#include <scc/report.h>
|
#include <scc/report.h>
|
||||||
#include <scc/tracer.h>
|
#include <scc/tracer.h>
|
||||||
#include <boost/program_options.hpp>
|
|
||||||
|
|
||||||
using namespace scc;
|
using namespace scc;
|
||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
|
@ -6,14 +6,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "top.h"
|
#include "top.h"
|
||||||
#include <scc/utilities.h>
|
|
||||||
#include <scc/report.h>
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
#include <scc/report.h>
|
||||||
|
#include <scc/utilities.h>
|
||||||
|
|
||||||
using namespace sc_core;
|
using namespace sc_core;
|
||||||
using namespace fmt;
|
using namespace fmt;
|
||||||
|
|
||||||
top::top(sc_core::sc_module_name const& nm, uint8_t dimension,unsigned count) :sc_module(nm){
|
top::top(sc_core::sc_module_name const& nm, uint8_t dimension, unsigned count)
|
||||||
|
: sc_module(nm) {
|
||||||
sc_assert(dimension > 0);
|
sc_assert(dimension > 0);
|
||||||
SC_HAS_PROCESS(top);
|
SC_HAS_PROCESS(top);
|
||||||
for(auto yidx = 0U; yidx < dimension; ++yidx) {
|
for(auto yidx = 0U; yidx < dimension; ++yidx) {
|
||||||
@ -93,4 +94,3 @@ void top::run() {
|
|||||||
wait(evt_list);
|
wait(evt_list);
|
||||||
sc_stop();
|
sc_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,17 +8,18 @@
|
|||||||
#ifndef _SIM_PERFORMANCE_TOP_H_
|
#ifndef _SIM_PERFORMANCE_TOP_H_
|
||||||
#define _SIM_PERFORMANCE_TOP_H_
|
#define _SIM_PERFORMANCE_TOP_H_
|
||||||
|
|
||||||
#include <systemc>
|
|
||||||
#include <memory>
|
|
||||||
#include <vector>
|
|
||||||
#include "pkt_sender.h"
|
#include "pkt_sender.h"
|
||||||
#include "pkt_switch.h"
|
#include "pkt_switch.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include <memory>
|
||||||
|
#include <systemc>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class top : public sc_core::sc_module {
|
class top : public sc_core::sc_module {
|
||||||
public:
|
public:
|
||||||
top(sc_core::sc_module_name const&, uint8_t, unsigned);
|
top(sc_core::sc_module_name const&, uint8_t, unsigned);
|
||||||
virtual ~top() = default;
|
virtual ~top() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void run();
|
void run();
|
||||||
sc_core::sc_clock clk;
|
sc_core::sc_clock clk;
|
||||||
|
Loading…
Reference in New Issue
Block a user