Download chips/yosys/cmake/PmgenCommand.cmake from STAR-future/Trinity-SciData: direct link, hf CLI and curl.
- Browser
- Download file 1.76 kB
-
https://huggingface.co/datasets/STAR-future/Trinity-SciData/resolve/main/chips/yosys/cmake/PmgenCommand.cmake
- Command line
-
hf download hf://datasets/STAR-future/Trinity-SciData/chips/yosys/cmake/PmgenCommand.cmake
-
curl -L -o PmgenCommand.cmake https://huggingface.co/datasets/STAR-future/Trinity-SciData/resolve/main/chips/yosys/cmake/PmgenCommand.cmake
1.76 kB
| # Syntax: | |
| # | |
| # pmgen_command(<output> | |
| # [<input>...] | |
| # [PREFIX <prefix>] | |
| # [DEBUG] | |
| # ) | |
| # | |
| # Builds `<output>_pm.h` in the current binary directory from pmgen source files `<input>`, which must have | |
| # the `*.pmg` extension. If `<input>...` contains more than one file, `<prefix>` must be provided. | |
| # | |
| # Defines the following variables: | |
| # - `PMGEN_<output>_DEFINED`: Boolean indicating whether this command was successfully invoked. | |
| # - `PMGEN_<output>_OUTPUT`: The header file generated by `pmgen`. | |
| # | |
| # Usage example: | |
| # | |
| # pmgen_command(my_dsp | |
| # my_dsp.pmg | |
| # ) | |
| # yosys_pass(my_dsp | |
| # my_dsp.cc | |
| # ${PMGEN_my_dsp_OUTPUT} | |
| # ) | |
| # | |
| # Usage example with multiple files: | |
| # | |
| # pmgen_command(my_dsp | |
| # my_dsp_macc.pmg | |
| # my_dsp_carry.pmg | |
| # PREFIX | |
| # my_dsp | |
| # ) | |
| # | |
| function(pmgen_command arg_NAME) | |
| cmake_parse_arguments(PARSE_ARGV 1 arg "DEBUG" "PREFIX" "") | |
| set(arg_INPUTS ${arg_UNPARSED_ARGUMENTS}) | |
| set(pmgen_script ${YOSYS_CMAKE_SOURCE_DIR}/passes/pmgen/pmgen.py) | |
| set(pmgen_output ${CMAKE_CURRENT_BINARY_DIR}/${arg_NAME}_pm.h) | |
| cmake_path(RELATIVE_PATH pmgen_output BASE_DIRECTORY ${YOSYS_CMAKE_BINARY_DIR} OUTPUT_VARIABLE pmgen_output_rel) | |
| add_custom_command( | |
| DEPENDS ${pmgen_script} ${arg_INPUTS} | |
| OUTPUT ${pmgen_output} | |
| COMMAND ${Python3_EXECUTABLE} | |
| ${pmgen_script} | |
| "$<$<BOOL:${arg_DEBUG}>:-g>" | |
| "$<$<BOOL:${arg_PREFIX}>:-p;${arg_PREFIX}>" | |
| -o ${pmgen_output} | |
| ${arg_INPUTS} | |
| COMMAND_EXPAND_LISTS | |
| WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | |
| VERBATIM | |
| COMMENT "Compiling pattern matcher ${pmgen_output_rel}" | |
| ) | |
| # The usage of this command is somewhat inspired by `flex_target()` and `bison_target()`. | |
| set(PMGEN_${arg_NAME}_DEFINED TRUE) | |
| set(PMGEN_${arg_NAME}_OUTPUT ${pmgen_output} PARENT_SCOPE) | |
| endfunction() | |