fix CoreDSL based code generation

This commit is contained in:
Eyck Jentzsch 2021-05-13 15:55:25 +02:00
parent ed47790357
commit 77b063e50c
3 changed files with 21 additions and 18 deletions

View File

@ -1,13 +1,16 @@
cmake_minimum_required(VERSION 3.11) cmake_minimum_required(VERSION 3.11)
option(ENABLE_CODEGEN "Enable code generation for supported cores" ON) option(ENABLE_CODEGEN "Enable code generation for supported cores" ON)
#helper to setup code generation and generate outputs set(ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
set(GENERATOR_JAR ${dbt-core-tgc_SOURCE_DIR}/../coredsl/com.minres.coredsl.generator.repository/target/com.minres.coredsl.generator-2.0.0-SNAPSHOT.jar) set(DBT_CORE_TGC_DIR ${ROOT_DIR}/tgfs)
if(EXISTS ${dbt-core-tgc_SOURCE_DIR}/../coredsl/pom.xml AND NOT EXISTS ${GENERATOR_JAR}) #helper to setup code generation and generate outputs
set(GENERATOR_JAR ${ROOT_DIR}/coredsl/com.minres.coredsl.generator.repository/target/com.minres.coredsl.generator-2.0.0-SNAPSHOT.jar)
if(EXISTS ${ROOT_DIR}/coredsl/pom.xml AND NOT EXISTS ${GENERATOR_JAR})
execute_process( execute_process(
COMMAND mvn package COMMAND mvn package
WORKING_DIRECTORY ${dbt-core-tgc_SOURCE_DIR}/../coredsl WORKING_DIRECTORY ${ROOT_DIR}/coredsl
RESULT_VARIABLE return_code) RESULT_VARIABLE return_code)
endif() endif()
@ -47,29 +50,29 @@ set(JAVA_OPTS --add-modules ALL-SYSTEM --add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.rmi/java.rmi.server=ALL-UNNAMED --add-opens=java.sql/java.sql=ALL-UNNAMED) --add-opens=java.rmi/java.rmi.server=ALL-UNNAMED --add-opens=java.sql/java.sql=ALL-UNNAMED)
set(GENERATOR java ${JAVA_OPTS} -jar ${GENERATOR_JAR}) set(GENERATOR java ${JAVA_OPTS} -jar ${GENERATOR_JAR})
set(INPUT_DIR ${dbt-core-tgc_SOURCE_DIR}/gen_input) set(INPUT_DIR ${DBT_CORE_TGC_DIR}/gen_input)
set(REPO_DIR ${dbt-core-tgc_SOURCE_DIR}/gen_input/CoreDSL-Instruction-Set-Description) set(REPO_DIR ${DBT_CORE_TGC_DIR}/gen_input/CoreDSL-Instruction-Set-Description)
set(TMPL_DIR ${dbt-core-tgc_SOURCE_DIR}/gen_input/templates/) set(TMPL_DIR ${DBT_CORE_TGC_DIR}/gen_input/templates/)
if(ENABLE_CODEGEN AND EXISTS ${GENERATOR_JAR}) if(ENABLE_CODEGEN AND EXISTS ${GENERATOR_JAR})
macro(gen_coredsl CORE_NAME INPUT_FILE BACKEND) macro(gen_coredsl CORE_NAME INPUT_FILE BACKEND)
message(STATUS "Adding generation steps for ${CORE_NAME} in ${dbt-core-tgc_SOURCE_DIR} for ${BACKEND}") message(STATUS "Adding generation steps for ${CORE_NAME} in ${DBT_CORE_TGC_DIR} for ${BACKEND}")
string(TOUPPER ${BACKEND} BE_UPPER) string(TOUPPER ${BACKEND} BE_UPPER)
string(TOLOWER ${CORE_NAME} CORE_NAMEL) string(TOLOWER ${CORE_NAME} CORE_NAMEL)
if(EXISTS ${dbt-core-tgc_SOURCE_DIR}/generate.sh AND NOT EXISTS ${dbt-core-tgc_SOURCE_DIR}/incl/iss/arch/${CORE_NAMEL}.h) if(EXISTS ${DBT_CORE_TGC_DIR}/generate.sh AND NOT EXISTS ${DBT_CORE_TGC_DIR}/incl/iss/arch/${CORE_NAMEL}.h)
# make sure source file exist initially # make sure source file exist initially
execute_process( execute_process(
COMMAND /bin/bash ${dbt-core-tgc_SOURCE_DIR}/../generate.sh $CORE_NAME $BACKEND COMMAND /bin/bash ${DBT_CORE_TGC_DIR}/../generate.sh $CORE_NAME $BACKEND
WORKING_DIRECTORY ${dbt-core-tgc_SOURCE_DIR}/.. WORKING_DIRECTORY ${DBT_CORE_TGC_DIR}/..
RESULT_VARIABLE return_code) RESULT_VARIABLE return_code)
endif() endif()
list(APPEND ${CORE_NAME}_MAPPING -m "${TMPL_DIR}/CORENAME.h.gtl:${dbt-core-tgc_SOURCE_DIR}/incl/iss/arch/${CORE_NAMEL}.h") list(APPEND ${CORE_NAME}_MAPPING -m "${TMPL_DIR}/CORENAME.h.gtl:${DBT_CORE_TGC_DIR}/incl/iss/arch/${CORE_NAMEL}.h")
list(APPEND ${CORE_NAME}_MAPPING -m "${TMPL_DIR}/CORENAME.cpp.gtl:${dbt-core-tgc_SOURCE_DIR}/src/iss/${CORE_NAMEL}.cpp") list(APPEND ${CORE_NAME}_MAPPING -m "${TMPL_DIR}/CORENAME.cpp.gtl:${DBT_CORE_TGC_DIR}/src/iss/${CORE_NAMEL}.cpp")
list(APPEND ${CORE_NAME}_MAPPING -m "${TMPL_DIR}/${BACKEND}/CORENAME.cpp.gtl:${dbt-core-tgc_SOURCE_DIR}/src/vm/interp/vm_${CORE_NAMEL}.cpp") list(APPEND ${CORE_NAME}_MAPPING -m "${TMPL_DIR}/${BACKEND}/CORENAME.cpp.gtl:${DBT_CORE_TGC_DIR}/src/vm/interp/vm_${CORE_NAMEL}.cpp")
set(${CORE_NAME}_OUTPUT_FILES ${dbt-core-tgc_SOURCE_DIR}/incl/iss/arch/${CORE_NAMEL}.h ${dbt-core-tgc_SOURCE_DIR}/src/iss/${CORE_NAMEL}.cpp ${dbt-core-tgc_SOURCE_DIR}/src/vm/interp/vm_${CORE_NAMEL}.cpp) set(${CORE_NAME}_OUTPUT_FILES ${DBT_CORE_TGC_DIR}/incl/iss/arch/${CORE_NAMEL}.h ${DBT_CORE_TGC_DIR}/src/iss/${CORE_NAMEL}.cpp ${DBT_CORE_TGC_DIR}/src/vm/interp/vm_${CORE_NAMEL}.cpp)
add_custom_command( add_custom_command(
COMMAND ${GENERATOR} -b ${BE_UPPER} -c ${CORE_NAME} -r ${REPO_DIR} ${${CORE_NAME}_MAPPING} ${INPUT_FILE} COMMAND ${GENERATOR} -b ${BE_UPPER} -c ${CORE_NAME} -r ${REPO_DIR} ${${CORE_NAME}_MAPPING} ${INPUT_FILE}
DEPENDS ${GENERATOR_JAR} ${INPUT_FILE} ${TMPL_DIR}/CORENAME.h.gtl ${TMPL_DIR}/CORENAME.cpp.gtl ${TMPL_DIR}/${BACKEND}/CORENAME.cpp.gtl DEPENDS ${GENERATOR_JAR} ${INPUT_FILE} ${TMPL_DIR}/CORENAME.h.gtl ${TMPL_DIR}/CORENAME.cpp.gtl ${TMPL_DIR}/${BACKEND}/CORENAME.cpp.gtl
@ -82,6 +85,6 @@ if(ENABLE_CODEGEN AND EXISTS ${GENERATOR_JAR})
else() else()
macro(gen_coredsl CORE_NAME INPUT_FILE BACKEND) macro(gen_coredsl CORE_NAME INPUT_FILE BACKEND)
add_custom_target(${CORE_NAME}_src) add_custom_target(${CORE_NAME}_src)
message(STATUS "Not adding generation steps for ${CORE_NAME}") message(STATUS "Not adding generation steps for ${CORE_NAME}(${ENABLE_CODEGEN}, ${GENERATOR_JAR})")
endmacro() endmacro()
endif() endif()

@ -1 +1 @@
Subproject commit 43431946e3b5d168901feaead9a026091e69662b Subproject commit 012eb1b929dabbb5cf08b9fd2993d78f08fe685e

2
tgfs

@ -1 +1 @@
Subproject commit f2bf6d682a1b3eeabe416339b77275ed5c9e8e53 Subproject commit c57884caeea1e3e37ec4addebb96ed19ed817852