Skip to content

Commit

Permalink
vivado: link fasm target to all diff_fasm_target
Browse files Browse the repository at this point in the history
Signed-off-by: Alessandro Comodi <[email protected]>
  • Loading branch information
acomodi committed Oct 21, 2020
1 parent 9141ed8 commit ef79f50
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 35 deletions.
3 changes: 2 additions & 1 deletion xc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
set(ALL_XC7_DIFF_FASM_VERILOG TRUE CACHE BOOL "Link target diff_fasm to all_xc7_diff_fasm for Verilog/XDC inputs?")
set(ALL_XC7_DIFF_FASM_VERILOG TRUE CACHE BOOL "Link target fasm to all_xc7_diff_fasm for Verilog/XDC inputs?")
set(ALL_XC7_DIFF_FASM_CHECK_VERILOG FALSE CACHE BOOL "Link target diff_fasm to all_xc7_diff_fasm for Verilog/XDC inputs?")
set(ALL_XC7_DIFF_FASM_INTERCHANGE TRUE CACHE BOOL "Link target diff_fasm to all_xc7_diff_fasm for interchange inputs?")

add_subdirectory(common)
Expand Down
52 changes: 18 additions & 34 deletions xc/common/cmake/vivado.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function(COMMON_VIVADO_TARGETS)
# WORK_DIR <working directory>
# BITSTREAM <bitstream>
# DEPS <dependency list>
# [CHECK_DIFF_FASM]
# [MAKE_DIFF_FASM]
# )
# ~~~
#
Expand All @@ -18,11 +18,11 @@ function(COMMON_VIVADO_TARGETS)
# behavioral simulation.
# - ${NAME}_sim - Load project and launches simulation.
#
# The CHECK_DIFF_FASM option generates a diff between the input BITSTREAM
# The MAKE_DIFF_FASM option generates a diff between the input BITSTREAM
# and the output from Vivado, and attaches that diff generation to
# "all_xc7_diff_fasm" which can used to verify FASM.
#
set(options CHECK_DIFF_FASM)
set(options MAKE_DIFF_FASM)
set(oneValueArgs NAME PRJRAY_DIR PRJRAY_DB_DIR WORK_DIR BITSTREAM)
set(multiValueArgs DEPS)
cmake_parse_arguments(
Expand Down Expand Up @@ -127,7 +127,7 @@ function(COMMON_VIVADO_TARGETS)
add_custom_target(${NAME}_timing DEPENDS ${WORK_DIR}/timing_${NAME}.json)
add_custom_target(${NAME}_fasm DEPENDS ${WORK_DIR}/design_${NAME}.bit.fasm)

if(${COMMON_VIVADO_TARGETS_CHECK_DIFF_FASM})
if(${COMMON_VIVADO_TARGETS_MAKE_DIFF_FASM})
add_custom_target(${NAME}_diff_fasm
COMMAND diff -u
${BITSTREAM_LOCATION}.fasm
Expand All @@ -136,13 +136,6 @@ function(COMMON_VIVADO_TARGETS)
${DEPS}
${CMAKE_CURRENT_BINARY_DIR}/${WORK_DIR}/design_${NAME}.bit.fasm
)
else()
add_custom_target(
${NAME}_diff_fasm
DEPENDS
${DEPS}
${CMAKE_CURRENT_BINARY_DIR}/${WORK_DIR}/design_${NAME}.bit.fasm
)
endif()
endfunction()

Expand Down Expand Up @@ -280,21 +273,24 @@ function(ADD_VIVADO_TARGET)
WORK_DIR ${WORK_DIR}
DEPS ${DEPS}
BITSTREAM ${BITSTREAM}
)
MAKE_DIFF_FASM)

get_target_property_required(RAPIDWRIGHT_INSTALLED rapidwright RAPIDWRIGHT_INSTALLED)
if(${RAPIDWRIGHT_INSTALLED})
CREATE_DCP_BY_INTERCHANGE(
NAME ${NAME}_interchange
PARENT_NAME ${ADD_VIVADO_TARGET_PARENT_NAME}
WORK_DIR ${WORK_DIR}/interchange
CHECK_DIFF_FASM
)
)
endif()

if(NOT ${ADD_VIVADO_TARGET_DISABLE_DIFF_TEST})
if(${ALL_XC7_DIFF_FASM_VERILOG})
add_dependencies(all_${ARCH}_diff_fasm ${NAME}_diff_fasm)
if(${ALL_XC7_DIFF_FASM_CHECK_VERILOG})
add_dependencies(all_${ARCH}_diff_fasm ${NAME}_diff_fasm)
else()
add_dependencies(all_${ARCH}_diff_fasm ${NAME}_fasm)
endif()
endif()
if(${RAPIDWRIGHT_INSTALLED} AND ${ALL_XC7_DIFF_FASM_INTERCHANGE})
add_dependencies(all_${ARCH}_diff_fasm ${NAME}_interchange_diff_fasm)
Expand Down Expand Up @@ -552,7 +548,6 @@ function(CREATE_DCP_BY_INTERCHANGE)
# NAME <name>
# PARENT_NAME <parent name>
# WORK_DIR <work directory>
# [CHECK_DIFF_FASM]
# )
# ~~~
#
Expand All @@ -561,15 +556,12 @@ function(CREATE_DCP_BY_INTERCHANGE)
# PARENT_NAME is the name of the FPGA target being used as input for these
# new targets.
#
# CHECK_DIFF_FASM is an option that, if enabled, will check the difference
# between the interchange-generated FASM and the VPR-generated FASM
#
# New targets:
# <NAME> - Create the DCP and output a bitstream based on the DCP.
# <NAME>_diff_fasm - Diff the FASM between the PARENT_NAME bitstream and
# the bitstream generated from the DCP.

set(options CHECK_DIFF_FASM)
set(options)
set(oneValueArgs NAME PARENT_NAME WORK_DIR)
set(multiValueArgs)
cmake_parse_arguments(
Expand Down Expand Up @@ -684,19 +676,11 @@ function(CREATE_DCP_BY_INTERCHANGE)

get_file_location(BITSTREAM_LOCATION ${BITSTREAM})

if(${CREATE_DCP_CHECK_DIFF_FASM})
add_custom_target(${NAME}_diff_fasm
COMMAND diff -u
${BITSTREAM_LOCATION}.fasm
${CMAKE_CURRENT_BINARY_DIR}/${WORK_DIR}/${NAME}.bit.fasm
DEPENDS
${DIFF_FASM_DEPS}
)
else()
add_custom_target(
${NAME}_diff_fasm
add_custom_target(${NAME}_diff_fasm
COMMAND diff -u
${BITSTREAM_LOCATION}.fasm
${CMAKE_CURRENT_BINARY_DIR}/${WORK_DIR}/${NAME}.bit.fasm
DEPENDS
${DIFF_FASM_DEPS}
)
endif()
${DIFF_FASM_DEPS}
)
endfunction()

0 comments on commit ef79f50

Please sign in to comment.