Skip to content

Commit

Permalink
Merge pull request f4pga#2119 from antmicro/upstream-install-ql
Browse files Browse the repository at this point in the history
Upstream quicklogic install
  • Loading branch information
mkurc-ant committed Apr 13, 2021
2 parents ac29bc6 + 2d14394 commit b71667b
Show file tree
Hide file tree
Showing 31 changed files with 1,563 additions and 214 deletions.
1 change: 1 addition & 0 deletions .github/kokoro/continuous-ql.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ timeout_mins: 1200
action {
define_artifacts {
# File types
regex: "**/symbiflow-*.tar.xz"
regex: "**/*result*.xml"
regex: "**/*sponge_log.xml"
regex: "**/.ninja_log"
Expand Down
2 changes: 1 addition & 1 deletion .github/kokoro/install-200t.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SCRIPT_SRC="$(realpath ${BASH_SOURCE[0]})"
SCRIPT_DIR="$(dirname "${SCRIPT_SRC}")"
INSTALL_DIR="$(pwd)/github/${KOKORO_DIR}/install"

export CMAKE_FLAGS="-GNinja -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DINSTALL_DEVICE=xc7a200t"
export CMAKE_FLAGS="-GNinja -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DINSTALL_DEVICES=xc7a200t"
export BUILD_TOOL=ninja
source ${SCRIPT_DIR}/common.sh

Expand Down
2 changes: 1 addition & 1 deletion .github/kokoro/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SCRIPT_SRC="$(realpath ${BASH_SOURCE[0]})"
SCRIPT_DIR="$(dirname "${SCRIPT_SRC}")"
INSTALL_DIR="$(pwd)/github/${KOKORO_DIR}/install"

export CMAKE_FLAGS="-GNinja -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}"
export CMAKE_FLAGS="-GNinja -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DINSTALL_FAMILIES=xc7"
export BUILD_TOOL=ninja
source ${SCRIPT_DIR}/common.sh

Expand Down
2 changes: 2 additions & 0 deletions .github/kokoro/kokoro-cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
'xc7a200t', 'xc7a200t-vendor', 'ql', 'install', 'install-200t']:
if 'install' in type:
artifacts = INSTALL
elif 'ql' == type:
artifacts = INSTALL + "\n" + DEFAULT_ARTIFACTS
else:
artifacts = DEFAULT_ARTIFACTS

Expand Down
1 change: 1 addition & 0 deletions .github/kokoro/presubmit-ql.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ timeout_mins: 1200
action {
define_artifacts {
# File types
regex: "**/symbiflow-*.tar.xz"
regex: "**/*result*.xml"
regex: "**/*sponge_log.xml"
regex: "**/.ninja_log"
Expand Down
14 changes: 13 additions & 1 deletion .github/kokoro/ql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

SCRIPT_SRC="$(realpath ${BASH_SOURCE[0]})"
SCRIPT_DIR="$(dirname "${SCRIPT_SRC}")"
INSTALL_DIR="$(pwd)/github/${KOKORO_DIR}/install"

export CMAKE_FLAGS="-GNinja"
export CMAKE_FLAGS="-GNinja -DINSTALL_FAMILIES=qlf_k4n8 -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}"
export BUILD_TOOL=ninja
source ${SCRIPT_DIR}/common.sh

Expand All @@ -25,12 +26,23 @@ set +e
BUILD_RESULT=$?
# FIXME: Not sure if the below will work for QuickLogic now.
#ninja print_qor > ql_openfpga_qor.csv
# Installing devices and toolchain
ninja -j${MAX_CORES} install
popd
exit ${BUILD_RESULT}
)
BUILD_RESULT=$?
set -e

echo
echo "========================================"
echo "Compressing and uploading install dir"
echo "----------------------------------------"
(
du -ah install
export GIT_HASH=$(git rev-parse --short HEAD)
tar -I "pixz" -cvf symbiflow-quicklogic-${GIT_HASH}.tar.xz -C install bin share
)
echo "----------------------------------------"

source ${SCRIPT_DIR}/steps/stop_monitor.sh
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ include(common/cmake/tools.cmake)
include(common/cmake/sv2v.cmake)
include(common/cmake/litex.cmake)

# Parse lists of architectures / devices to be installed
parse_install_lists()

find_package(PythonInterp 3 REQUIRED)

add_custom_target(test_python)
Expand Down
124 changes: 77 additions & 47 deletions common/cmake/devices.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function(DEFINE_ARCH)
# BIT_TIME <path to BIT_TIME executable>
# BIT_TIME_CMD <command to run BIT_TIME>
# [RR_GRAPH_EXT <ext>]
# [NO_INSTALL]
# )
# ~~~
#
Expand Down Expand Up @@ -140,6 +141,7 @@ function(DEFINE_ARCH)
NO_BIT_TO_BIN
NO_BIT_TO_V
NO_BIT_TIME
NO_INSTALL
USE_FASM
)

Expand Down Expand Up @@ -206,6 +208,7 @@ function(DEFINE_ARCH)
NO_BIT_TO_BIN
NO_BIT_TO_V
NO_BIT_TIME
NO_INSTALL
USE_FASM
ROUTE_CHAN_WIDTH
)
Expand Down Expand Up @@ -496,7 +499,7 @@ function(DEFINE_DEVICE)
# [CACHE_LOOKAHEAD]
# [CACHE_ARGS <args>]
# [ROUTE_CHAN_WIDTH <width>]
# [DONT_INSTALL]
# [NO_INSTALL]
# )
# ~~~
#
Expand Down Expand Up @@ -528,7 +531,7 @@ function(DEFINE_DEVICE)
# When ROUTE_CHAN_WIDTH is provided it overrides the channel with provided
# for the ARCH
#
set(options CACHE_LOOKAHEAD CACHE_PLACE_DELAY DONT_INSTALL)
set(options CACHE_LOOKAHEAD CACHE_PLACE_DELAY NO_INSTALL)
set(oneValueArgs DEVICE ARCH PART DEVICE_TYPE PACKAGES WIRE_EBLIF ROUTE_CHAN_WIDTH)
set(multiValueArgs RR_PATCH_DEPS RR_PATCH_EXTRA_ARGS CACHE_ARGS)
cmake_parse_arguments(
Expand All @@ -539,7 +542,7 @@ function(DEFINE_DEVICE)
${ARGN}
)

set(DONT_INSTALL ${DEFINE_DEVICE_DONT_INSTALL})
set(NO_INSTALL ${DEFINE_DEVICE_NO_INSTALL})

add_custom_target(${DEFINE_DEVICE_DEVICE})
foreach(ARG ARCH DEVICE_TYPE PACKAGES)
Expand Down Expand Up @@ -793,16 +796,37 @@ function(DEFINE_DEVICE)
PROG_TOOL false
)

# Install
if(NOT ${DONT_INSTALL})
install_device_files(
PART ${PART}
DEVICE ${DEFINE_DEVICE_DEVICE}
DEVICE_TYPE ${DEFINE_DEVICE_DEVICE_TYPE}
PACKAGE ${PACKAGE})
else()
message(WARNING "Skipping installation of device '${DEFINE_DEVICE_DEVICE}-${PACKAGE}', type '${DEFINE_DEVICE_DEVICE_TYPE}'")
endif()
# Append the device to the device list of the arch. This is currently used
# to determine whether the architecture is to be installed. Individual
# devices get examined if no device is to be installed then installation
# of the arch is skipped as well.
get_target_property(DEVICES ${DEFINE_DEVICE_ARCH} DEVICES)
if ("${DEVICES}" MATCHES ".*NOTFOUND")
set(DEVICES "")
endif ()

list(APPEND DEVICES ${DEFINE_DEVICE_DEVICE})

set_target_properties(
${DEFINE_DEVICE_ARCH}
PROPERTIES
DEVICES "${DEVICES}"
)

# Set the NO_INSTALL property
set_target_properties(
${DEFINE_DEVICE_DEVICE}
PROPERTIES
NO_INSTALL ${NO_INSTALL}
)

# Install device files. The function checks internally whether the files need to be installed
install_device_files(
PART ${PART}
DEVICE ${DEFINE_DEVICE_DEVICE}
DEVICE_TYPE ${DEFINE_DEVICE_DEVICE_TYPE}
PACKAGE ${PACKAGE}
)
endforeach()

endfunction()
Expand Down Expand Up @@ -1755,48 +1779,54 @@ function(ADD_FPGA_TARGET)
endif()

if (${ADD_FPGA_TARGET_INSTALL_CIRCUIT})
set(INSTALL_DEPS "")

# Install circuit
append_file_dependency(INSTALL_DEPS ${OUT_EBLIF_REL})
# Check if the device should be installed
check_device_install(${DEVICE} DO_INSTALL)
if (DO_INSTALL)

install(
FILES ${OUT_EBLIF}
RENAME ${NAME}.eblif
DESTINATION "benchmarks/circuits"
)
set(INSTALL_DEPS "")

# Install place constraints
set(CONSTR_FILE "")
if (NOT ${NO_PLACE_CONSTR})
append_file_dependency(INSTALL_DEPS ${OUT_CONSTR_REL})
set(CONSTR_FILE ${OUT_CONSTR})
else()
append_file_dependency(INSTALL_DEPS ${OUT_IO_REL})
set(CONSTR_FILE ${OUT_IO})
endif()
# Install circuit
append_file_dependency(INSTALL_DEPS ${OUT_EBLIF_REL})

install(
FILES ${CONSTR_FILE}
RENAME ${NAME}.place
DESTINATION "benchmarks/place_constr"
)
install(
FILES ${OUT_EBLIF}
RENAME ${NAME}.eblif
DESTINATION "benchmarks/circuits"
)

# Install place constraints
set(CONSTR_FILE "")
if (NOT ${NO_PLACE_CONSTR})
append_file_dependency(INSTALL_DEPS ${OUT_CONSTR_REL})
set(CONSTR_FILE ${OUT_CONSTR})
else()
append_file_dependency(INSTALL_DEPS ${OUT_IO_REL})
set(CONSTR_FILE ${OUT_IO})
endif()

# Install SDC constraints
if (NOT SDC_FILE STREQUAL "")
install(
FILES ${SDC_FILE}
RENAME ${NAME}.sdc
DESTINATION "benchmarks/sdc"
FILES ${CONSTR_FILE}
RENAME ${NAME}.place
DESTINATION "benchmarks/place_constr"
)
append_file_dependency(INSTALL_DEPS ${SDC_DEPS})
endif()

add_custom_target(
"INSTALL_${NAME}_CIRCUIT"
ALL
DEPENDS ${INSTALL_DEPS}
)
# Install SDC constraints
if (NOT SDC_FILE STREQUAL "")
install(
FILES ${SDC_FILE}
RENAME ${NAME}.sdc
DESTINATION "benchmarks/sdc"
)
append_file_dependency(INSTALL_DEPS ${SDC_DEPS})
endif()

add_custom_target(
"INSTALL_${NAME}_CIRCUIT"
ALL
DEPENDS ${INSTALL_DEPS}
)
endif()
endif()

# Generate placement.
Expand Down

0 comments on commit b71667b

Please sign in to comment.