From 38b8567bb8d5b35ab73a4330b042c07cdb4a2905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Risto=20Peja=C5=A1inovi=C4=87?= Date: Thu, 7 Mar 2024 16:45:34 +0100 Subject: [PATCH 01/15] add regblock_wrap --- SoCMakeConfig.cmake | 1 + cmake/peakrdl/peakrdl_regblock_wrap.cmake | 78 +++++++++++++++++++++++ cmake/tmrg/tmrg/tmrg.cmake | 10 ++- 3 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 cmake/peakrdl/peakrdl_regblock_wrap.cmake diff --git a/SoCMakeConfig.cmake b/SoCMakeConfig.cmake index 2ed12d3..a200e0e 100644 --- a/SoCMakeConfig.cmake +++ b/SoCMakeConfig.cmake @@ -40,6 +40,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/cmake/sim/verisc/verisc_install.cmake") # ==================================== include("${CMAKE_CURRENT_LIST_DIR}/cmake/peakrdl/peakrdl_regblock.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/cmake/peakrdl/peakrdl_regblock_wrap.cmake") include("${CMAKE_CURRENT_LIST_DIR}/cmake/peakrdl/peakrdl_halcpp.cmake") include("${CMAKE_CURRENT_LIST_DIR}/cmake/peakrdl/peakrdl_ipblocksvg.cmake") include("${CMAKE_CURRENT_LIST_DIR}/cmake/peakrdl/peakrdl_html/peakrdl_html.cmake") diff --git a/cmake/peakrdl/peakrdl_regblock_wrap.cmake b/cmake/peakrdl/peakrdl_regblock_wrap.cmake new file mode 100644 index 0000000..72c5c7b --- /dev/null +++ b/cmake/peakrdl/peakrdl_regblock_wrap.cmake @@ -0,0 +1,78 @@ +function(peakrdl_regblock_wrap IP_LIB) + # Parse keyword arguments + cmake_parse_arguments(ARG "" "OUTDIR;RENAME;INTF" "" ${ARGN}) + # Check for any unknown argument + if(ARG_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} passed unrecognized argument " + "${ARG_UNPARSED_ARGUMENTS}") + endif() + + include("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../hwip.cmake") + include("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../utils/find_python.cmake") + + ip_assume_last(IP_LIB ${IP_LIB}) + get_target_property(BINARY_DIR ${IP_LIB} BINARY_DIR) + + # Default output directory is regblock/ + if(NOT ARG_OUTDIR) + set(OUTDIR ${BINARY_DIR}/regblock) + else() + set(OUTDIR ${ARG_OUTDIR}) + endif() + + if(NOT ARG_RENAME) + # The default name is the IP name + get_target_property(IP_NAME ${IP_LIB} IP_NAME) + else() + set(IP_NAME ${ARG_RENAME}) + endif() + + # The default interface used is apb3, set another on if the argument exists + if(ARG_INTF) + set(INTF_ARG --cpuif ${ARG_INTF}) + endif() + # Get the SystemRDL sources to generate the register block + # This function gets the IP sources and the deps + get_ip_sources(RDL_SOURCES ${IP_LIB} SYSTEMRDL) + + if(NOT RDL_SOURCES) + message(FATAL_ERROR "Library ${IP_LIB} does not have SYSTEMRDL_SOURCES property set, + unable to run ${CMAKE_CURRENT_FUNCTION}") + endif() + + find_python3() + set(__CMD ${Python3_EXECUTABLE} -m peakrdl regblock_wrap + # --rename ${IP_NAME} + # ${INTF_ARG} + -o ${OUTDIR} + ${RDL_SOURCES} + ) + + set(SV_GEN + ${OUTDIR}/${IP_NAME}_regblock_pkg.sv + ${OUTDIR}/${IP_NAME}_regblock.sv + ${OUTDIR}/${IP_NAME}_wrap.sv + ) + # Prepend the generated files to the IP sources + ip_sources(${IP_LIB} SYSTEMVERILOG PREPEND ${SV_GEN}) + + set(STAMP_FILE "${BINARY_DIR}/${IP_LIB}_${CMAKE_CURRENT_FUNCTION}.stamp") + add_custom_command( + # The output files are automtically marked as GENERATED (deleted by make clean among other things) + OUTPUT ${SV_GEN} ${STAMP_FILE} + COMMAND ${__CMD} + + COMMAND touch ${STAMP_FILE} + DEPENDS ${RDL_SOURCES} + COMMENT "Running ${CMAKE_CURRENT_FUNCTION} on ${IP_LIB}" + ) + # This target triggers the systemverilog register block generation using peakRDL regblock tool (_CMD) + add_custom_target( + ${IP_LIB}_regblock_wrap + DEPENDS ${SV_GEN} ${STAMP_FILE} + ) + + add_dependencies(${IP_LIB} ${IP_LIB}_regblock_wrap) + +endfunction() + diff --git a/cmake/tmrg/tmrg/tmrg.cmake b/cmake/tmrg/tmrg/tmrg.cmake index 9d4ad08..cf8b929 100644 --- a/cmake/tmrg/tmrg/tmrg.cmake +++ b/cmake/tmrg/tmrg/tmrg.cmake @@ -3,7 +3,7 @@ include_guard(GLOBAL) function(tmrg IP_LIB) - cmake_parse_arguments(ARG "REPLACE;SED_WOR;NO_COMMON_DEFINITIONS" "OUTDIR" "" ${ARGN}) + cmake_parse_arguments(ARG "REPLACE;SED_WOR;NO_COMMON_DEFINITIONS" "OUTDIR;CONFIG_FILE" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} passed unrecognized argument " "${ARG_UNPARSED_ARGUMENTS}") @@ -21,6 +21,12 @@ function(tmrg IP_LIB) endif() execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTDIR}) + if(ARG_CONFIG_FILE) + set(ARG_CONFIG_FILE -c ${ARG_CONFIG_FILE}) + else() + unset(ARG_CONFIG_FILE) + endif() + get_ip_sources(V_SOURCES ${IP_LIB} VERILOG) # TODO make merge source files group function get_ip_sources(SOURCES ${IP_LIB} SYSTEMVERILOG) list(PREPEND SOURCES ${V_SOURCES}) @@ -35,7 +41,7 @@ function(tmrg IP_LIB) set_source_files_properties(${V_GEN} PROPERTIES GENERATED TRUE) set(TMRG_COMMAND - tmrg --stats --tmr-dir=${OUTDIR} ${SOURCES}; + tmrg --stats --tmr-dir=${OUTDIR} ${ARG_CONFIG_FILE} ${SOURCES}; ) if(ARG_SED_WOR) From 08713a54433bf214701ef3df7b07866eb8aae3ae Mon Sep 17 00:00:00 2001 From: Marco Andorno Date: Tue, 16 Apr 2024 09:35:54 +0000 Subject: [PATCH 02/15] Removed _wrap from source name --- cmake/peakrdl/peakrdl_regblock_wrap.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/peakrdl/peakrdl_regblock_wrap.cmake b/cmake/peakrdl/peakrdl_regblock_wrap.cmake index 72c5c7b..2fa40e9 100644 --- a/cmake/peakrdl/peakrdl_regblock_wrap.cmake +++ b/cmake/peakrdl/peakrdl_regblock_wrap.cmake @@ -51,7 +51,7 @@ function(peakrdl_regblock_wrap IP_LIB) set(SV_GEN ${OUTDIR}/${IP_NAME}_regblock_pkg.sv ${OUTDIR}/${IP_NAME}_regblock.sv - ${OUTDIR}/${IP_NAME}_wrap.sv + ${OUTDIR}/${IP_NAME}.sv ) # Prepend the generated files to the IP sources ip_sources(${IP_LIB} SYSTEMVERILOG PREPEND ${SV_GEN}) From f1294b52771ce4e8de53b30be2ffdbdd3b9db1f3 Mon Sep 17 00:00:00 2001 From: Marco Andorno Date: Tue, 16 Apr 2024 12:08:10 +0000 Subject: [PATCH 03/15] Embedded sv2v in wrap function --- cmake/peakrdl/peakrdl_regblock_wrap.cmake | 32 ++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/cmake/peakrdl/peakrdl_regblock_wrap.cmake b/cmake/peakrdl/peakrdl_regblock_wrap.cmake index 2fa40e9..8ffe79a 100644 --- a/cmake/peakrdl/peakrdl_regblock_wrap.cmake +++ b/cmake/peakrdl/peakrdl_regblock_wrap.cmake @@ -1,6 +1,6 @@ function(peakrdl_regblock_wrap IP_LIB) # Parse keyword arguments - cmake_parse_arguments(ARG "" "OUTDIR;RENAME;INTF" "" ${ARGN}) + cmake_parse_arguments(ARG "SV2V" "OUTDIR;RENAME;INTF" "" ${ARGN}) # Check for any unknown argument if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} passed unrecognized argument " @@ -40,6 +40,7 @@ function(peakrdl_regblock_wrap IP_LIB) unable to run ${CMAKE_CURRENT_FUNCTION}") endif() + # Generate the regblock and wrapper find_python3() set(__CMD ${Python3_EXECUTABLE} -m peakrdl regblock_wrap # --rename ${IP_NAME} @@ -66,13 +67,38 @@ function(peakrdl_regblock_wrap IP_LIB) DEPENDS ${RDL_SOURCES} COMMENT "Running ${CMAKE_CURRENT_FUNCTION} on ${IP_LIB}" ) + # This target triggers the systemverilog register block generation using peakRDL regblock tool (_CMD) + set(WRAP_TNAME ${IP_LIB}_regblock_wrap) add_custom_target( - ${IP_LIB}_regblock_wrap + ${WRAP_TNAME} DEPENDS ${SV_GEN} ${STAMP_FILE} ) - add_dependencies(${IP_LIB} ${IP_LIB}_regblock_wrap) + # Add command to convert to simple Verilog + if(ARG_SV2V) + set(V_GEN ${OUTDIR}/${IP_NAME}.v) + set_source_files_properties(${V_GEN} PROPERTIES GENERATED TRUE) + + add_custom_command( + OUTPUT ${STAMP_FILE} ${V_GEN} + COMMAND sv2v ${SV_GEN} -w ${V_GEN} + + COMMAND touch ${STAMP_FILE} + DEPENDS ${SV_GEN} + COMMENT "Running sv2v for regblock_wrap on ${IP_LIB}" + ) + + set(SV2V_TNAME ${IP_LIB}_regblock_wrap_sv2v) + add_custom_target( + ${SV2V_TNAME} + DEPENDS ${V_GEN} ${STAMP_FILE} + ) + add_dependencies(${SV2V_TNAME} ${WRAP_TNAME}) + add_dependencies(${IP_LIB} ${SV2V_TNAME}) + else() + add_dependencies(${IP_LIB} ${WRAP_TNAME}) + endif() endfunction() From b929a25d61078887225f46dac8fcd1beb94eb0a5 Mon Sep 17 00:00:00 2001 From: Marco Andorno Date: Wed, 17 Apr 2024 07:55:53 +0000 Subject: [PATCH 04/15] Added ip_sources to regblock_wrap function --- cmake/peakrdl/peakrdl_regblock_wrap.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/peakrdl/peakrdl_regblock_wrap.cmake b/cmake/peakrdl/peakrdl_regblock_wrap.cmake index 8ffe79a..623e8b0 100644 --- a/cmake/peakrdl/peakrdl_regblock_wrap.cmake +++ b/cmake/peakrdl/peakrdl_regblock_wrap.cmake @@ -54,8 +54,6 @@ function(peakrdl_regblock_wrap IP_LIB) ${OUTDIR}/${IP_NAME}_regblock.sv ${OUTDIR}/${IP_NAME}.sv ) - # Prepend the generated files to the IP sources - ip_sources(${IP_LIB} SYSTEMVERILOG PREPEND ${SV_GEN}) set(STAMP_FILE "${BINARY_DIR}/${IP_LIB}_${CMAKE_CURRENT_FUNCTION}.stamp") add_custom_command( @@ -95,9 +93,11 @@ function(peakrdl_regblock_wrap IP_LIB) DEPENDS ${V_GEN} ${STAMP_FILE} ) - add_dependencies(${SV2V_TNAME} ${WRAP_TNAME}) + ip_sources(${IP_LIB} VERILOG PREPEND ${V_GEN}) + # add_dependencies(${SV2V_TNAME} ${WRAP_TNAME}) add_dependencies(${IP_LIB} ${SV2V_TNAME}) else() + ip_sources(${IP_LIB} SYSTEMVERILOG PREPEND ${SV_GEN}) add_dependencies(${IP_LIB} ${WRAP_TNAME}) endif() endfunction() From da1cb15a726c11a6ebab140147e02fac6d66c696 Mon Sep 17 00:00:00 2001 From: Marco Andorno Date: Wed, 17 Apr 2024 09:42:25 +0000 Subject: [PATCH 05/15] Removed implicit dependency --- cmake/peakrdl/peakrdl_regblock_wrap.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/peakrdl/peakrdl_regblock_wrap.cmake b/cmake/peakrdl/peakrdl_regblock_wrap.cmake index 623e8b0..c048249 100644 --- a/cmake/peakrdl/peakrdl_regblock_wrap.cmake +++ b/cmake/peakrdl/peakrdl_regblock_wrap.cmake @@ -94,7 +94,6 @@ function(peakrdl_regblock_wrap IP_LIB) ) ip_sources(${IP_LIB} VERILOG PREPEND ${V_GEN}) - # add_dependencies(${SV2V_TNAME} ${WRAP_TNAME}) add_dependencies(${IP_LIB} ${SV2V_TNAME}) else() ip_sources(${IP_LIB} SYSTEMVERILOG PREPEND ${SV_GEN}) From c87acc0213e137487fc74609f42337c9b93bc26f Mon Sep 17 00:00:00 2001 From: Marco Andorno Date: Wed, 17 Apr 2024 15:47:01 +0000 Subject: [PATCH 06/15] Added dependency for TMRG target --- cmake/tmrg/tmrg/tmrg.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/tmrg/tmrg/tmrg.cmake b/cmake/tmrg/tmrg/tmrg.cmake index cf8b929..3958439 100644 --- a/cmake/tmrg/tmrg/tmrg.cmake +++ b/cmake/tmrg/tmrg/tmrg.cmake @@ -72,6 +72,13 @@ function(tmrg IP_LIB) set_property(TARGET ${IP_LIB} PROPERTY VERILOG_SOURCES ${V_GEN}) set_property(TARGET ${IP_LIB} PROPERTY SYSTEMVERILOG_SOURCES "") add_dependencies(${IP_LIB} ${IP_LIB}_${CMAKE_CURRENT_FUNCTION}) + + # Add explicit dependency if a regblock_wrap_sv2v target exists + get_property(TARGET_NAMES DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS) + set(SEARCH_TARGET ${IP_LIB}_regblock_wrap_sv2v) + if (${SEARCH_TARGET} IN_LIST TARGET_NAMES) + add_dependencies(${IP_LIB}_${CMAKE_CURRENT_FUNCTION} ${SEARCH_TARGET}) + endif() endif() endfunction() From f19886ec6c49f3dac24b1aa1d8f345c7a6ea4f0d Mon Sep 17 00:00:00 2001 From: Marco Andorno Date: Thu, 18 Apr 2024 07:22:42 +0000 Subject: [PATCH 07/15] Revert "Added dependency for TMRG target" This reverts commit c87acc0213e137487fc74609f42337c9b93bc26f. --- cmake/tmrg/tmrg/tmrg.cmake | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cmake/tmrg/tmrg/tmrg.cmake b/cmake/tmrg/tmrg/tmrg.cmake index 3958439..cf8b929 100644 --- a/cmake/tmrg/tmrg/tmrg.cmake +++ b/cmake/tmrg/tmrg/tmrg.cmake @@ -72,13 +72,6 @@ function(tmrg IP_LIB) set_property(TARGET ${IP_LIB} PROPERTY VERILOG_SOURCES ${V_GEN}) set_property(TARGET ${IP_LIB} PROPERTY SYSTEMVERILOG_SOURCES "") add_dependencies(${IP_LIB} ${IP_LIB}_${CMAKE_CURRENT_FUNCTION}) - - # Add explicit dependency if a regblock_wrap_sv2v target exists - get_property(TARGET_NAMES DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS) - set(SEARCH_TARGET ${IP_LIB}_regblock_wrap_sv2v) - if (${SEARCH_TARGET} IN_LIST TARGET_NAMES) - add_dependencies(${IP_LIB}_${CMAKE_CURRENT_FUNCTION} ${SEARCH_TARGET}) - endif() endif() endfunction() From 81e507c4ae90c0330e8d4c9227ce818a3ca9db3e Mon Sep 17 00:00:00 2001 From: Marco Andorno Date: Thu, 18 Apr 2024 07:43:45 +0000 Subject: [PATCH 08/15] Added dependency to sv2v target --- cmake/peakrdl/peakrdl_regblock_wrap.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/peakrdl/peakrdl_regblock_wrap.cmake b/cmake/peakrdl/peakrdl_regblock_wrap.cmake index c048249..8ac1d10 100644 --- a/cmake/peakrdl/peakrdl_regblock_wrap.cmake +++ b/cmake/peakrdl/peakrdl_regblock_wrap.cmake @@ -90,7 +90,7 @@ function(peakrdl_regblock_wrap IP_LIB) set(SV2V_TNAME ${IP_LIB}_regblock_wrap_sv2v) add_custom_target( ${SV2V_TNAME} - DEPENDS ${V_GEN} ${STAMP_FILE} + DEPENDS ${V_GEN} ${STAMP_FILE} ${WRAP_TNAME} ) ip_sources(${IP_LIB} VERILOG PREPEND ${V_GEN}) From 3434d2c20c3d0d2e4dce9f2edf7e100a213d3d20 Mon Sep 17 00:00:00 2001 From: Marco Andorno Date: Thu, 18 Apr 2024 09:20:05 +0000 Subject: [PATCH 09/15] Updated tmrg command --- cmake/tmrg/tmrg/tmrg.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/tmrg/tmrg/tmrg.cmake b/cmake/tmrg/tmrg/tmrg.cmake index cf8b929..bcc8029 100644 --- a/cmake/tmrg/tmrg/tmrg.cmake +++ b/cmake/tmrg/tmrg/tmrg.cmake @@ -41,7 +41,7 @@ function(tmrg IP_LIB) set_source_files_properties(${V_GEN} PROPERTIES GENERATED TRUE) set(TMRG_COMMAND - tmrg --stats --tmr-dir=${OUTDIR} ${ARG_CONFIG_FILE} ${SOURCES}; + ${Python3_VIRTUAL_ENV}/bin/tmrg --stats --tmr-dir=${OUTDIR} ${ARG_CONFIG_FILE} ${SOURCES}; ) if(ARG_SED_WOR) From ed22da60668d9a103df31a64314e5387ee28e5b7 Mon Sep 17 00:00:00 2001 From: Marco Andorno Date: Fri, 19 Apr 2024 11:49:24 +0000 Subject: [PATCH 10/15] Added TMRG separate source list --- cmake/tmrg/tmrg/tmrg.cmake | 73 ++++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 18 deletions(-) diff --git a/cmake/tmrg/tmrg/tmrg.cmake b/cmake/tmrg/tmrg/tmrg.cmake index bcc8029..f9e696b 100644 --- a/cmake/tmrg/tmrg/tmrg.cmake +++ b/cmake/tmrg/tmrg/tmrg.cmake @@ -2,6 +2,28 @@ # TODO create a new library instead??? include_guard(GLOBAL) +function(set_tmrg_sources IP_LIB) + cmake_parse_arguments(ARG "" "" "" ${ARGN}) + + # If only IP name is given without full VLNV, assume rest from the project variables + ip_assume_last(_reallib ${IP_LIB}) + + # Get any prior TMRG sources + get_tmrg_sources(_tmrg_src ${IP_LIB}) + + set(_tmrg_src ${_tmrg_src} ${ARGN}) + # Set the target property with the new list of source files + set_property(TARGET ${_reallib} PROPERTY TMRG ${_tmrg_src}) +endfunction() + +function(get_tmrg_sources OUT_VAR IP_LIB) + # If only IP name is given without full VLNV, assume rest from the project variables + ip_assume_last(IP_LIB ${IP_LIB}) + get_ip_property(TMRG_SRC ${IP_LIB} TMRG) + list(REMOVE_DUPLICATES TMRG_SRC) + set(${OUT_VAR} ${TMRG_SRC} PARENT_SCOPE) +endfunction() + function(tmrg IP_LIB) cmake_parse_arguments(ARG "REPLACE;SED_WOR;NO_COMMON_DEFINITIONS" "OUTDIR;CONFIG_FILE" "" ${ARGN}) @@ -9,8 +31,6 @@ function(tmrg IP_LIB) message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} passed unrecognized argument " "${ARG_UNPARSED_ARGUMENTS}") endif() - include("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../hwip.cmake") - ip_assume_last(IP_LIB ${IP_LIB}) get_target_property(BINARY_DIR ${IP_LIB} BINARY_DIR) @@ -27,27 +47,22 @@ function(tmrg IP_LIB) unset(ARG_CONFIG_FILE) endif() - get_ip_sources(V_SOURCES ${IP_LIB} VERILOG) # TODO make merge source files group function - get_ip_sources(SOURCES ${IP_LIB} SYSTEMVERILOG) - list(PREPEND SOURCES ${V_SOURCES}) - list(REMOVE_DUPLICATES SOURCES) - - foreach(vfile ${SOURCES}) + get_tmrg_sources(TMRG_SRC ${IP_LIB}) + foreach(vfile ${TMRG_SRC}) get_filename_component(V_SOURCE_WO_EXT ${vfile} NAME_WE) get_filename_component(V_SOURCE_EXT ${vfile} EXT) list(APPEND V_GEN "${OUTDIR}/${V_SOURCE_WO_EXT}TMR${V_SOURCE_EXT}") - # execute_process(COMMAND touch ${V_GEN}) # TODO Needed??? endforeach() set_source_files_properties(${V_GEN} PROPERTIES GENERATED TRUE) set(TMRG_COMMAND - ${Python3_VIRTUAL_ENV}/bin/tmrg --stats --tmr-dir=${OUTDIR} ${ARG_CONFIG_FILE} ${SOURCES}; - ) + ${Python3_VIRTUAL_ENV}/bin/tmrg --stats --tmr-dir=${OUTDIR} ${ARG_CONFIG_FILE} ${TMRG_SRC}; + ) if(ARG_SED_WOR) set(SED_COMMAND COMMAND sed -i "s/wor/wire/g" ${V_GEN} - ) + ) endif() set(STAMP_FILE "${BINARY_DIR}/${IP_LIB}_${CMAKE_CURRENT_FUNCTION}.stamp") @@ -56,21 +71,43 @@ function(tmrg IP_LIB) COMMAND ${TMRG_COMMAND} ${SED_COMMAND} COMMAND touch ${STAMP_FILE} - DEPENDS ${SOURCES} + DEPENDS ${TMRG_SRC} COMMENT "Running ${CMAKE_CURRENT_FUNCTION} on ${IP_LIB}" - ) + ) add_custom_target( ${IP_LIB}_${CMAKE_CURRENT_FUNCTION} - DEPENDS ${STAMP_FILE} ${SOURCES} ${V_GEN} - ) + DEPENDS ${STAMP_FILE} ${TMRG_SRC} ${V_GEN} + ) if(ARG_REPLACE) + # Replace top module name adding TMR get_target_property(TOP_MODULE ${IP_LIB} IP_NAME) set_property(TARGET ${IP_LIB} PROPERTY IP_NAME ${TOP_MODULE}TMR) - set_property(TARGET ${IP_LIB} PROPERTY VERILOG_SOURCES ${V_GEN}) - set_property(TARGET ${IP_LIB} PROPERTY SYSTEMVERILOG_SOURCES "") + # Get original sources + get_ip_sources(SV_SRC ${IP_LIB} SYSTEMVERILOG) + get_ip_sources(V_SRC ${IP_LIB} VERILOG) + + # Remove TMRG files from original sources + list(REMOVE_ITEM SV_SRC ${TMRG_SRC}) + list(REMOVE_ITEM V_SRC ${TMRG_SRC}) + + # Append generated files to correct source lists + foreach(i ${V_GEN}) + get_filename_component(FILE_EXT ${i} EXT) + if("${FILE_EXT}" STREQUAL ".sv") + list(APPEND SV_SRC ${i}) + elseif("${FILE_EXT}" STREQUAL ".v") + list(APPEND V_SRC ${i}) + endif() + endforeach() + + # Set the file list properties + set_property(TARGET ${IP_LIB} PROPERTY SYSTEMVERILOG_SOURCES ${SV_SRC}) + set_property(TARGET ${IP_LIB} PROPERTY VERILOG_SOURCES ${V_SRC}) + + # Add dependency to the IP add_dependencies(${IP_LIB} ${IP_LIB}_${CMAKE_CURRENT_FUNCTION}) endif() From abc747de3e9e014a2f611bb50848317da013d977 Mon Sep 17 00:00:00 2001 From: Marco Andorno Date: Fri, 19 Apr 2024 14:39:53 +0000 Subject: [PATCH 11/15] Modified sv2v and tmrg targets for TMR --- cmake/peakrdl/peakrdl_regblock_wrap.cmake | 70 ++++++++--------- cmake/synth/sv2v.cmake | 91 +++++++++++++++++------ cmake/tmrg/tmrg/tmrg.cmake | 2 - 3 files changed, 104 insertions(+), 59 deletions(-) diff --git a/cmake/peakrdl/peakrdl_regblock_wrap.cmake b/cmake/peakrdl/peakrdl_regblock_wrap.cmake index 8ac1d10..d0c6633 100644 --- a/cmake/peakrdl/peakrdl_regblock_wrap.cmake +++ b/cmake/peakrdl/peakrdl_regblock_wrap.cmake @@ -1,6 +1,6 @@ function(peakrdl_regblock_wrap IP_LIB) # Parse keyword arguments - cmake_parse_arguments(ARG "SV2V" "OUTDIR;RENAME;INTF" "" ${ARGN}) + cmake_parse_arguments(ARG "TMR" "OUTDIR;RENAME;INTF" "" ${ARGN}) # Check for any unknown argument if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} passed unrecognized argument " @@ -49,55 +49,55 @@ function(peakrdl_regblock_wrap IP_LIB) ${RDL_SOURCES} ) - set(SV_GEN - ${OUTDIR}/${IP_NAME}_regblock_pkg.sv - ${OUTDIR}/${IP_NAME}_regblock.sv - ${OUTDIR}/${IP_NAME}.sv - ) - + set(REGBLOCK_SV_GEN ${OUTDIR}/${IP_NAME}_regblock_pkg.sv ${OUTDIR}/${IP_NAME}_regblock.sv) + set(WRAP_SV_GEN ${OUTDIR}/${IP_NAME}.sv) set(STAMP_FILE "${BINARY_DIR}/${IP_LIB}_${CMAKE_CURRENT_FUNCTION}.stamp") + add_custom_command( # The output files are automtically marked as GENERATED (deleted by make clean among other things) - OUTPUT ${SV_GEN} ${STAMP_FILE} + OUTPUT ${REGBLOCK_SV_GEN} ${WRAP_SV_GEN} ${STAMP_FILE} COMMAND ${__CMD} - COMMAND touch ${STAMP_FILE} DEPENDS ${RDL_SOURCES} COMMENT "Running ${CMAKE_CURRENT_FUNCTION} on ${IP_LIB}" ) # This target triggers the systemverilog register block generation using peakRDL regblock tool (_CMD) - set(WRAP_TNAME ${IP_LIB}_regblock_wrap) + set(TNAME ${IP_LIB}_regblock_wrap) add_custom_target( - ${WRAP_TNAME} - DEPENDS ${SV_GEN} ${STAMP_FILE} + ${TNAME} + DEPENDS ${REGBLOCK_SV_GEN} ${WRAP_SV_GEN} ${STAMP_FILE} ) + ip_sources(${IP_LIB} SYSTEMVERILOG PREPEND ${REGBLOCK_SV_GEN} ${WRAP_SV_GEN}) # Add command to convert to simple Verilog - if(ARG_SV2V) - set(V_GEN ${OUTDIR}/${IP_NAME}.v) - set_source_files_properties(${V_GEN} PROPERTIES GENERATED TRUE) - - add_custom_command( - OUTPUT ${STAMP_FILE} ${V_GEN} - COMMAND sv2v ${SV_GEN} -w ${V_GEN} - - COMMAND touch ${STAMP_FILE} - DEPENDS ${SV_GEN} - COMMENT "Running sv2v for regblock_wrap on ${IP_LIB}" - ) - - set(SV2V_TNAME ${IP_LIB}_regblock_wrap_sv2v) - add_custom_target( - ${SV2V_TNAME} - DEPENDS ${V_GEN} ${STAMP_FILE} ${WRAP_TNAME} - ) - - ip_sources(${IP_LIB} VERILOG PREPEND ${V_GEN}) - add_dependencies(${IP_LIB} ${SV2V_TNAME}) + if(ARG_TMR) + # set(SV2V_DIR ${BINARY_DIR}/sv2v) + # set(REGBLOCK_V_GEN ${SV2V_DIR}/${IP_NAME}_regblock.v) + # set_source_files_properties(${REGBLOCK_V_GEN} PROPERTIES GENERATED TRUE) + # + # add_custom_command( + # OUTPUT ${STAMP_FILE} ${REGBLOCK_V_GEN} + # COMMAND ${CMAKE_COMMAND} -E make_directory ${SV2V_DIR} + # COMMAND sv2v ${REGBLOCK_SV_GEN} -w ${REGBLOCK_V_GEN} + # COMMAND touch ${STAMP_FILE} + # DEPENDS ${REGBLOCK_SV_GEN} + # COMMENT "Running sv2v for regblock_wrap on ${IP_LIB}" + # ) + # + # set(SV2V_TNAME ${IP_LIB}_regblock_wrap_sv2v) + # add_custom_target( + # ${SV2V_TNAME} + # DEPENDS ${REGBLOCK_V_GEN} ${STAMP_FILE} ${WRAP_TNAME} + # ) + # + # ip_sources(${IP_LIB} VERILOG PREPEND ${REGBLOCK_V_GEN}) + # set_tmrg_sources(${IP_LIB} ${REGBLOCK_V_GEN}) + # add_dependencies(${IP_LIB} ${SV2V_TNAME}) + set_tmrg_sources(${IP_LIB} ${REGBLOCK_SV_GEN}) + set_sv2v_sources(${IP_LIB} ${REGBLOCK_SV_GEN}) else() - ip_sources(${IP_LIB} SYSTEMVERILOG PREPEND ${SV_GEN}) - add_dependencies(${IP_LIB} ${WRAP_TNAME}) + add_dependencies(${IP_LIB} ${TNAME}) endif() endfunction() diff --git a/cmake/synth/sv2v.cmake b/cmake/synth/sv2v.cmake index bad131a..311c86c 100644 --- a/cmake/synth/sv2v.cmake +++ b/cmake/synth/sv2v.cmake @@ -1,14 +1,34 @@ # TODO iterate over linked libraries and replace SYSTEMVERILOG_SOURCES with VERILOG_SOURCES instead include_guard(GLOBAL) +function(set_sv2v_sources IP_LIB) + cmake_parse_arguments(ARG "" "" "" ${ARGN}) + + # If only IP name is given without full VLNV, assume rest from the project variables + ip_assume_last(_reallib ${IP_LIB}) + + # Get any prior TMRG sources + get_sv2v_sources(_sv2v_src ${IP_LIB}) + + set(_sv2v_src ${_sv2v_src} ${ARGN}) + # Set the target property with the new list of source files + set_property(TARGET ${_reallib} PROPERTY SV2V ${_sv2v_src}) +endfunction() + +function(get_sv2v_sources OUT_VAR IP_LIB) + # If only IP name is given without full VLNV, assume rest from the project variables + ip_assume_last(IP_LIB ${IP_LIB}) + get_ip_property(SV2V_SRC ${IP_LIB} SV2V) + list(REMOVE_DUPLICATES SV2V_SRC) + set(${OUT_VAR} ${SV2V_SRC} PARENT_SCOPE) +endfunction() + function(sv2v IP_LIB) - cmake_parse_arguments(ARG "REPLACE" "OUTDIR" "" ${ARGN}) + cmake_parse_arguments(ARG "REPLACE;TMR" "OUTDIR" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} passed unrecognized argument " "${ARG_UNPARSED_ARGUMENTS}") endif() - include("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../hwip.cmake") - ip_assume_last(IP_LIB ${IP_LIB}) get_target_property(BINARY_DIR ${IP_LIB} BINARY_DIR) @@ -19,14 +39,18 @@ function(sv2v IP_LIB) endif() execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTDIR}) - get_ip_sources(V_SOURCES ${IP_LIB} VERILOG) # TODO make merge source files group function - get_ip_sources(SOURCES ${IP_LIB} SYSTEMVERILOG) - list(PREPEND SOURCES ${V_SOURCES}) + get_sv2v_sources(SV2V_SRC ${IP_LIB}) + foreach(vfile ${SV2V_SRC}) + get_filename_component(V_SOURCE_WO_EXT ${vfile} NAME_WE) + if(NOT ${V_SOURCE_WO_EXT} MATCHES ".*regblock_pkg$") + list(APPEND V_GEN "${OUTDIR}/${V_SOURCE_WO_EXT}.v") + endif() + endforeach() + set_source_files_properties(${V_GEN} PROPERTIES GENERATED TRUE) get_ip_include_directories(SYSTEMVERILOG_INCLUDE_DIRS ${IP_LIB} SYSTEMVERILOG) get_ip_include_directories(VERILOG_INCLUDE_DIRS ${IP_LIB} VERILOG) set(INCDIRS ${SYSTEMVERILOG_INCLUDE_DIRS} ${VERILOG_INCLUDE_DIRS}) - foreach(dir ${INCDIRS}) list(APPEND INCDIR_ARG -I${dir}) endforeach() @@ -38,31 +62,54 @@ function(sv2v IP_LIB) list(APPEND CMP_DEFS_ARG -D${def}) endforeach() - set(V_GEN ${OUTDIR}/${IP_LIB}.v) - - set_source_files_properties(${V_GEN} PROPERTIES GENERATED TRUE) - set(STAMP_FILE "${BINARY_DIR}/${IP_LIB}_${CMAKE_CURRENT_FUNCTION}.stamp") add_custom_command( OUTPUT ${STAMP_FILE} ${V_GEN} - COMMAND sv2v - ${SOURCES} ${INCDIR_ARG} ${CMP_DEFS_ARG} - -w ${V_GEN} - + COMMAND sv2v ${SV2V_SRC} ${INCDIR_ARG} ${CMP_DEFS_ARG} -w ${OUTDIR} COMMAND touch ${STAMP_FILE} - DEPENDS ${SOURCES} + DEPENDS ${SV2V_SRC} COMMENT "Running ${CMAKE_CURRENT_FUNCTION} on ${IP_LIB}" - ) + ) add_custom_target( ${IP_LIB}_${CMAKE_CURRENT_FUNCTION} - DEPENDS ${STAMP_FILE} ${SOURCES} ${V_GEN} - ) + DEPENDS ${STAMP_FILE} ${SV2V_SRC} ${V_GEN} + ) if(ARG_REPLACE) - set_property(TARGET ${IP_LIB} PROPERTY VERILOG_SOURCES ${V_GEN}) - set_property(TARGET ${IP_LIB} PROPERTY SYSTEMVERILOG_SOURCES "") - add_dependencies(${IP_LIB} ${IP_LIB}_${CMAKE_CURRENT_FUNCTION}) + # Get original sources + get_ip_sources(SV_SRC ${IP_LIB} SYSTEMVERILOG) + get_ip_sources(V_SRC ${IP_LIB} VERILOG) + + # Remove SV2V files from original sources + list(REMOVE_ITEM SV_SRC ${SV2V_SRC}) + list(REMOVE_ITEM V_SRC ${SV2V_SRC}) + + # Append generated files to Verilog source lists + list(APPEND V_SRC ${V_GEN}) + + # Set the file list properties + set_property(TARGET ${IP_LIB} PROPERTY SYSTEMVERILOG_SOURCES ${SV_SRC}) + set_property(TARGET ${IP_LIB} PROPERTY VERILOG_SOURCES ${V_SRC}) + + # If TMR is set, remove original .sv files from TMRG list and replace with .v outputs + if(ARG_TMR) + get_tmrg_sources(TMRG_SRC ${IP_LIB}) + foreach(i ${SV2V_SRC}) + if(i IN_LIST TMRG_SRC) + list(REMOVE_ITEM TMRG_SRC ${i}) + get_filename_component(V_SOURCE_WO_EXT ${i} NAME_WE) + set(_i_v "${OUTDIR}/${V_SOURCE_WO_EXT}.v") + if(_i_v IN_LIST V_GEN) + list(APPEND TMRG_SRC ${_i_v}) + endif() + endif() + endforeach() + set_property(TARGET ${IP_LIB} PROPERTY TMRG ${TMRG_SRC}) + else() + # Add dependency to the IP + add_dependencies(${IP_LIB} ${IP_LIB}_${CMAKE_CURRENT_FUNCTION}) + endif() endif() endfunction() diff --git a/cmake/tmrg/tmrg/tmrg.cmake b/cmake/tmrg/tmrg/tmrg.cmake index f9e696b..c0bfa51 100644 --- a/cmake/tmrg/tmrg/tmrg.cmake +++ b/cmake/tmrg/tmrg/tmrg.cmake @@ -1,5 +1,3 @@ -# TODO iterate over linked libraries and replace SYSTEMVERILOG_SOURCES with VERILOG_SOURCES instead -# TODO create a new library instead??? include_guard(GLOBAL) function(set_tmrg_sources IP_LIB) From 117eae266662a63872a88bc58ce3176b2ba52d68 Mon Sep 17 00:00:00 2001 From: Marco Andorno Date: Fri, 19 Apr 2024 15:15:38 +0000 Subject: [PATCH 12/15] Added --tmr option to regblock_wrap --- cmake/peakrdl/peakrdl_regblock_wrap.cmake | 27 ++++------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/cmake/peakrdl/peakrdl_regblock_wrap.cmake b/cmake/peakrdl/peakrdl_regblock_wrap.cmake index d0c6633..d29bb80 100644 --- a/cmake/peakrdl/peakrdl_regblock_wrap.cmake +++ b/cmake/peakrdl/peakrdl_regblock_wrap.cmake @@ -42,7 +42,11 @@ function(peakrdl_regblock_wrap IP_LIB) # Generate the regblock and wrapper find_python3() + if(ARG_TMR) + set(TMR_OPT "--tmr") + endif() set(__CMD ${Python3_EXECUTABLE} -m peakrdl regblock_wrap + ${TMR_OPT} # --rename ${IP_NAME} # ${INTF_ARG} -o ${OUTDIR} @@ -70,30 +74,7 @@ function(peakrdl_regblock_wrap IP_LIB) ) ip_sources(${IP_LIB} SYSTEMVERILOG PREPEND ${REGBLOCK_SV_GEN} ${WRAP_SV_GEN}) - # Add command to convert to simple Verilog if(ARG_TMR) - # set(SV2V_DIR ${BINARY_DIR}/sv2v) - # set(REGBLOCK_V_GEN ${SV2V_DIR}/${IP_NAME}_regblock.v) - # set_source_files_properties(${REGBLOCK_V_GEN} PROPERTIES GENERATED TRUE) - # - # add_custom_command( - # OUTPUT ${STAMP_FILE} ${REGBLOCK_V_GEN} - # COMMAND ${CMAKE_COMMAND} -E make_directory ${SV2V_DIR} - # COMMAND sv2v ${REGBLOCK_SV_GEN} -w ${REGBLOCK_V_GEN} - # COMMAND touch ${STAMP_FILE} - # DEPENDS ${REGBLOCK_SV_GEN} - # COMMENT "Running sv2v for regblock_wrap on ${IP_LIB}" - # ) - # - # set(SV2V_TNAME ${IP_LIB}_regblock_wrap_sv2v) - # add_custom_target( - # ${SV2V_TNAME} - # DEPENDS ${REGBLOCK_V_GEN} ${STAMP_FILE} ${WRAP_TNAME} - # ) - # - # ip_sources(${IP_LIB} VERILOG PREPEND ${REGBLOCK_V_GEN}) - # set_tmrg_sources(${IP_LIB} ${REGBLOCK_V_GEN}) - # add_dependencies(${IP_LIB} ${SV2V_TNAME}) set_tmrg_sources(${IP_LIB} ${REGBLOCK_SV_GEN}) set_sv2v_sources(${IP_LIB} ${REGBLOCK_SV_GEN}) else() From fc0ebf32e1f6007e4ded91f932e7eb8ab40062d2 Mon Sep 17 00:00:00 2001 From: Marco Andorno Date: Tue, 7 May 2024 09:10:52 +0000 Subject: [PATCH 13/15] Added awk command for hwif --- cmake/synth/hwif_awk.sh | 3 +++ cmake/synth/sv2v.cmake | 11 ++++++++++- cmake/tmrg/tmrg/tmrg.cmake | 10 ++++++---- 3 files changed, 19 insertions(+), 5 deletions(-) create mode 100755 cmake/synth/hwif_awk.sh diff --git a/cmake/synth/hwif_awk.sh b/cmake/synth/hwif_awk.sh new file mode 100755 index 0000000..a973f96 --- /dev/null +++ b/cmake/synth/hwif_awk.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +awk -i inplace -F'[][]' 'NR==FNR && /wire.*hwif_in/{width_in=$2} NR==FNR && /wire.*hwif_out/{width_out=$2;next} {gsub ( /TO_CHANGE_HWIF_IN/, width_in ) gsub ( /TO_CHANGE_HWIF_OUT/, width_out ) ;print}' $1 $2 diff --git a/cmake/synth/sv2v.cmake b/cmake/synth/sv2v.cmake index 311c86c..1d0056e 100644 --- a/cmake/synth/sv2v.cmake +++ b/cmake/synth/sv2v.cmake @@ -24,7 +24,7 @@ function(get_sv2v_sources OUT_VAR IP_LIB) endfunction() function(sv2v IP_LIB) - cmake_parse_arguments(ARG "REPLACE;TMR" "OUTDIR" "" ${ARGN}) + cmake_parse_arguments(ARG "REPLACE;TMR;HWIF_WIRE" "OUTDIR" "" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} passed unrecognized argument " "${ARG_UNPARSED_ARGUMENTS}") endif() @@ -62,10 +62,19 @@ function(sv2v IP_LIB) list(APPEND CMP_DEFS_ARG -D${def}) endforeach() + # HACK ALERT!! + if(ARG_HWIF_WIRE) + get_target_property(TOP_MODULE ${IP_LIB} IP_NAME) + set(AWK_COMMAND + COMMAND ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/hwif_awk.sh ${OUTDIR}/${TOP_MODULE}_regblock.v ${OUTDIR}/../regblock/${TOP_MODULE}.sv + ) + endif() + set(STAMP_FILE "${BINARY_DIR}/${IP_LIB}_${CMAKE_CURRENT_FUNCTION}.stamp") add_custom_command( OUTPUT ${STAMP_FILE} ${V_GEN} COMMAND sv2v ${SV2V_SRC} ${INCDIR_ARG} ${CMP_DEFS_ARG} -w ${OUTDIR} + ${AWK_COMMAND} COMMAND touch ${STAMP_FILE} DEPENDS ${SV2V_SRC} COMMENT "Running ${CMAKE_CURRENT_FUNCTION} on ${IP_LIB}" diff --git a/cmake/tmrg/tmrg/tmrg.cmake b/cmake/tmrg/tmrg/tmrg.cmake index c0bfa51..eb0a96b 100644 --- a/cmake/tmrg/tmrg/tmrg.cmake +++ b/cmake/tmrg/tmrg/tmrg.cmake @@ -54,13 +54,15 @@ function(tmrg IP_LIB) set_source_files_properties(${V_GEN} PROPERTIES GENERATED TRUE) set(TMRG_COMMAND - ${Python3_VIRTUAL_ENV}/bin/tmrg --stats --tmr-dir=${OUTDIR} ${ARG_CONFIG_FILE} ${TMRG_SRC}; + ${Python3_VIRTUAL_ENV}/bin/tmrg --stats --tmr-dir=${OUTDIR} ${ARG_CONFIG_FILE} ${TMRG_SRC} ) + if(ARG_NO_COMMON_DEFINITIONS) + set(TMRG_COMMAND ${TMRG_COMMAND} --no-common-definitions) + endif() + if(ARG_SED_WOR) - set(SED_COMMAND - COMMAND sed -i "s/wor/wire/g" ${V_GEN} - ) + set(SED_COMMAND COMMAND sed -i "s/wor/wire/g" ${V_GEN}) endif() set(STAMP_FILE "${BINARY_DIR}/${IP_LIB}_${CMAKE_CURRENT_FUNCTION}.stamp") From a62b1408dfee202fe5663093e084ab840b6488bc Mon Sep 17 00:00:00 2001 From: Marco Andorno Date: Tue, 7 May 2024 09:30:08 +0000 Subject: [PATCH 14/15] Changed awk to sed command --- cmake/synth/hwif_awk.sh | 3 --- cmake/synth/hwif_sed.sh | 6 ++++++ cmake/synth/sv2v.cmake | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) delete mode 100755 cmake/synth/hwif_awk.sh create mode 100755 cmake/synth/hwif_sed.sh diff --git a/cmake/synth/hwif_awk.sh b/cmake/synth/hwif_awk.sh deleted file mode 100755 index a973f96..0000000 --- a/cmake/synth/hwif_awk.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/bash - -awk -i inplace -F'[][]' 'NR==FNR && /wire.*hwif_in/{width_in=$2} NR==FNR && /wire.*hwif_out/{width_out=$2;next} {gsub ( /TO_CHANGE_HWIF_IN/, width_in ) gsub ( /TO_CHANGE_HWIF_OUT/, width_out ) ;print}' $1 $2 diff --git a/cmake/synth/hwif_sed.sh b/cmake/synth/hwif_sed.sh new file mode 100755 index 0000000..6e2c173 --- /dev/null +++ b/cmake/synth/hwif_sed.sh @@ -0,0 +1,6 @@ +#! /bin/bash + +width_in=$(grep -E 'wire.*hwif_in' $1 | cut -d '[' -f2 | cut -d ']' -f1) +width_out=$(grep -E 'wire.*hwif_out' $1 | cut -d '[' -f2 | cut -d ']' -f1) +sed -i "s/TO_CHANGE_HWIF_IN/$width_in/" $2 +sed -i "s/TO_CHANGE_HWIF_OUT/$width_out/" $2 diff --git a/cmake/synth/sv2v.cmake b/cmake/synth/sv2v.cmake index 1d0056e..dbfaddd 100644 --- a/cmake/synth/sv2v.cmake +++ b/cmake/synth/sv2v.cmake @@ -65,8 +65,8 @@ function(sv2v IP_LIB) # HACK ALERT!! if(ARG_HWIF_WIRE) get_target_property(TOP_MODULE ${IP_LIB} IP_NAME) - set(AWK_COMMAND - COMMAND ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/hwif_awk.sh ${OUTDIR}/${TOP_MODULE}_regblock.v ${OUTDIR}/../regblock/${TOP_MODULE}.sv + set(SED_COMMAND + COMMAND ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/hwif_sed.sh ${OUTDIR}/${TOP_MODULE}_regblock.v ${OUTDIR}/../regblock/${TOP_MODULE}.sv ) endif() @@ -74,7 +74,7 @@ function(sv2v IP_LIB) add_custom_command( OUTPUT ${STAMP_FILE} ${V_GEN} COMMAND sv2v ${SV2V_SRC} ${INCDIR_ARG} ${CMP_DEFS_ARG} -w ${OUTDIR} - ${AWK_COMMAND} + ${SED_COMMAND} COMMAND touch ${STAMP_FILE} DEPENDS ${SV2V_SRC} COMMENT "Running ${CMAKE_CURRENT_FUNCTION} on ${IP_LIB}" From 8602b3d59289b3a75d013fa25960db94e400c738 Mon Sep 17 00:00:00 2001 From: Marco Andorno Date: Fri, 17 May 2024 09:32:29 +0000 Subject: [PATCH 15/15] Changed default outdir --- cmake/peakrdl/peakrdl_regblock_wrap.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/peakrdl/peakrdl_regblock_wrap.cmake b/cmake/peakrdl/peakrdl_regblock_wrap.cmake index d29bb80..58fbe9b 100644 --- a/cmake/peakrdl/peakrdl_regblock_wrap.cmake +++ b/cmake/peakrdl/peakrdl_regblock_wrap.cmake @@ -15,7 +15,11 @@ function(peakrdl_regblock_wrap IP_LIB) # Default output directory is regblock/ if(NOT ARG_OUTDIR) - set(OUTDIR ${BINARY_DIR}/regblock) + if(NOT ARG_TMR) + set(OUTDIR ${BINARY_DIR}/regblock) + else() + set(OUTDIR ${BINARY_DIR}/regblock_tmr) + endif() else() set(OUTDIR ${ARG_OUTDIR}) endif()