diff --git a/.settings/org.eclipse.cdt.codan.core.prefs b/.settings/org.eclipse.cdt.codan.core.prefs deleted file mode 100644 index 067d6fd..0000000 --- a/.settings/org.eclipse.cdt.codan.core.prefs +++ /dev/null @@ -1,73 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.cdt.codan.checkers.errnoreturn=Warning -org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return\\")",implicit\=>false} -org.eclipse.cdt.codan.checkers.errreturnvalue=Error -org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused return value\\")"} -org.eclipse.cdt.codan.checkers.nocommentinside=-Error -org.eclipse.cdt.codan.checkers.nocommentinside.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Nesting comments\\")"} -org.eclipse.cdt.codan.checkers.nolinecomment=-Error -org.eclipse.cdt.codan.checkers.nolinecomment.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Line comments\\")"} -org.eclipse.cdt.codan.checkers.noreturn=Error -org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return value\\")",implicit\=>false} -org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error -org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Abstract class cannot be instantiated\\")"} -org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error -org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Ambiguous problem\\")"} -org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning -org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment in condition\\")"} -org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error -org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment to itself\\")"} -org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning -org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No break at end of case\\")",no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false,enable_fallthrough_quickfix_param\=>false} -org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning -org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Catching by reference is recommended\\")",unknown\=>false,exceptions\=>()} -org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error -org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Circular inheritance\\")"} -org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning -org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class members should be properly initialized\\")",skip\=>true} -org.eclipse.cdt.codan.internal.checkers.DecltypeAutoProblem=Error -org.eclipse.cdt.codan.internal.checkers.DecltypeAutoProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid 'decltype(auto)' specifier\\")"} -org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error -org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Field cannot be resolved\\")"} -org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error -org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Function cannot be resolved\\")"} -org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error -org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid arguments\\")"} -org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error -org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid template argument\\")"} -org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error -org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Label statement not found\\")"} -org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error -org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Member declaration not found\\")"} -org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error -org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Method cannot be resolved\\")"} -org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info -org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Name convention for function\\")",pattern\=>"^[a-z]",macro\=>true,exceptions\=>()} -org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning -org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class has a virtual method and non-virtual destructor\\")"} -org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error -org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid overload\\")"} -org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error -org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redeclaration\\")"} -org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error -org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redefinition\\")"} -org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning -org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Return with parenthesis\\")"} -org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning -org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Format String Vulnerability\\")"} -org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning -org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Statement has no effect\\")",macro\=>true,exceptions\=>()} -org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning -org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suggested parenthesis around expression\\")",paramNot\=>false} -org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning -org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suspicious semicolon\\")",else\=>false,afterelse\=>false} -org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error -org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Type cannot be resolved\\")"} -org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning -org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused function declaration\\")",macro\=>true} -org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning -org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused static function\\")",macro\=>true} -org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning -org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused variable declaration in file scope\\")",macro\=>true,exceptions\=>("@(\#)","$Id")} -org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error -org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Symbol is not resolved\\")"} diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs deleted file mode 100644 index 7982989..0000000 --- a/.settings/org.eclipse.cdt.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -eclipse.preferences.version=1 -environment/project/cdt.managedbuild.config.gnu.exe.debug.1751741082/append=true -environment/project/cdt.managedbuild.config.gnu.exe.debug.1751741082/appendContributed=true -environment/project/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/LLVM_HOME/delimiter=\: -environment/project/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/LLVM_HOME/operation=append -environment/project/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/LLVM_HOME/value=/usr/lib/llvm-6.0 -environment/project/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/append=true -environment/project/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/appendContributed=true -environment/project/cdt.managedbuild.config.gnu.exe.release.1745230171/LLVM_HOME/delimiter=\: -environment/project/cdt.managedbuild.config.gnu.exe.release.1745230171/LLVM_HOME/operation=append -environment/project/cdt.managedbuild.config.gnu.exe.release.1745230171/LLVM_HOME/value=/usr/lib/llvm-6.0 -environment/project/cdt.managedbuild.config.gnu.exe.release.1745230171/append=true -environment/project/cdt.managedbuild.config.gnu.exe.release.1745230171/appendContributed=true diff --git a/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/.settings/org.eclipse.cdt.managedbuilder.core.prefs deleted file mode 100644 index f299fce..0000000 --- a/.settings/org.eclipse.cdt.managedbuilder.core.prefs +++ /dev/null @@ -1,37 +0,0 @@ -eclipse.preferences.version=1 -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1751741082/CPATH/delimiter=\: -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1751741082/CPATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1751741082/CPLUS_INCLUDE_PATH/delimiter=\: -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1751741082/CPLUS_INCLUDE_PATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1751741082/C_INCLUDE_PATH/delimiter=\: -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1751741082/C_INCLUDE_PATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1751741082/append=true -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1751741082/appendContributed=true -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/CPATH/delimiter=\: -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/CPATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/CPLUS_INCLUDE_PATH/delimiter=\: -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/CPLUS_INCLUDE_PATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/C_INCLUDE_PATH/delimiter=\: -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/C_INCLUDE_PATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/append=true -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/appendContributed=true -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171/CPATH/delimiter=\: -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171/CPATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171/CPLUS_INCLUDE_PATH/delimiter=\: -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171/CPLUS_INCLUDE_PATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171/C_INCLUDE_PATH/delimiter=\: -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171/C_INCLUDE_PATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171/append=true -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1745230171/appendContributed=true -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.1751741082/LIBRARY_PATH/delimiter=\: -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.1751741082/LIBRARY_PATH/operation=remove -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.1751741082/append=true -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.1751741082/appendContributed=true -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/LIBRARY_PATH/delimiter=\: -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/LIBRARY_PATH/operation=remove -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/append=true -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.release.1745230171.1259602404/appendContributed=true -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.release.1745230171/LIBRARY_PATH/delimiter=\: -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.release.1745230171/LIBRARY_PATH/operation=remove -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.release.1745230171/append=true -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.release.1745230171/appendContributed=true diff --git a/CMakeLists.txt b/CMakeLists.txt index 56955b7..3070844 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ endif() # library files FILE(GLOB GEN_ISS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src-gen/iss/arch/*.cpp) FILE(GLOB GEN_VM_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src-gen/vm/interp/vm_*.cpp) +FILE(GLOB GEN_YAML_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/contrib/instr/*.yaml) list(APPEND LIB_SOURCES ${GEN_ISS_SOURCES} ${GEN_VM_SOURCES}) foreach(FILEPATH ${GEN_ISS_SOURCES}) get_filename_component(CORE ${FILEPATH} NAME_WE) @@ -60,13 +61,9 @@ if(WITH_ASMJIT) FILE(GLOB TCC_GEN_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src-gen/vm/asmjit/vm_*.cpp) list(APPEND LIB_SOURCES ${TCC_GEN_SOURCES}) endif() -if(TARGET RapidJSON OR TARGET RapidJSON::RapidJSON) +if(TARGET yaml-cpp::yaml-cpp) list(APPEND LIB_SOURCES src/iss/plugin/cycle_estimate.cpp - ) -endif() -if(TARGET jsoncpp::jsoncpp) - list(APPEND LIB_SOURCES src/iss/plugin/instruction_count.cpp ) endif() @@ -91,11 +88,9 @@ if(NOT (DBT_CORE_DEFS STREQUAL DBT_CORE_DEFS-NOTFOUND)) endif() target_link_libraries(${PROJECT_NAME} PUBLIC elfio::elfio softfloat scc-util Boost::coroutine) -if(TARGET jsoncpp::jsoncpp) - target_link_libraries(${PROJECT_NAME} PUBLIC jsoncpp::jsoncpp) -endif() -if(TARGET RapidJSON) - target_link_libraries(${PROJECT_NAME} PUBLIC RapidJSON) +if(TARGET yaml-cpp::yaml-cpp) + target_compile_definitions(${PROJECT_NAME} PUBLIC WITH_PLUGINS) + target_link_libraries(${PROJECT_NAME} PUBLIC yaml-cpp::yaml-cpp) endif() if(WITH_LLVM) @@ -125,9 +120,11 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/incl/iss COMPONENT ${PROJECT_NAME} FILES_MATCHING # install only matched files PATTERN "*.h" # select header files ) +install(FILES ${GEN_YAML_SOURCES} DESTINATION share/tgc-vp) ############################################################################### # ############################################################################### +set(CMAKE_INSTALL_RPATH $ORIGIN/../${CMAKE_INSTALL_LIBDIR}) project(tgc-sim) find_package(Boost COMPONENTS program_options thread REQUIRED) diff --git a/contrib/instr/.gitignore b/contrib/instr/.gitignore new file mode 100644 index 0000000..88b59f2 --- /dev/null +++ b/contrib/instr/.gitignore @@ -0,0 +1 @@ +/*.yaml \ No newline at end of file diff --git a/TGC_C_instr.yaml b/contrib/instr/TGC5C_instr.yaml similarity index 81% rename from TGC_C_instr.yaml rename to contrib/instr/TGC5C_instr.yaml index e28cb64..6ea4d78 100644 --- a/TGC_C_instr.yaml +++ b/contrib/instr/TGC5C_instr.yaml @@ -1,297 +1,348 @@ RV32I: - - LUI: + LUI: + index: 0 encoding: 0b00000000000000000000000000110111 mask: 0b00000000000000000000000001111111 size: 32 branch: false delay: 1 - - AUIPC: + AUIPC: + index: 1 encoding: 0b00000000000000000000000000010111 mask: 0b00000000000000000000000001111111 size: 32 branch: false delay: 1 - - JAL: + JAL: + index: 2 encoding: 0b00000000000000000000000001101111 mask: 0b00000000000000000000000001111111 size: 32 branch: true delay: 1 - - JALR: + JALR: + index: 3 encoding: 0b00000000000000000000000001100111 mask: 0b00000000000000000111000001111111 size: 32 branch: true - delay: 1 - - BEQ: + delay: [1,1] + BEQ: + index: 4 encoding: 0b00000000000000000000000001100011 mask: 0b00000000000000000111000001111111 size: 32 branch: true - delay: 1 - - BNE: + delay: [1,1] + BNE: + index: 5 encoding: 0b00000000000000000001000001100011 mask: 0b00000000000000000111000001111111 size: 32 branch: true - delay: 1 - - BLT: + delay: [1,1] + BLT: + index: 6 encoding: 0b00000000000000000100000001100011 mask: 0b00000000000000000111000001111111 size: 32 branch: true - delay: 1 - - BGE: + delay: [1,1] + BGE: + index: 7 encoding: 0b00000000000000000101000001100011 mask: 0b00000000000000000111000001111111 size: 32 branch: true - delay: 1 - - BLTU: + delay: [1,1] + BLTU: + index: 8 encoding: 0b00000000000000000110000001100011 mask: 0b00000000000000000111000001111111 size: 32 branch: true - delay: 1 - - BGEU: + delay: [1,1] + BGEU: + index: 9 encoding: 0b00000000000000000111000001100011 mask: 0b00000000000000000111000001111111 size: 32 branch: true - delay: 1 - - LB: + delay: [1,1] + LB: + index: 10 encoding: 0b00000000000000000000000000000011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - LH: + LH: + index: 11 encoding: 0b00000000000000000001000000000011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - LW: + LW: + index: 12 encoding: 0b00000000000000000010000000000011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - LBU: + LBU: + index: 13 encoding: 0b00000000000000000100000000000011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - LHU: + LHU: + index: 14 encoding: 0b00000000000000000101000000000011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - SB: + SB: + index: 15 encoding: 0b00000000000000000000000000100011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - SH: + SH: + index: 16 encoding: 0b00000000000000000001000000100011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - SW: + SW: + index: 17 encoding: 0b00000000000000000010000000100011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - ADDI: + ADDI: + index: 18 encoding: 0b00000000000000000000000000010011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - SLTI: + SLTI: + index: 19 encoding: 0b00000000000000000010000000010011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - SLTIU: + SLTIU: + index: 20 encoding: 0b00000000000000000011000000010011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - XORI: + XORI: + index: 21 encoding: 0b00000000000000000100000000010011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - ORI: + ORI: + index: 22 encoding: 0b00000000000000000110000000010011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - ANDI: + ANDI: + index: 23 encoding: 0b00000000000000000111000000010011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - SLLI: + SLLI: + index: 24 encoding: 0b00000000000000000001000000010011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - SRLI: + SRLI: + index: 25 encoding: 0b00000000000000000101000000010011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - SRAI: + SRAI: + index: 26 encoding: 0b01000000000000000101000000010011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - ADD: + ADD: + index: 27 encoding: 0b00000000000000000000000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - SUB: + SUB: + index: 28 encoding: 0b01000000000000000000000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - SLL: + SLL: + index: 29 encoding: 0b00000000000000000001000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - SLT: + SLT: + index: 30 encoding: 0b00000000000000000010000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - SLTU: + SLTU: + index: 31 encoding: 0b00000000000000000011000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - XOR: + XOR: + index: 32 encoding: 0b00000000000000000100000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - SRL: + SRL: + index: 33 encoding: 0b00000000000000000101000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - SRA: + SRA: + index: 34 encoding: 0b01000000000000000101000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - OR: + OR: + index: 35 encoding: 0b00000000000000000110000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - AND: + AND: + index: 36 encoding: 0b00000000000000000111000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - FENCE: + FENCE: + index: 37 encoding: 0b00000000000000000000000000001111 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - ECALL: + ECALL: + index: 38 encoding: 0b00000000000000000000000001110011 mask: 0b11111111111111111111111111111111 + attributes: [[name:no_cont]] size: 32 branch: false delay: 1 - - EBREAK: + EBREAK: + index: 39 encoding: 0b00000000000100000000000001110011 mask: 0b11111111111111111111111111111111 + attributes: [[name:no_cont]] size: 32 branch: false delay: 1 - - MRET: + MRET: + index: 40 encoding: 0b00110000001000000000000001110011 mask: 0b11111111111111111111111111111111 attributes: [[name:no_cont]] size: 32 branch: false delay: 1 - - WFI: + WFI: + index: 41 encoding: 0b00010000010100000000000001110011 mask: 0b11111111111111111111111111111111 size: 32 branch: false delay: 1 Zicsr: - - CSRRW: + CSRRW: + index: 42 encoding: 0b00000000000000000001000001110011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - CSRRS: + CSRRS: + index: 43 encoding: 0b00000000000000000010000001110011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - CSRRC: + CSRRC: + index: 44 encoding: 0b00000000000000000011000001110011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - CSRRWI: + CSRRWI: + index: 45 encoding: 0b00000000000000000101000001110011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - CSRRSI: + CSRRSI: + index: 46 encoding: 0b00000000000000000110000001110011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 - - CSRRCI: + CSRRCI: + index: 47 encoding: 0b00000000000000000111000001110011 mask: 0b00000000000000000111000001111111 size: 32 branch: false delay: 1 Zifencei: - - FENCE_I: + FENCE_I: + index: 48 encoding: 0b00000000000000000001000000001111 mask: 0b00000000000000000111000001111111 attributes: [[name:flush]] @@ -299,218 +350,272 @@ Zifencei: branch: false delay: 1 RV32M: - - MUL: + MUL: + index: 49 encoding: 0b00000010000000000000000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - MULH: + MULH: + index: 50 encoding: 0b00000010000000000001000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - MULHSU: + MULHSU: + index: 51 encoding: 0b00000010000000000010000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - MULHU: + MULHU: + index: 52 encoding: 0b00000010000000000011000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - DIV: + DIV: + index: 53 encoding: 0b00000010000000000100000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - DIVU: + DIVU: + index: 54 encoding: 0b00000010000000000101000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - REM: + REM: + index: 55 encoding: 0b00000010000000000110000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 - - REMU: + REMU: + index: 56 encoding: 0b00000010000000000111000000110011 mask: 0b11111110000000000111000001111111 size: 32 branch: false delay: 1 -RV32IC: - - CADDI4SPN: +Zca: + C__ADDI4SPN: + index: 57 encoding: 0b0000000000000000 mask: 0b1110000000000011 size: 16 branch: false delay: 1 - - CLW: + C__LW: + index: 58 encoding: 0b0100000000000000 mask: 0b1110000000000011 size: 16 branch: false delay: 1 - - CSW: + C__SW: + index: 59 encoding: 0b1100000000000000 mask: 0b1110000000000011 size: 16 branch: false delay: 1 - - CADDI: + C__ADDI: + index: 60 encoding: 0b0000000000000001 mask: 0b1110000000000011 size: 16 branch: false delay: 1 - - CNOP: + C__NOP: + index: 61 encoding: 0b0000000000000001 mask: 0b1110111110000011 size: 16 branch: false delay: 1 - - CJAL: + C__JAL: + index: 62 encoding: 0b0010000000000001 mask: 0b1110000000000011 + attributes: [[name:enable, value:1]] size: 16 branch: true delay: 1 - - CLI: + C__LI: + index: 63 encoding: 0b0100000000000001 mask: 0b1110000000000011 size: 16 branch: false delay: 1 - - CLUI: + C__LUI: + index: 64 encoding: 0b0110000000000001 mask: 0b1110000000000011 size: 16 branch: false delay: 1 - - CADDI16SP: + C__ADDI16SP: + index: 65 encoding: 0b0110000100000001 mask: 0b1110111110000011 size: 16 branch: false delay: 1 - - CSRLI: + __reserved_clui: + index: 66 + encoding: 0b0110000000000001 + mask: 0b1111000001111111 + size: 16 + branch: false + delay: 1 + C__SRLI: + index: 67 encoding: 0b1000000000000001 mask: 0b1111110000000011 + attributes: [[name:enable, value:1]] size: 16 branch: false delay: 1 - - CSRAI: + C__SRAI: + index: 68 encoding: 0b1000010000000001 mask: 0b1111110000000011 + attributes: [[name:enable, value:1]] size: 16 branch: false delay: 1 - - CANDI: + C__ANDI: + index: 69 encoding: 0b1000100000000001 mask: 0b1110110000000011 size: 16 branch: false delay: 1 - - CSUB: + C__SUB: + index: 70 encoding: 0b1000110000000001 mask: 0b1111110001100011 size: 16 branch: false delay: 1 - - CXOR: + C__XOR: + index: 71 encoding: 0b1000110000100001 mask: 0b1111110001100011 size: 16 branch: false delay: 1 - - COR: + C__OR: + index: 72 encoding: 0b1000110001000001 mask: 0b1111110001100011 size: 16 branch: false delay: 1 - - CAND: + C__AND: + index: 73 encoding: 0b1000110001100001 mask: 0b1111110001100011 size: 16 branch: false delay: 1 - - CJ: + C__J: + index: 74 encoding: 0b1010000000000001 mask: 0b1110000000000011 size: 16 branch: true delay: 1 - - CBEQZ: + C__BEQZ: + index: 75 encoding: 0b1100000000000001 mask: 0b1110000000000011 size: 16 branch: true - delay: 1 - - CBNEZ: + delay: [1,1] + C__BNEZ: + index: 76 encoding: 0b1110000000000001 mask: 0b1110000000000011 size: 16 branch: true - delay: 1 - - CSLLI: + delay: [1,1] + C__SLLI: + index: 77 encoding: 0b0000000000000010 mask: 0b1111000000000011 + attributes: [[name:enable, value:1]] size: 16 branch: false delay: 1 - - CLWSP: + C__LWSP: + index: 78 encoding: 0b0100000000000010 mask: 0b1110000000000011 size: 16 branch: false delay: 1 - - CMV: + C__MV: + index: 79 encoding: 0b1000000000000010 mask: 0b1111000000000011 size: 16 branch: false delay: 1 - - CJR: + C__JR: + index: 80 encoding: 0b1000000000000010 mask: 0b1111000001111111 size: 16 branch: true delay: 1 - - CADD: + __reserved_cmv: + index: 81 + encoding: 0b1000000000000010 + mask: 0b1111111111111111 + size: 16 + branch: false + delay: 1 + C__ADD: + index: 82 encoding: 0b1001000000000010 mask: 0b1111000000000011 size: 16 branch: false delay: 1 - - CJALR: + C__JALR: + index: 83 encoding: 0b1001000000000010 mask: 0b1111000001111111 size: 16 branch: true delay: 1 - - CEBREAK: + C__EBREAK: + index: 84 encoding: 0b1001000000000010 mask: 0b1111111111111111 size: 16 branch: false delay: 1 - - CSWSP: + C__SWSP: + index: 85 encoding: 0b1100000000000010 mask: 0b1110000000000011 size: 16 branch: false delay: 1 - - DII: + DII: + index: 86 encoding: 0b0000000000000000 mask: 0b1111111111111111 size: 16 diff --git a/contrib/.gitignore b/contrib/pa/.gitignore similarity index 100% rename from contrib/.gitignore rename to contrib/pa/.gitignore diff --git a/contrib/README.md b/contrib/pa/README.md similarity index 96% rename from contrib/README.md rename to contrib/pa/README.md index c65d9f6..3c1c287 100644 --- a/contrib/README.md +++ b/contrib/pa/README.md @@ -19,7 +19,7 @@ setenv CXX $COWAREHOME/SLS/linux/common/bin/g++ cmake -S . -B build/PA -DCMAKE_BUILD_TYPE=Debug -DUSE_CWR_SYSTEMC=ON -DBUILD_SHARED_LIBS=ON \ -DCODEGEN=OFF -DCMAKE_INSTALL_PREFIX=${TGFS_INSTALL_ROOT} cmake --build build/PA --target install -j16 -cd dbt-rise-tgc/contrib +cd dbt-rise-tgc/contrib/pa # import the TGC core itself pct tgc_import_tb.tcl ``` @@ -37,7 +37,7 @@ export CXX=$COWAREHOME/SLS/linux/common/bin/g++ cmake -S . -B build/PA -DCMAKE_BUILD_TYPE=Debug -DUSE_CWR_SYSTEMC=ON -DBUILD_SHARED_LIBS=ON \ -DCODEGEN=OFF -DCMAKE_INSTALL_PREFIX=${TGFS_INSTALL_ROOT} cmake --build build/PA --target install -j16 -cd dbt-rise-tgc/contrib +cd dbt-rise-tgc/contrib/pa # import the TGC core itself pct tgc_import_tb.tcl ``` \ No newline at end of file diff --git a/contrib/build.tcl b/contrib/pa/build.tcl similarity index 100% rename from contrib/build.tcl rename to contrib/pa/build.tcl diff --git a/contrib/hello.dis b/contrib/pa/hello.dis similarity index 100% rename from contrib/hello.dis rename to contrib/pa/hello.dis diff --git a/contrib/hello.elf b/contrib/pa/hello.elf similarity index 100% rename from contrib/hello.elf rename to contrib/pa/hello.elf diff --git a/contrib/minres.png b/contrib/pa/minres.png similarity index 100% rename from contrib/minres.png rename to contrib/pa/minres.png diff --git a/contrib/tgc_import.cc b/contrib/pa/tgc_import.cc similarity index 100% rename from contrib/tgc_import.cc rename to contrib/pa/tgc_import.cc diff --git a/contrib/tgc_import.tcl b/contrib/pa/tgc_import.tcl similarity index 100% rename from contrib/tgc_import.tcl rename to contrib/pa/tgc_import.tcl diff --git a/contrib/tgc_import_tb.tcl b/contrib/pa/tgc_import_tb.tcl similarity index 100% rename from contrib/tgc_import_tb.tcl rename to contrib/pa/tgc_import_tb.tcl diff --git a/gen_input/TGC_C.core_desc b/gen_input/TGC5C.core_desc similarity index 100% rename from gen_input/TGC_C.core_desc rename to gen_input/TGC5C.core_desc diff --git a/gen_input/templates/CORENAME_instr.yaml.gtl b/gen_input/templates/CORENAME_instr.yaml.gtl index eb344ff..d9fdcbf 100644 --- a/gen_input/templates/CORENAME_instr.yaml.gtl +++ b/gen_input/templates/CORENAME_instr.yaml.gtl @@ -8,9 +8,10 @@ instrGroups[groupName]+=it; } instrGroups -}%><%getInstructionGroups().each{name, instrList -> %> -${name}: <% instrList.findAll{!it.instruction.name.startsWith("__")}.each { %> - - ${it.instruction.name}: +}%><%int index = 0; getInstructionGroups().each{name, instrList -> %> +${name}: <% instrList.each { %> + ${it.instruction.name}: + index: ${index++} encoding: ${it.encoding} mask: ${it.mask}<%if(it.attributes.size) {%> attributes: ${it.attributes}<%}%> diff --git a/gen_input/templates/interp/CORENAME.cpp.gtl b/gen_input/templates/interp/CORENAME.cpp.gtl index cfb6a76..d92ed44 100644 --- a/gen_input/templates/interp/CORENAME.cpp.gtl +++ b/gen_input/templates/interp/CORENAME.cpp.gtl @@ -40,10 +40,11 @@ def nativeTypeSize(int size){ #include #include #include -#include #include #include #include +#include +#include #ifndef FMT_HEADER_ONLY #define FMT_HEADER_ONLY diff --git a/src/iss/arch/hwl.h b/src/iss/arch/hwl.h index 9e954ba..80f0798 100644 --- a/src/iss/arch/hwl.h +++ b/src/iss/arch/hwl.h @@ -46,7 +46,7 @@ public: using this_class = hwl; using reg_t = typename BASE::reg_t; - hwl(); + hwl(feature_config cfg = feature_config{}); virtual ~hwl() = default; protected: @@ -56,7 +56,7 @@ protected: template -inline hwl::hwl() { +inline hwl::hwl(feature_config cfg): BASE(cfg) { for (unsigned addr = 0x800; addr < 0x803; ++addr){ this->register_custom_csr_rd(addr); this->register_custom_csr_wr(addr); diff --git a/src/iss/arch/riscv_hart_common.h b/src/iss/arch/riscv_hart_common.h index 45fc000..4125297 100644 --- a/src/iss/arch/riscv_hart_common.h +++ b/src/iss/arch/riscv_hart_common.h @@ -226,6 +226,8 @@ struct feature_config { unsigned clic_num_trigger{0}; uint64_t tcm_base{0x10000000}; uint64_t tcm_size{0x8000}; + uint64_t io_address{0xf0000000}; + uint64_t io_addr_mask{0xf0000000}; }; class trap_load_access_fault : public trap_access { diff --git a/src/iss/arch/riscv_hart_m_p.h b/src/iss/arch/riscv_hart_m_p.h index 935c774..26e327d 100644 --- a/src/iss/arch/riscv_hart_m_p.h +++ b/src/iss/arch/riscv_hart_m_p.h @@ -682,7 +682,7 @@ iss::status riscv_hart_m_p::read(const address_type type, const acce } else { res = hart_mem_rd_delegate( phys_addr, length, data); } - if (unlikely(res != iss::Ok)){ + if (unlikely(res != iss::Ok && (access & access_type::DEBUG) == 0)){ this->reg.trap_state = (1UL << 31) | (5 << 16); // issue trap 5 (load access fault fault_data=addr; } @@ -775,7 +775,7 @@ iss::status riscv_hart_m_p::write(const address_type type, const acc } else { res = write_mem( phys_addr, length, data); } - if (unlikely(res != iss::Ok)) { + if (unlikely(res != iss::Ok && (access & access_type::DEBUG) == 0)) { this->reg.trap_state = (1UL << 31) | (7 << 16); // issue trap 7 (Store/AMO access fault) fault_data=addr; } diff --git a/src/iss/arch/riscv_hart_msu_vp.h b/src/iss/arch/riscv_hart_msu_vp.h index ccf9e31..56c7209 100644 --- a/src/iss/arch/riscv_hart_msu_vp.h +++ b/src/iss/arch/riscv_hart_msu_vp.h @@ -286,7 +286,7 @@ public: return m[mode]; } - riscv_hart_msu_vp(); + riscv_hart_msu_vp(feature_config cfg = feature_config{}); virtual ~riscv_hart_msu_vp() = default; void reset(uint64_t address) override; @@ -636,7 +636,7 @@ iss::status riscv_hart_msu_vp::read(const address_type type, const access_ } } auto res = read_mem( BASE::v2p(iss::addr_t{access, type, space, addr}), length, data); - if (unlikely(res != iss::Ok)){ + if (unlikely(res != iss::Ok && (access & access_type::DEBUG) == 0)){ this->reg.trap_state = (1 << 31) | (5 << 16); // issue trap 5 (load access fault fault_data=addr; } @@ -734,7 +734,7 @@ iss::status riscv_hart_msu_vp::write(const address_type type, const access } } auto res = write_mem(paddr, length, data); - if (unlikely(res != iss::Ok)) { + if (unlikely(res != iss::Ok && (access & access_type::DEBUG) == 0)) { this->reg.trap_state = (1UL << 31) | (7UL << 16); // issue trap 7 (Store/AMO access fault) fault_data=addr; } diff --git a/src/iss/arch/riscv_hart_mu_p.h b/src/iss/arch/riscv_hart_mu_p.h index 48cf106..33089af 100644 --- a/src/iss/arch/riscv_hart_mu_p.h +++ b/src/iss/arch/riscv_hart_mu_p.h @@ -850,7 +850,7 @@ iss::status riscv_hart_mu_p::read(const address_type type, const acc } else { res = hart_mem_rd_delegate( phys_addr, length, data); } - if (unlikely(res != iss::Ok)){ + if (unlikely(res != iss::Ok && (access & access_type::DEBUG) == 0)){ this->reg.trap_state = (1UL << 31) | (5 << 16); // issue trap 5 (load access fault fault_data=addr; } @@ -951,7 +951,7 @@ iss::status riscv_hart_mu_p::write(const address_type type, const ac } else { res = hart_mem_wr_delegate( phys_addr, length, data); } - if (unlikely(res != iss::Ok)) { + if (unlikely(res != iss::Ok && (access & access_type::DEBUG) == 0)) { this->reg.trap_state = (1UL << 31) | (7UL << 16); // issue trap 7 (Store/AMO access fault) fault_data=addr; } diff --git a/src/iss/arch/wt_cache.h b/src/iss/arch/wt_cache.h index 2b3835b..7108b9d 100644 --- a/src/iss/arch/wt_cache.h +++ b/src/iss/arch/wt_cache.h @@ -81,7 +81,7 @@ public: using mem_write_f = typename BASE::mem_write_f; using phys_addr_t = typename BASE::phys_addr_t; - wt_cache(); + wt_cache(feature_config cfg = feature_config{}); virtual ~wt_cache() = default; unsigned size{4096}; @@ -103,7 +103,11 @@ protected: template -inline wt_cache::wt_cache() { +inline wt_cache::wt_cache(feature_config cfg) +:BASE(cfg) +, io_address{cfg.io_address} +, io_addr_mask{cfg.io_addr_mask} +{ auto cb = base_class::replace_mem_access( [this](phys_addr_t a, unsigned l, uint8_t* const d) -> iss::status { return read_cache(a, l,d);}, [this](phys_addr_t a, unsigned l, uint8_t const* const d) -> iss::status { return write_cache(a, l,d);}); diff --git a/src/iss/plugin/cycle_estimate.cpp b/src/iss/plugin/cycle_estimate.cpp index 77d4c5b..b389cb4 100644 --- a/src/iss/plugin/cycle_estimate.cpp +++ b/src/iss/plugin/cycle_estimate.cpp @@ -1,3 +1,4 @@ + /******************************************************************************* * Copyright (C) 2017 - 2023, MINRES Technologies GmbH * All rights reserved. @@ -33,18 +34,12 @@ ******************************************************************************/ #include "cycle_estimate.h" +#include #include #include -#include -#include -#include -#include -#include -#include #include -using namespace rapidjson; using namespace std; iss::plugin::cycle_estimate::cycle_estimate(string const& config_file_name) @@ -61,40 +56,31 @@ bool iss::plugin::cycle_estimate::registration(const char* const version, vm_if& if(!instr_if) return false; const string core_name = instr_if->core_type_name(); if (config_file_name.length() > 0) { - ifstream is(config_file_name); + std::ifstream is(config_file_name); if (is.is_open()) { try { - IStreamWrapper isw(is); - Document d; - ParseResult ok = d.ParseStream(isw); - if(ok) { - Value& val = d[core_name.c_str()]; - if(val.IsArray()){ - delays.reserve(val.Size()); - for (auto it = val.Begin(); it != val.End(); ++it) { - auto& name = (*it)["name"]; - auto& size = (*it)["size"]; - auto& delay = (*it)["delay"]; - auto& branch = (*it)["branch"]; - if(delay.IsArray()) { - auto dt = delay[0].Get(); - auto dnt = delay[1].Get(); - delays.push_back(instr_desc{size.Get(), dt, dnt, branch.Get()}); - } else if(delay.Is()) { - auto d = delay.Get(); - delays.push_back(instr_desc{size.Get(), d, d, branch.Get()}); - } else - throw runtime_error("JSON parse error"); - } - } else { - LOG(ERR)<<"plugin cycle_estimate: could not find an entry for "<(); + auto delay = instr.second["delay"]; + if(delay.IsSequence()) { + res.not_taken = delay[0].as(); + res.taken = delay[1].as(); + } else { + res.not_taken = delay.as(); + res.taken = res.not_taken; + } + delays.push_back(std::move(res)); + } + } + } catch (YAML::ParserException &e) { LOG(ERR) << "Could not parse input file " << config_file_name << ", reason: " << e.what(); return false; } @@ -112,7 +98,7 @@ void iss::plugin::cycle_estimate::callback(instr_info_t instr_info) { auto entry = delays[instr_info.instr_id]; bool taken = instr_if->is_branch_taken(); if (taken && (entry.taken > 1)) - instr_if->update_last_instr_cycles(entry.taken); - else if (entry.not_taken > 1) - instr_if->update_last_instr_cycles(entry.not_taken); + instr_if->update_last_instr_cycles(entry.taken); + else if (entry.not_taken > 1) + instr_if->update_last_instr_cycles(entry.not_taken); } diff --git a/src/iss/plugin/instruction_count.cpp b/src/iss/plugin/instruction_count.cpp index 7613b27..01fb45c 100644 --- a/src/iss/plugin/instruction_count.cpp +++ b/src/iss/plugin/instruction_count.cpp @@ -34,6 +34,7 @@ #include "instruction_count.h" #include +#include #include #include @@ -44,8 +45,30 @@ iss::plugin::instruction_count::instruction_count(std::string config_file_name) std::ifstream is(config_file_name); if (is.is_open()) { try { - is >> root; - } catch (Json::RuntimeError &e) { + auto root = YAML::LoadAll(is); + if(root.size()!=1) { + LOG(ERR) << "Too many rro nodes in YAML file " << config_file_name; + } + for (auto p : root[0]) { + auto isa_subset = p.first; + auto instructions = p.second; + for (auto const& instr : instructions) { + instr_delay res; + res.instr_name = instr.first.as(); + res.size = instr.second["encoding"].as().size()-2; // not counting 0b + auto delay = instr.second["delay"]; + if(delay.IsSequence()) { + res.not_taken_delay = delay[0].as(); + res.taken_delay = delay[1].as(); + } else { + res.not_taken_delay = delay.as(); + res.taken_delay = res.not_taken_delay; + } + delays.push_back(std::move(res)); + } + } + rep_counts.resize(delays.size()); + } catch (YAML::ParserException &e) { LOG(ERR) << "Could not parse input file " << config_file_name << ", reason: " << e.what(); } } else { @@ -57,7 +80,7 @@ iss::plugin::instruction_count::instruction_count(std::string config_file_name) iss::plugin::instruction_count::~instruction_count() { size_t idx=0; for(auto it:delays){ - if(rep_counts[idx]>0) + if(rep_counts[idx]>0 && it.instr_name.find("__"!=0)) LOG(INFO)<get_instrumentation_if(); if(!instr_if) return false; - const std::string core_name = instr_if->core_type_name(); - Json::Value &val = root[core_name]; - if(!val.isNull() && val.isArray()){ - delays.reserve(val.size()); - for(auto it:val){ - auto name = it["name"]; - auto size = it["size"]; - auto delay = it["delay"]; - if(!name.isString() || !size.isUInt() || !(delay.isUInt() || delay.isArray())) throw std::runtime_error("JSON parse error"); - if(delay.isUInt()){ - const instr_delay entry{name.asCString(), size.asUInt(), delay.asUInt(), 0}; - delays.push_back(entry); - } else { - const instr_delay entry{name.asCString(), size.asUInt(), delay[0].asUInt(), delay[1].asUInt()}; - delays.push_back(entry); - } - } - rep_counts.resize(delays.size()); - } else { - LOG(ERR)<<"plugin instruction_count: could not find an entry for "< -#include #include +#include namespace iss { namespace plugin { @@ -72,7 +72,6 @@ public: void callback(instr_info_t) override; private: - Json::Value root; std::vector delays; std::vector rep_counts; }; diff --git a/src/main.cpp b/src/main.cpp index 1d3d8e9..03a68d0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,217 +1,222 @@ -/******************************************************************************* - * Copyright (C) 2017, 2018 MINRES Technologies GmbH - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - *******************************************************************************/ - -#include -#include -#include -#include - -#include -#include -#include "iss/arch/tgc_mapper.h" -#ifdef WITH_LLVM -#include -#endif -#include -#include "iss/plugin/cycle_estimate.h" -#include "iss/plugin/instruction_count.h" -#ifndef WIN32 -#include -#endif -#if defined(HAS_LUA) -#include -#endif - -namespace po = boost::program_options; - -int main(int argc, char *argv[]) { - /* - * Define and parse the program options - */ - po::variables_map clim; - po::options_description desc("Options"); - // clang-format off - desc.add_options() - ("help,h", "Print help message") - ("verbose,v", po::value()->default_value(4), "Sets logging verbosity") - ("logfile,l", po::value(), "Sets default log file.") - ("disass,d", po::value()->implicit_value(""), "Enables disassembly") - ("gdb-port,g", po::value()->default_value(0), "enable gdb server and specify port to use") - ("instructions,i", po::value()->default_value(std::numeric_limits::max()), "max. number of instructions to simulate") - ("reset,r", po::value(), "reset address") - ("dump-ir", "dump the intermediate representation") - ("elf,f", po::value>(), "ELF file(s) to load") - ("mem,m", po::value(), "the memory input file") - ("plugin,p", po::value>(), "plugin to activate") - ("backend", po::value()->default_value("interp"), "the ISS backend to use, options are: interp, tcc") - ("isa", po::value()->default_value("tgc5c"), "isa to use for simulation"); - // clang-format on - auto parsed = po::command_line_parser(argc, argv).options(desc).allow_unregistered().run(); - try { - po::store(parsed, clim); // can throw - // --help option - if (clim.count("help")) { - std::cout << "DBT-RISE-RiscV simulator for RISC-V" << std::endl << desc << std::endl; - return 0; - } - po::notify(clim); // throws on error, so do after help in case - } catch (po::error &e) { - // there are problems - std::cerr << "ERROR: " << e.what() << std::endl << std::endl; - std::cerr << desc << std::endl; - return 1; - } - std::vector args = collect_unrecognized(parsed.options, po::include_positional); - - LOGGER(DEFAULT)::print_time() = false; - LOGGER(connection)::print_time() = false; - auto l = logging::as_log_level(clim["verbose"].as()); - LOGGER(DEFAULT)::reporting_level() = l; - LOGGER(connection)::reporting_level() = l; - if (clim.count("logfile")) { - // configure the connection logger - auto f = fopen(clim["logfile"].as().c_str(), "w"); - LOG_OUTPUT(DEFAULT)::stream() = f; - LOG_OUTPUT(connection)::stream() = f; - } - - std::vector plugin_list; - auto res = 0; - try { -#ifdef WITH_LLVM - // application code comes here // - iss::init_jit_debug(argc, argv); -#endif - bool dump = clim.count("dump-ir"); - auto & f = iss::core_factory::instance(); - // instantiate the simulator - iss::vm_ptr vm{nullptr}; - iss::cpu_ptr cpu{nullptr}; - std::string isa_opt(clim["isa"].as()); - if(isa_opt.size()==0 || isa_opt == "?") { - std::cout<<"Available cores: "<(), clim["gdb-port"].as()); - } else { - auto base_isa = isa_opt.substr(0, 5); - if(base_isa=="tgc_d" || base_isa=="tgc_e") { - isa_opt += "|mu_p_clic_pmp|"+clim["backend"].as(); - } else { - isa_opt += "|m_p|"+clim["backend"].as(); - } - std::tie(cpu, vm) = f.create(isa_opt, clim["gdb-port"].as()); - } - if(!cpu ){ - LOG(ERR) << "Could not create cpu for isa " << isa_opt << " and backend " <()<< std::endl; - return 127; - } - if(!vm ){ - LOG(ERR) << "Could not create vm for isa " << isa_opt << " and backend " <()<< std::endl; - return 127; - } - if (clim.count("plugin")) { - for (std::string const& opt_val : clim["plugin"].as>()) { - std::string plugin_name=opt_val; - std::string arg{""}; - std::size_t found = opt_val.find('='); - if (found != std::string::npos) { - plugin_name = opt_val.substr(0, found); - arg = opt_val.substr(found + 1, opt_val.size()); - } - if (plugin_name == "ic") { - auto *ic_plugin = new iss::plugin::instruction_count(arg); - vm->register_plugin(*ic_plugin); - plugin_list.push_back(ic_plugin); - } else if (plugin_name == "ce") { - auto *ce_plugin = new iss::plugin::cycle_estimate(arg); - vm->register_plugin(*ce_plugin); - plugin_list.push_back(ce_plugin); - }else { -#ifndef WIN32 - std::vector a{}; - if(arg.length()) - a.push_back({arg.c_str()}); - iss::plugin::loader l(plugin_name, {{"initPlugin"}}); - auto* plugin = l.call_function("initPlugin", a.size(), a.data()); - if(plugin){ - vm->register_plugin(*plugin); - plugin_list.push_back(plugin); - } else -#endif - { - LOG(ERR) << "Unknown plugin name: " << plugin_name << ", valid names are 'ce', 'ic'" << std::endl; - return 127; - } - } - } - } - if (clim.count("disass")) { - vm->setDisassEnabled(true); - LOGGER(disass)::reporting_level() = logging::INFO; - LOGGER(disass)::print_time() = false; - auto file_name = clim["disass"].as(); - if (file_name.length() > 0) { - LOG_OUTPUT(disass)::stream() = fopen(file_name.c_str(), "w"); - LOGGER(disass)::print_severity() = false; - } - } - uint64_t start_address = 0; - if (clim.count("mem")) - vm->get_arch()->load_file(clim["mem"].as()); - if (clim.count("elf")) - for (std::string input : clim["elf"].as>()) { - auto start_addr = vm->get_arch()->load_file(input); - if (start_addr.second) start_address = start_addr.first; - } - for (std::string input : args) { - auto start_addr = vm->get_arch()->load_file(input); // treat remaining arguments as elf files - if (start_addr.second) start_address = start_addr.first; - } - if (clim.count("reset")) { - auto str = clim["reset"].as(); - start_address = str.find("0x") == 0 ? std::stoull(str.substr(2), nullptr, 16) : std::stoull(str, nullptr, 10); - } - vm->reset(start_address); - auto cycles = clim["instructions"].as(); - res = vm->start(cycles, dump); - } catch (std::exception &e) { - LOG(ERR) << "Unhandled Exception reached the top of main: " << e.what() << ", application will now exit" - << std::endl; - res = 2; - } - // cleanup to let plugins report of needed - for (auto *p : plugin_list) { - delete p; - } - return res; -} +/******************************************************************************* + * Copyright (C) 2017, 2018 MINRES Technologies GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + *******************************************************************************/ + +#include +#include +#include +#include + +#include +#include +#include "iss/arch/tgc_mapper.h" +#ifdef WITH_LLVM +#include +#endif +#include +#include "iss/plugin/cycle_estimate.h" +#include "iss/plugin/instruction_count.h" +#ifndef WIN32 +#include +#endif +#if defined(HAS_LUA) +#include +#endif + +namespace po = boost::program_options; + +int main(int argc, char *argv[]) { + /* + * Define and parse the program options + */ + po::variables_map clim; + po::options_description desc("Options"); + // clang-format off + desc.add_options() + ("help,h", "Print help message") + ("verbose,v", po::value()->default_value(4), "Sets logging verbosity") + ("logfile,l", po::value(), "Sets default log file.") + ("disass,d", po::value()->implicit_value(""), "Enables disassembly") + ("gdb-port,g", po::value()->default_value(0), "enable gdb server and specify port to use") + ("instructions,i", po::value()->default_value(std::numeric_limits::max()), "max. number of instructions to simulate") + ("reset,r", po::value(), "reset address") + ("dump-ir", "dump the intermediate representation") + ("elf,f", po::value>(), "ELF file(s) to load") + ("mem,m", po::value(), "the memory input file") + ("plugin,p", po::value>(), "plugin to activate") + ("backend", po::value()->default_value("interp"), "the ISS backend to use, options are: interp, tcc") + ("isa", po::value()->default_value("tgc5c"), "core or isa name to use for simulation, use '?' to get list"); + // clang-format on + auto parsed = po::command_line_parser(argc, argv).options(desc).allow_unregistered().run(); + try { + po::store(parsed, clim); // can throw + // --help option + if (clim.count("help")) { + std::cout << "DBT-RISE-TGC simulator for TGC RISC-V cores" << std::endl << desc << std::endl; + return 0; + } + po::notify(clim); // throws on error, so do after help in case + } catch (po::error &e) { + // there are problems + std::cerr << "ERROR: " << e.what() << std::endl << std::endl; + std::cerr << desc << std::endl; + return 1; + } + std::vector args = collect_unrecognized(parsed.options, po::include_positional); + + LOGGER(DEFAULT)::print_time() = false; + LOGGER(connection)::print_time() = false; + auto l = logging::as_log_level(clim["verbose"].as()); + LOGGER(DEFAULT)::reporting_level() = l; + LOGGER(connection)::reporting_level() = l; + if (clim.count("logfile")) { + // configure the connection logger + auto f = fopen(clim["logfile"].as().c_str(), "w"); + LOG_OUTPUT(DEFAULT)::stream() = f; + LOG_OUTPUT(connection)::stream() = f; + } + + std::vector plugin_list; + auto res = 0; + try { +#ifdef WITH_LLVM + // application code comes here // + iss::init_jit_debug(argc, argv); +#endif + bool dump = clim.count("dump-ir"); + auto & f = iss::core_factory::instance(); + // instantiate the simulator + iss::vm_ptr vm{nullptr}; + iss::cpu_ptr cpu{nullptr}; + std::string isa_opt(clim["isa"].as()); + if(isa_opt.size()==0 || isa_opt == "?") { + auto list = f.get_names(); + std::sort(std::begin(list), std::end(list)); + std::cout<<"Available implementations (core|platform|backend):\n - "<(), clim["gdb-port"].as()); + } else { + auto base_isa = isa_opt.substr(0, 5); + if(base_isa=="tgc5d" || base_isa=="tgc5e") { + isa_opt += "|mu_p_clic_pmp|"+clim["backend"].as(); + } else { + isa_opt += "|m_p|"+clim["backend"].as(); + } + std::tie(cpu, vm) = f.create(isa_opt, clim["gdb-port"].as()); + } + if(!cpu ){ + LOG(ERR) << "Could not create cpu for isa " << isa_opt << " and backend " <()<< std::endl; + return 127; + } + if(!vm ){ + LOG(ERR) << "Could not create vm for isa " << isa_opt << " and backend " <()<< std::endl; + return 127; + } + if (clim.count("plugin")) { + for (std::string const& opt_val : clim["plugin"].as>()) { + std::string plugin_name=opt_val; + std::string arg{""}; + std::size_t found = opt_val.find('='); + if (found != std::string::npos) { + plugin_name = opt_val.substr(0, found); + arg = opt_val.substr(found + 1, opt_val.size()); + } +#if defined(WITH_PLUGINS) + if (plugin_name == "ic") { + auto *ic_plugin = new iss::plugin::instruction_count(arg); + vm->register_plugin(*ic_plugin); + plugin_list.push_back(ic_plugin); + } else if (plugin_name == "ce") { + auto *ce_plugin = new iss::plugin::cycle_estimate(arg); + vm->register_plugin(*ce_plugin); + plugin_list.push_back(ce_plugin); + } else +#endif + { +#if !defined(WIN32) + std::vector a{}; + if(arg.length()) + a.push_back({arg.c_str()}); + iss::plugin::loader l(plugin_name, {{"initPlugin"}}); + auto* plugin = l.call_function("initPlugin", a.size(), a.data()); + if(plugin){ + vm->register_plugin(*plugin); + plugin_list.push_back(plugin); + } else +#endif + { + LOG(ERR) << "Unknown plugin name: " << plugin_name << ", valid names are 'ce', 'ic'" << std::endl; + return 127; + } + } + } + } + if (clim.count("disass")) { + vm->setDisassEnabled(true); + LOGGER(disass)::reporting_level() = logging::INFO; + LOGGER(disass)::print_time() = false; + auto file_name = clim["disass"].as(); + if (file_name.length() > 0) { + LOG_OUTPUT(disass)::stream() = fopen(file_name.c_str(), "w"); + LOGGER(disass)::print_severity() = false; + } + } + uint64_t start_address = 0; + if (clim.count("mem")) + vm->get_arch()->load_file(clim["mem"].as()); + if (clim.count("elf")) + for (std::string input : clim["elf"].as>()) { + auto start_addr = vm->get_arch()->load_file(input); + if (start_addr.second) start_address = start_addr.first; + } + for (std::string input : args) { + auto start_addr = vm->get_arch()->load_file(input); // treat remaining arguments as elf files + if (start_addr.second) start_address = start_addr.first; + } + if (clim.count("reset")) { + auto str = clim["reset"].as(); + start_address = str.find("0x") == 0 ? std::stoull(str.substr(2), nullptr, 16) : std::stoull(str, nullptr, 10); + } + vm->reset(start_address); + auto cycles = clim["instructions"].as(); + res = vm->start(cycles, dump); + } catch (std::exception &e) { + LOG(ERR) << "Unhandled Exception reached the top of main: " << e.what() << ", application will now exit" + << std::endl; + res = 2; + } + // cleanup to let plugins report of needed + for (auto *p : plugin_list) { + delete p; + } + return res; +} diff --git a/src/sysc/core_complex.cpp b/src/sysc/core_complex.cpp index a11c901..78eb36e 100644 --- a/src/sysc/core_complex.cpp +++ b/src/sysc/core_complex.cpp @@ -50,7 +50,6 @@ #include #include #include -#include // clang-format on @@ -283,10 +282,6 @@ void core_complex::before_end_of_elaboration() { auto *plugin = new iss::plugin::cycle_estimate(filename); cpu->vm->register_plugin(*plugin); plugin_list.push_back(plugin); - } else if (plugin_name == "pctrace") { - auto *plugin = new iss::plugin::pctrace(filename); - cpu->vm->register_plugin(*plugin); - plugin_list.push_back(plugin); } else { #ifndef WIN32 std::array a{{filename.c_str()}}; diff --git a/src/vm/interp/vm_tgc5c.cpp b/src/vm/interp/vm_tgc5c.cpp index f05220b..d5d635c 100644 --- a/src/vm/interp/vm_tgc5c.cpp +++ b/src/vm/interp/vm_tgc5c.cpp @@ -36,10 +36,11 @@ #include #include #include -#include #include #include #include +#include +#include #ifndef FMT_HEADER_ONLY #define FMT_HEADER_ONLY @@ -2522,8 +2523,7 @@ typename vm_base::virt_addr_t vm_impl::execute_inst(finish_cond_e co // execute instruction { if(rs1 && rs1 < traits::RFS) { - uint32_t addr_mask = (uint32_t)- 2; - *NEXT_PC = *(X+rs1 % traits::RFS) & addr_mask; + *NEXT_PC = *(X+rs1 % traits::RFS) & ~ 0x1; this->core.reg.last_branch = 1; } else { @@ -2589,10 +2589,9 @@ typename vm_base::virt_addr_t vm_impl::execute_inst(finish_cond_e co raise(0, 2); } else { - uint32_t addr_mask = (uint32_t)- 2; uint32_t new_pc = *(X+rs1); *(X+1) = (uint32_t)(*PC + 2); - *NEXT_PC = new_pc & addr_mask; + *NEXT_PC = new_pc & ~ 0x1; this->core.reg.last_branch = 1; } } diff --git a/src/vm/llvm/vm_tgc5c.cpp b/src/vm/llvm/vm_tgc5c.cpp index 2229db3..460a9d7 100644 --- a/src/vm/llvm/vm_tgc5c.cpp +++ b/src/vm/llvm/vm_tgc5c.cpp @@ -4549,13 +4549,13 @@ volatile std::array dummy = { auto* vm = new llvm::tgc5c::vm_impl(*cpu, false); if (port != 0) debugger::server::run_server(vm, port); return {cpu_ptr{cpu}, vm_ptr{vm}}; - }), + })/*, core_factory::instance().register_creator("tgc5c|mu_p|llvm", [](unsigned port, void*) -> std::tuple{ auto* cpu = new iss::arch::riscv_hart_mu_p(); auto* vm = new llvm::tgc5c::vm_impl(*cpu, false); if (port != 0) debugger::server::run_server(vm, port); return {cpu_ptr{cpu}, vm_ptr{vm}}; - }) + })*/ }; } } diff --git a/src/vm/tcc/vm_tgc5c.cpp b/src/vm/tcc/vm_tgc5c.cpp index 965b9c7..23a0060 100644 --- a/src/vm/tcc/vm_tgc5c.cpp +++ b/src/vm/tcc/vm_tgc5c.cpp @@ -3303,12 +3303,12 @@ private: pc=pc+ 2; gen_set_pc(tu, pc, traits::NEXT_PC); tu.open_scope(); - if(rs1&&rs1(traits:: RFS)){ auto addr_mask = tu.assignment(tu.constant((uint32_t)- 2,32),32); - auto PC_val_v = tu.assignment("PC_val", tu.bitwise_and( - tu.load(rs1%static_cast(traits:: RFS)+ traits::X0, 0), - addr_mask),32); - tu.store(traits::NEXT_PC, PC_val_v); - tu.store(traits::LAST_BRANCH, tu.constant(2U, 2)); + if(rs1&&rs1(traits:: RFS)) { + auto PC_val_v = tu.assignment("PC_val", tu.bitwise_and( + tu.load(rs1%static_cast(traits:: RFS)+ traits::X0, 0), + tu.constant(~ 0x1,8)),32); + tu.store(traits::NEXT_PC, PC_val_v); + tu.store(traits::LAST_BRANCH, tu.constant(2U, 2)); } else{ this->gen_raise_trap(tu, 0, 2); @@ -3401,13 +3401,12 @@ private: this->gen_raise_trap(tu, 0, 2); } else{ - auto addr_mask = tu.assignment(tu.constant((uint32_t)- 2,32),32); auto new_pc = tu.assignment(tu.load(rs1+ traits::X0, 0),32); tu.store(1 + traits::X0, tu.constant((uint32_t)(PC+ 2),32)); auto PC_val_v = tu.assignment("PC_val", tu.bitwise_and( new_pc, - addr_mask),32); + tu.constant(~ 0x1,8)),32); tu.store(traits::NEXT_PC, PC_val_v); tu.store(traits::LAST_BRANCH, tu.constant(2U, 2)); } @@ -3433,7 +3432,7 @@ private: gen_set_pc(tu, pc, traits::NEXT_PC); tu.open_scope(); this->gen_raise_trap(tu, 0, 3); - auto returnValue = std::make_tuple(TRAP); + auto returnValue = std::make_tuple(CONT); tu.close_scope(); gen_trap_check(tu); @@ -3490,7 +3489,7 @@ private: gen_set_pc(tu, pc, traits::NEXT_PC); tu.open_scope(); this->gen_raise_trap(tu, 0, 2); - auto returnValue = std::make_tuple(TRAP); + auto returnValue = std::make_tuple(CONT); tu.close_scope(); gen_trap_check(tu);