Skip to content

Commit

Permalink
Merge pull request f4pga#2115 from lnsharma/master
Browse files Browse the repository at this point in the history
Pin-mapping support for QuickLogic EFPGA device
  • Loading branch information
acomodi committed Apr 1, 2021
2 parents a3c75b4 + e8accfc commit ac29bc6
Show file tree
Hide file tree
Showing 18 changed files with 2,080 additions and 366 deletions.
9 changes: 9 additions & 0 deletions common/cmake/devices.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function(DEFINE_ARCH)
# RR_PATCH_CMD <command to run RR_PATCH_TOOL>
# DEVICE_FULL_TEMPLATE <template for constructing DEVICE_FULL strings.
# [NO_PINS]
# [NO_TEST_PINS]
# [NO_PLACE]
# [NO_PLACE_CONSTR]
# [USE_FASM]
Expand Down Expand Up @@ -63,6 +64,8 @@ function(DEFINE_ARCH)
# * DOC_PRJ_DB - path to the third party documentation database
#
# If NO_PINS is set, PLACE_TOOL and PLACE_TOOL_CMD cannot be specified.
# If NO_TEST_PINS is set, the automatic generation of the constraints file for
# the generic tests is skipped.
# If NO_BITSTREAM is set, HLC_TO_BIT, HLC_TO_BIT_CMD BIT_TO_V,
# BIT_TO_V_CMD, BIT_TO_BIN and BIT_TO_BIN_CMD cannot be specified.
#
Expand Down Expand Up @@ -132,6 +135,7 @@ function(DEFINE_ARCH)
set(options
NO_PLACE_CONSTR
NO_PINS
NO_TEST_PINS
NO_BITSTREAM
NO_BIT_TO_BIN
NO_BIT_TO_V
Expand Down Expand Up @@ -197,6 +201,7 @@ function(DEFINE_ARCH)
RR_PATCH_CMD
NO_PLACE_CONSTR
NO_PINS
NO_TEST_PINS
NO_BITSTREAM
NO_BIT_TO_BIN
NO_BIT_TO_V
Expand Down Expand Up @@ -1383,6 +1388,10 @@ function(ADD_FPGA_TARGET)
if(NOT ${ADD_FPGA_TARGET_INPUT_IO_FILE} STREQUAL "" OR NOT ${ADD_FPGA_TARGET_INPUT_XDC_FILE} STREQUAL "")
get_target_property_required(PINMAP_FILE ${BOARD} PINMAP)
get_file_location(PINMAP ${PINMAP_FILE})
get_target_property(PINMAP_XML_FILE ${BOARD} PINMAP_XML)
if(NOT "${PINMAP_XML_FILE}" MATCHES ".*-NOTFOUND")
get_file_location(PINMAP_XML ${PINMAP_XML_FILE})
endif()
append_file_dependency(YOSYS_IO_DEPS ${PINMAP_FILE})
endif()

Expand Down
57 changes: 56 additions & 1 deletion quicklogic/common/cmake/quicklogic_board.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function(ADD_QUICKLOGIC_BOARD)

set(options)
set(oneValueArgs BOARD DEVICE PACKAGE FABRIC_PACKAGE)
set(oneValueArgs BOARD DEVICE PACKAGE FABRIC_PACKAGE PINMAP_XML PINMAP)
set(multiValueArgs)
cmake_parse_arguments(
ADD_QUICKLOGIC_BOARD
Expand All @@ -19,6 +19,8 @@ function(ADD_QUICKLOGIC_BOARD)
BOARD ${ADD_QUICKLOGIC_BOARD_BOARD}
DEVICE ${ADD_QUICKLOGIC_BOARD_DEVICE}
PACKAGE ${ADD_QUICKLOGIC_BOARD_PACKAGE}
PINMAP ${ADD_QUICKLOGIC_BOARD_PINMAP}
PINMAP_XML ${ADD_QUICKLOGIC_BOARD_PINMAP_XML}
)

set(DEVICE ${ADD_QUICKLOGIC_BOARD_DEVICE})
Expand All @@ -27,6 +29,8 @@ function(ADD_QUICKLOGIC_BOARD)
get_target_property_required(FAMILY ${DEVICE_TYPE} FAMILY)
set(PACKAGE ${ADD_QUICKLOGIC_BOARD_PACKAGE})
set(BOARD ${ADD_QUICKLOGIC_BOARD_BOARD})
set(PINMAP ${ADD_QUICKLOGIC_BOARD_PINMAP})
set(PINMAP_XML ${ADD_QUICKLOGIC_BOARD_PINMAP_XML})

# Get the database location. If given then use the database to generate
# pinmap and clkmap CSV files
Expand Down Expand Up @@ -185,6 +189,57 @@ function(ADD_QUICKLOGIC_BOARD)
PACKAGE ${PACKAGE}
)

elseif("${ARCH}" STREQUAL "qlf_k4n8")
set(PINMAP_CSV ${PINMAP})

# Link the pinmap XML
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/${PINMAP_XML}
COMMAND
${CMAKE_COMMAND} -E create_symlink
${CMAKE_CURRENT_SOURCE_DIR}/devices/umc22/${PINMAP_XML}
${CMAKE_CURRENT_BINARY_DIR}/${PINMAP_XML}
)
add_file_target(FILE ${PINMAP_XML} GENERATED)

# Make the pinmap CSV depend on pinmap XML. This way the symlink will be
# created without the need for adding the dependency elsewhere.
set(PINMAP_CSV_DEPS)
append_file_dependency(PINMAP_CSV_DEPS ${PINMAP_XML})

# Link the pinmap CSV
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/${PINMAP_CSV}
COMMAND
${CMAKE_COMMAND} -E create_symlink
${CMAKE_CURRENT_SOURCE_DIR}/devices/umc22/${PINMAP_CSV}
${CMAKE_CURRENT_BINARY_DIR}/${PINMAP_CSV}
DEPENDS
${PINMAP_CSV_DEPS}
)
add_file_target(FILE ${PINMAP_CSV} GENERATED)


# Set the board properties
set_target_properties(
${BOARD}
PROPERTIES
PINMAP
${CMAKE_CURRENT_SOURCE_DIR}/${PINMAP_CSV}
PINMAP_XML
${CMAKE_CURRENT_SOURCE_DIR}/${PINMAP_XML}
)

# Install board files
#define_ql_pinmap_csv_install_target(
# PART ${PART}
# BOARD ${BOARD}
# DEVICE_TYPE ${DEVICE_TYPE}
# DEVICE ${DEVICE}
# PACKAGE ${PACKAGE}
#)
endif()

endfunction()
18 changes: 13 additions & 5 deletions quicklogic/common/cmake/quicklogic_qlf_arch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,19 @@ function(QUICKLOGIC_DEFINE_QLF_ARCH)
\${PYTHON3} \${RR_PATCH_TOOL} \
--rr-graph-in \${OUT_RRXML_VIRT} \
--rr-graph-out \${OUT_RRXML_REAL}"

# In the current state there is no support for IO placement constraints
# for QuickLogic qlf_k4n8 devices. It is currently a work in progress.
NO_PINS
NO_PLACE

PLACE_TOOL
${symbiflow-arch-defs_SOURCE_DIR}/quicklogic/${FAMILY}/utils/create_ioplace.py
PLACE_TOOL_CMD "${CMAKE_COMMAND} -E env \
PYTHONPATH=${symbiflow-arch-defs_SOURCE_DIR}/utils:$PYTHONPATH:${symbiflow-arch-defs_SOURCE_DIR}/quicklogic/common/utils \
\${PYTHON3} \${PLACE_TOOL} \
--pinmap_xml \${PINMAP_XML} \
--blif \${OUT_EBLIF} \
--pcf \${INPUT_IO_FILE} \
--net \${OUT_NET} \
--csv_file \${PINMAP}"

NO_TEST_PINS
NO_PLACE_CONSTR

# With the current support there is no bitstream generation support yet.
Expand Down

0 comments on commit ac29bc6

Please sign in to comment.