Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
fb6c99d
Merge pull request #141 from HEP-SoC/file_sets
Risto97 Jun 18, 2025
366ab23
Initial IPXact IP importer implementation
Risto97 Apr 15, 2025
e25ce1f
extract ip_links from IPXact reference types
Risto97 Apr 28, 2025
53af809
fix ipxact_importer stylesheets
Risto97 Apr 29, 2025
12f649e
Introduce NO_ALIAS argument to add_ip, if passed, it will not create …
Risto97 Apr 29, 2025
ad08e8f
Add SOCMAKE_ALLOW_UNDEFINED_TARGETS global variable, if set it allows…
Risto97 Apr 29, 2025
272ee25
Update SoCMakeConfig.cmake
Risto97 Apr 30, 2025
25d5a14
If xmlstarlet not available use xsltproc
Risto97 Apr 30, 2025
108c15b
fix xsltproc fallback
Risto97 Apr 30, 2025
0ae73ca
Use file sets for ipxact importer
Risto97 Jun 2, 2025
5e4770e
rebase for file sets
Risto97 Jun 2, 2025
9723ec6
Add HEADER parent directory to ip include directories
Risto97 Jun 2, 2025
17a9af3
IPXact file set test
Risto97 Jun 2, 2025
fd904b8
remove the ipxact cmake file from the test directory to avoid detecti…
Risto97 Jun 2, 2025
e6d1529
Install xslptroc in CI
Risto97 Jun 2, 2025
b54cd4a
Fix the failing test
Risto97 Jun 23, 2025
b22e2ae
Merge pull request #141 from HEP-SoC/file_sets
Risto97 Jun 18, 2025
b1259ac
Merge pull request #141 from HEP-SoC/file_sets
Risto97 Jun 18, 2025
3db6d9b
Initial support for installing IP blocks #121
Risto97 Mar 26, 2025
4ddfb34
Install output directory is vendor/library/name/version
Risto97 Jun 25, 2025
5b46f69
Fix the get_ip_ function Language and FILE_SETS combination
Risto97 Jun 26, 2025
98ab12c
Mark exported properties in install.cmake
Risto97 Jun 26, 2025
d0147fb
Rename FILE_SETS property to LANG_FILE_SETS or correctness
Risto97 Jun 26, 2025
dbdef63
Allow selecting languages and filesets to be installed with ip install
Risto97 Jun 26, 2025
610cb9b
Allow excluding languages and file sets in ip install
Risto97 Jun 26, 2025
6062f05
Enable experimental CMake feature to automatically generate find_depe…
Risto97 Jul 2, 2025
8855a01
Move cmake package files installation to CMAKE_INSTALL_PREFIX/lib/cmake
Risto97 Jul 2, 2025
b1ea09e
Add support for Verible obfuscator
Risto97 Jul 3, 2025
061009e
Add support for questa vencrypt for HDL code encryption
Risto97 Jul 3, 2025
33b082b
Merge branch 'develop' into ip_install
Risto97 Jul 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions SoCMakeConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/cmake/utils/option.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/cmake/utils/find_python.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/cmake/utils/print_list.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/cmake/utils/uniquify_files_by_basename.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/cmake/utils/install/install.cmake")

# ====================================
# ======== Additional utilities ======
Expand Down
60 changes: 32 additions & 28 deletions cmake/hwip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ function(ip_sources IP_LIB LANGUAGE)
set(headers_property ${LANGUAGE}_${ARG_FILE_SET}_HEADERS)
set(get_sources_fileset_arg FILE_SETS ${ARG_FILE_SET})

get_property(filesets TARGET ${_reallib} PROPERTY FILE_SETS)
get_property(filesets TARGET ${_reallib} PROPERTY LANG_FILE_SETS)
set(file_set "${LANGUAGE}::${ARG_FILE_SET}")
if(NOT file_set IN_LIST filesets)
set_property(TARGET ${_reallib} APPEND PROPERTY FILE_SETS ${file_set})
set_property(TARGET ${_reallib} APPEND PROPERTY LANG_FILE_SETS ${file_set})
endif()

list(REMOVE_ITEM ARGN "${ARG_FILE_SET}")
Expand Down Expand Up @@ -304,14 +304,12 @@ function(ip_sources IP_LIB LANGUAGE)
endif()
# Set the target property with the new list of source and header files
set_property(TARGET ${_reallib} PROPERTY ${sources_property} ${_sources})
# set_property(TARGET ${_reallib} APPEND PROPERTY EXPORT_PROPERTIES ${sources_property}) # TODO don't add if already there
if(ARG_HEADERS)
foreach(header ${_headers})
cmake_path(GET header PARENT_PATH header_incdir)
ip_include_directories(${IP_LIB} ${LANGUAGE} ${header_incdir})
endforeach()
set_property(TARGET ${_reallib} PROPERTY ${headers_property} ${_headers})
# set_property(TARGET ${_reallib} APPEND PROPERTY EXPORT_PROPERTIES ${headers_property}) # TODO don't add if already there
endif()
endfunction()

Expand Down Expand Up @@ -355,16 +353,18 @@ function(get_ip_sources OUTVAR IP_LIB LANGUAGE)

# In case FILE_SETS function argument is not specified, return all defined file sets
# Otherwise return only files in listed file sets
get_ip_property(ip_filesets ${_reallib} FILE_SETS ${_no_deps})
get_ip_property(ip_filesets ${_reallib} LANG_FILE_SETS ${_no_deps})
if(NOT ARG_FILE_SETS)
set(filesets ${ip_filesets})
else()
list(REMOVE_ITEM ARGN ${ARG_FILE_SETS})
list(REMOVE_ITEM ARGN "FILE_SETS")
unset(filesets)
foreach(fileset ${ARG_FILE_SETS})
list(APPEND filesets "${LANGUAGE}::${fileset}")
list(REMOVE_ITEM ARGN "${fileset}")
foreach(lang ${LANGUAGE} ${ARGN})
foreach(fileset_name ${ARG_FILE_SETS})
list(APPEND filesets ${lang}::${fileset_name})
endforeach()
endforeach()
list(REMOVE_ITEM ARGN "FILE_SETS")
endif()

unset(SOURCES)
Expand Down Expand Up @@ -415,11 +415,11 @@ function(ip_include_directories IP_LIB LANGUAGE)
endif()
set(incdir_property ${LANGUAGE}_${ARG_FILE_SET}_INCLUDE_DIRECTORIES)

# Add the file set to the FILE_SETS property
get_property(filesets TARGET ${_reallib} PROPERTY FILE_SETS)
# Add the file set to the LANG_FILE_SETS property
get_property(filesets TARGET ${_reallib} PROPERTY LANG_FILE_SETS)
set(file_set "${LANGUAGE}::${ARG_FILE_SET}")
if(NOT file_set IN_LIST filesets)
set_property(TARGET ${_reallib} APPEND PROPERTY FILE_SETS ${file_set})
set_property(TARGET ${_reallib} APPEND PROPERTY LANG_FILE_SETS ${file_set})
endif()
# Remove the FILE_SET argument and its value from ARGN to not interfere with directory list
list(REMOVE_ITEM ARGN "${ARG_FILE_SET}")
Expand Down Expand Up @@ -457,17 +457,19 @@ function(get_ip_include_directories OUTVAR IP_LIB LANGUAGE)
alias_dereference(_reallib ${IP_LIB})

# In case FILE_SETS function argument is not specified, return all defined file sets
# Otherwise return only directories in listed file sets
get_ip_property(ip_filesets ${_reallib} FILE_SETS ${_no_deps})
# Otherwise return only files in listed file sets
get_ip_property(ip_filesets ${_reallib} LANG_FILE_SETS ${_no_deps})
if(NOT ARG_FILE_SETS)
set(filesets ${ip_filesets})
else()
list(REMOVE_ITEM ARGN ${ARG_FILE_SETS})
list(REMOVE_ITEM ARGN "FILE_SETS")
unset(filesets)
foreach(fileset ${ARG_FILE_SETS})
list(APPEND filesets "${LANGUAGE}::${fileset}")
list(REMOVE_ITEM ARGN "${fileset}")
foreach(lang ${LANGUAGE} ${ARGN})
foreach(fileset_name ${ARG_FILE_SETS})
list(APPEND filesets ${lang}::${fileset_name})
endforeach()
endforeach()
list(REMOVE_ITEM ARGN "FILE_SETS")
endif()

# ARGN contains extra languages passed, it might also include NO_DEPS so remove it from the list
Expand Down Expand Up @@ -509,7 +511,7 @@ function(check_languages LANGUAGE)
# The user can add addition languages using the SOCMAKE_ADDITIONAL_LANGUAGES variable and global property
get_socmake_languages(SOCMAKE_SUPPORTED_LANGUAGES)

if(NOT ${LANGUAGE} IN_LIST SOCMAKE_SUPPORTED_LANGUAGES)
if(NOT "${LANGUAGE}" IN_LIST SOCMAKE_SUPPORTED_LANGUAGES)
if(SOCMAKE_UNSUPPORTED_LANGUAGE_FATAL)
set(_verbosity FATAL_ERROR)
else()
Expand Down Expand Up @@ -720,11 +722,11 @@ function(ip_compile_definitions IP_LIB LANGUAGE)
endif()
set(comp_def_property ${LANGUAGE}_${ARG_FILE_SET}_COMPILE_DEFINITIONS)

# Add the file set to the FILE_SETS property
get_property(filesets TARGET ${_reallib} PROPERTY FILE_SETS)
# Add the file set to the LANG_FILE_SETS property
get_property(filesets TARGET ${_reallib} PROPERTY LANG_FILE_SETS)
set(file_set "${LANGUAGE}::${ARG_FILE_SET}")
if(NOT file_set IN_LIST filesets)
set_property(TARGET ${_reallib} APPEND PROPERTY FILE_SETS ${file_set})
set_property(TARGET ${_reallib} APPEND PROPERTY LANG_FILE_SETS ${file_set})
endif()
# Remove the FILE_SET argument and its value from ARGN to not interfere with directory list
list(REMOVE_ITEM ARGN "${ARG_FILE_SET}")
Expand Down Expand Up @@ -768,17 +770,19 @@ function(get_ip_compile_definitions OUTVAR IP_LIB LANGUAGE)
alias_dereference(_reallib ${IP_LIB})

# In case FILE_SETS function argument is not specified, return all defined file sets
# Otherwise return only directories in listed file sets
get_ip_property(ip_filesets ${_reallib} FILE_SETS ${_no_deps})
# Otherwise return only files in listed file sets
get_ip_property(ip_filesets ${_reallib} LANG_FILE_SETS ${_no_deps})
if(NOT ARG_FILE_SETS)
set(filesets ${ip_filesets})
else()
list(REMOVE_ITEM ARGN ${ARG_FILE_SETS})
list(REMOVE_ITEM ARGN "FILE_SETS")
unset(filesets)
foreach(fileset ${ARG_FILE_SETS})
list(APPEND filesets "${LANGUAGE}::${fileset}")
list(REMOVE_ITEM ARGN "${fileset}")
foreach(lang ${LANGUAGE} ${ARGN})
foreach(fileset_name ${ARG_FILE_SETS})
list(APPEND filesets ${lang}::${fileset_name})
endforeach()
endforeach()
list(REMOVE_ITEM ARGN "FILE_SETS")
endif()

# ARGN contains extra languages passed, it might also include NO_DEPS so remove it from the list
Expand Down
70 changes: 70 additions & 0 deletions cmake/misc/verible_obfuscate.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
include_guard(GLOBAL)

function(verible_obfuscate IP_LIB)
cmake_parse_arguments(ARG "NO_DEPS" "OUTDIR" "FILE_SETS" ${ARGN})
if(ARG_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} passed unrecognized argument " "${ARG_UNPARSED_ARGUMENTS}")
endif()

alias_dereference(IP_LIB ${IP_LIB})
get_target_property(BINARY_DIR ${IP_LIB} BINARY_DIR)

if(NOT ARG_OUTDIR)
set(OUTDIR ${BINARY_DIR}/${IP_LIB}_${CMAKE_CURRENT_FUNCTION})
else()
set(OUTDIR ${ARG_OUTDIR})
endif()
file(MAKE_DIRECTORY ${OUTDIR})

if(ARG_FILE_SETS)
set(FILE_SETS_FUNC_ARG FILE_SETS ${ARG_FILE_SETS})
endif()

if(ARG_NO_DEPS)
set(ips ${IP_LIB})
else()
get_ip_links(ips ${IP_LIB})
endif()

unset(all_gen_files)
foreach(ip IN LISTS ips)
get_property(filesets TARGET ${ip} PROPERTY LANG_FILE_SETS)

set(languages VERILOG SYSTEMVERILOG)

foreach(fileset IN LISTS filesets)
string(REPLACE "::" ";" fileset_list "${fileset}")
list(GET fileset_list 0 fileset_language)
list(GET fileset_list 1 fileset_name)
if(fileset_language IN_LIST languages)
get_ip_sources(sources ${ip} ${fileset_language} FILE_SETS ${fileset_name} NO_DEPS)
unset(replace_sources)
foreach(source ${sources})
cmake_path(GET source FILENAME source_fn)
set(source_new "${OUTDIR}/${source_fn}")

list(APPEND replace_sources "${source_new}")

add_custom_command(
OUTPUT ${source_new}
COMMAND verible-verilog-obfuscate < ${source} > ${source_new}
DEPENDS ${source}
COMMENT "Obfuscate ${source_fn} of ${IP_LIB} with Verible"
)
list(APPEND all_gen_files ${source_new})
endforeach()
ip_sources(${ip} ${fileset_language} FILE_SET ${fileset_name} REPLACE "${replace_sources}")

endif()
endforeach()
endforeach()


set(DESCRIPTION "Obfuscating Verilog/SV files of ${IP_LIB} with Verible obfuscate")
add_custom_target(${IP_LIB}_verible_obfuscate
DEPENDS ${all_gen_files}
)
set_property(TARGET ${IP_LIB}_verible_obfuscate PROPERTY DESCRIPTION ${DESCRIPTION})

endfunction()

76 changes: 76 additions & 0 deletions cmake/sim/siemens/modelsim_encrypt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
include_guard(GLOBAL)

function(modelsim_encrypt IP_LIB)
cmake_parse_arguments(ARG "NO_DEPS;QUIET" "OUTDIR" "FILE_SETS" ${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")
include("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../sim_utils.cmake")

alias_dereference(IP_LIB ${IP_LIB})
get_target_property(BINARY_DIR ${IP_LIB} BINARY_DIR)

if(NOT ARG_OUTDIR)
set(OUTDIR ${BINARY_DIR}/${IP_LIB}_${CMAKE_CURRENT_FUNCTION})
else()
set(OUTDIR ${ARG_OUTDIR})
endif()
file(MAKE_DIRECTORY ${OUTDIR})

if(ARG_FILE_SETS)
set(FILE_SETS_FUNC_ARG FILE_SETS ${ARG_FILE_SETS})
endif()

if(ARG_NO_DEPS)
set(ips ${IP_LIB})
else()
get_ip_links(ips ${IP_LIB})
endif()

unset(all_gen_files)
foreach(ip IN LISTS ips)
get_property(filesets TARGET ${ip} PROPERTY LANG_FILE_SETS)

set(languages VERILOG SYSTEMVERILOG VHDL)

foreach(fileset IN LISTS filesets)
string(REPLACE "::" ";" fileset_list "${fileset}")
list(GET fileset_list 0 fileset_language)
list(GET fileset_list 1 fileset_name)
if(fileset_language IN_LIST languages)
get_ip_sources(sources ${ip} ${fileset_language} FILE_SETS ${fileset_name} NO_DEPS)
unset(replace_sources)
foreach(source ${sources})
cmake_path(GET source EXTENSION LAST_ONLY ext)
set(new_ext "${ext}p")
cmake_path(GET source FILENAME source_fn)
cmake_path(REPLACE_EXTENSION source_fn LAST_ONLY "${new_ext}" OUTPUT_VARIABLE source_new)
string(REPLACE "." "" new_ext "${new_ext}")
set(source_new "${OUTDIR}/${source_new}")

list(APPEND replace_sources "${source_new}")

add_custom_command(
OUTPUT ${source_new}
COMMAND vencrypt ${source} -e "${new_ext}" -d ${OUTDIR} $<$<BOOL:${ARG_QUIET}>:-quiet>
DEPENDS ${source}
COMMENT "Encrypt ${source_fn} of ${IP_LIB} with modelsim vencrypt"
)
list(APPEND all_gen_files ${source_new})
endforeach()
ip_sources(${ip} ${fileset_language} FILE_SET ${fileset_name} REPLACE "${replace_sources}")

endif()
endforeach()
endforeach()


set(DESCRIPTION "Encrypting HDL files of ${IP_LIB} with modelsim vencrypt")
add_custom_target(${IP_LIB}_modelsim_encrypt
DEPENDS ${all_gen_files}
)
set_property(TARGET ${IP_LIB}_modelsim_encrypt PROPERTY DESCRIPTION ${DESCRIPTION})

endfunction()
10 changes: 6 additions & 4 deletions cmake/utils/file_paths.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
function(convert_paths_to_absolute OUTPUT_LIST)
unset(output_list)
foreach(path ${ARGN})
cmake_path(ABSOLUTE_PATH path
BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} NORMALIZE
OUTPUT_VARIABLE path
)
if(NOT "${path}" MATCHES "\\$\{_IMPORT_PREFIX\}")
cmake_path(ABSOLUTE_PATH path
BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} NORMALIZE
OUTPUT_VARIABLE path
)
endif()
list(APPEND output_list ${path} )
endforeach()

Expand Down
5 changes: 3 additions & 2 deletions cmake/utils/get_all_targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ macro(__get_all_targets_recursive targets dir)
__get_all_targets_recursive(${targets} ${subdir})
endforeach()

get_property(current_targets DIRECTORY ${dir} PROPERTY BUILDSYSTEM_TARGETS)
list(APPEND ${targets} ${current_targets})
get_property(current_targets DIRECTORY "${dir}" PROPERTY BUILDSYSTEM_TARGETS)
get_property(imported_targets DIRECTORY "${dir}" PROPERTY IMPORTED_TARGETS)
list(APPEND ${targets} ${current_targets} ${imported_targets})
endmacro()
Loading