Skip to content

Commit

Permalink
Merge pull request f4pga#2112 from antmicro/add-gtp-primitives
Browse files Browse the repository at this point in the history
Add GTP primitives to artix7 architectures
  • Loading branch information
acomodi committed Apr 14, 2021
2 parents b71667b + 531f7c9 commit 3a055cd
Show file tree
Hide file tree
Showing 81 changed files with 4,672 additions and 265 deletions.
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
- litex-hub::icestorm=0.0_0719_g792cef0=20201120_145821
- litex-hub::iverilog=s20150603_0957_gad862020=20201120_145821
- litex-hub::openocd=0.10.0_1514_ga8edbd020=20201119_154304
- litex-hub::symbiflow-yosys-plugins=1.0.0_7_263_gac47a74=20210312_125539
- litex-hub::symbiflow-yosys-plugins=1.0.0_7_284_gb6c5f5d=20210318_102115
- litex-hub::prjxray-tools=0.1_2842_g6867429c=20210301_104249
- litex-hub::prjxray-db=0.0_248_g2e51ad3=20210312_125539
- litex-hub::vtr-optimized=8.0.0_3445_ga806b1609=20210312_125539
Expand Down
2 changes: 1 addition & 1 deletion third_party/prjxray
108 changes: 53 additions & 55 deletions utils/lib/pb_type_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,86 +223,84 @@ def start_heterogeneous_tile(
nsmap={'xi': XI_URL},
)

for site_type in sites.keys():
for num_sub_tile, site in enumerate(sites[site_type]):
sub_tile_name = "{}_{}_{}".format(
tile_name, site_type, num_sub_tile
)
for num_sub_tile, site_tuple in enumerate(sites):
_, site, input_wires, output_wires = site_tuple
site_type = site.type

site, input_wires, output_wires = site
sub_tile_name = "{}_{}_{}".format(tile_name, site_type, num_sub_tile)

sub_tile_xml = start_sub_tile(
sub_tile_name, input_wires, output_wires
)
sub_tile_xml = start_sub_tile(sub_tile_name, input_wires, output_wires)

fc_xml = add_fc(sub_tile_xml)

fc_xml = add_fc(sub_tile_xml)
add_pinlocations(
tile_name,
sub_tile_xml,
fc_xml,
pin_assignments,
set(input_wires) | set(output_wires),
sub_tile_name=sub_tile_name
)

equivalent_sites_xml = ET.Element('equivalent_sites')

site_xml = ET.Element(
'site', {
'pb_type': add_vpr_tile_prefix(site.type),
'pin_mapping': 'custom'
}
)

add_pinlocations(
tile_name,
sub_tile_xml,
fc_xml,
pin_assignments,
set(input_wires) | set(output_wires),
sub_tile_name=sub_tile_name
site_pins = site.site_pins
for site_pin in site_pins:
add_tile_direct(
site_xml,
tile=object_ref(
add_vpr_tile_prefix(sub_tile_name),
site_pin.wire,
),
pb_type=object_ref(
pb_name=add_vpr_tile_prefix(site.type),
pin_name=site_pin.name,
),
)

equivalent_sites_xml = ET.Element('equivalent_sites')
equivalent_sites_xml.append(site_xml)

for equivalent_site_type in equivalent_sites[site_type]:
eq_site = [
s[1] for s in sites if s[1].type == equivalent_site_type
][0]

site_xml = ET.Element(
'site', {
'pb_type': add_vpr_tile_prefix(site.type),
'pb_type': add_vpr_tile_prefix(eq_site.type),
'pin_mapping': 'custom'
}
)

site_pins = site.site_pins
for site_pin in site_pins:
for equivalent_site_pin in eq_site.site_pins:
site_pin_wire = get_site_pin_wire(
equivalent_site_pin, site_pins
)

add_tile_direct(
site_xml,
tile=object_ref(
add_vpr_tile_prefix(sub_tile_name),
site_pin.wire,
site_pin_wire,
),
pb_type=object_ref(
pb_name=add_vpr_tile_prefix(site.type),
pin_name=site_pin.name,
pb_name=add_vpr_tile_prefix(eq_site.type),
pin_name=equivalent_site_pin.name,
),
)

equivalent_sites_xml.append(site_xml)

for equivalent_site_type in equivalent_sites[site.type]:
eq_site, _, _ = sites[equivalent_site_type][0]

site_xml = ET.Element(
'site', {
'pb_type': add_vpr_tile_prefix(eq_site.type),
'pin_mapping': 'custom'
}
)

for equivalent_site_pin in eq_site.site_pins:
site_pin_wire = get_site_pin_wire(
equivalent_site_pin, site_pins
)

add_tile_direct(
site_xml,
tile=object_ref(
add_vpr_tile_prefix(sub_tile_name),
site_pin_wire,
),
pb_type=object_ref(
pb_name=add_vpr_tile_prefix(eq_site.type),
pin_name=equivalent_site_pin.name,
),
)

equivalent_sites_xml.append(site_xml)

sub_tile_xml.append(equivalent_sites_xml)
sub_tile_xml.append(equivalent_sites_xml)

tile_xml.append(sub_tile_xml)
tile_xml.append(sub_tile_xml)

return tile_xml

Expand Down
14 changes: 12 additions & 2 deletions xc/common/cmake/device_define.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function(ADD_XC_BOARD)

set(PRJRAY_DIR ${DOC_PRJ})
set(PRJRAY_DB_DIR ${DOC_PRJ_DB})
set(DB_ROOT "${PRJRAY_DB_DIR}/${PRJRAY_ARCH}")

set_target_properties(${BOARD}
PROPERTIES PART ${PART}
Expand Down Expand Up @@ -94,6 +95,8 @@ function(ADD_XC_BOARD)

set_target_properties(${BOARD}
PROPERTIES PLACE_CONSTR_TOOL_EXTRA_ARGS " \
--db_root ${PRJRAY_DB_DIR} \
--part ${PART} \
--vpr_grid_map ${VPR_GRID_MAP_LOCATION} \
--roi
")
Expand Down Expand Up @@ -124,6 +127,8 @@ function(ADD_XC_BOARD)

set_target_properties(${BOARD}
PROPERTIES PLACE_CONSTR_TOOL_EXTRA_ARGS " \
--db_root ${PRJRAY_DB_DIR} \
--part ${PART} \
--vpr_grid_map ${VPR_GRID_MAP_LOCATION}
")

Expand Down Expand Up @@ -154,7 +159,9 @@ function(ADD_XC_BOARD)

set_target_properties(${BOARD}
PROPERTIES PLACE_CONSTR_TOOL_EXTRA_ARGS " \
--vpr_grid_map ${VPR_GRID_MAP_LOCATION}
--db_root ${PRJRAY_DB_DIR} \
--part ${PART} \
--vpr_grid_map ${VPR_GRID_MAP_LOCATION} \
")

set(CREATE_PINMAP_CSV ${symbiflow-arch-defs_SOURCE_DIR}/xc/common/utils/prjxray_create_pinmap_csv.py)
Expand Down Expand Up @@ -195,7 +202,10 @@ function(ADD_XC_BOARD)
set_target_properties(
dummy_${ARCH}_${DEVICE}_${ADD_XC_BOARD_PACKAGE}
PROPERTIES
PLACE_CONSTR_TOOL_EXTRA_ARGS "--vpr_grid_map ${VPR_GRID_MAP_LOCATION} --roi"
PLACE_CONSTR_TOOL_EXTRA_ARGS " \
--db_root ${PRJRAY_DB_DIR} \
--part ${PART} \
--vpr_grid_map ${VPR_GRID_MAP_LOCATION} --roi"
PINMAP
${CMAKE_CURRENT_SOURCE_DIR}/${PINMAP_CSV})

Expand Down
22 changes: 20 additions & 2 deletions xc/common/cmake/project_ray.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ function(PROJECT_RAY_TILE)
# definition, instead of using the project X-Ray database.
# FILTER_X can be supplied to filter to sites that have the given X
# coordinate.
# UNUSED_WIRES: contains a list of wires in site to be dropped
#
# Usage:
# ~~~
Expand All @@ -320,12 +321,13 @@ function(PROJECT_RAY_TILE)
# SITE_COORDS (option)
# NO_FASM_PREFIX (option)
# [FILTER_X <x_coord>]
# UNUSED_WIRES <unused wires>
# )
# ~~~

set(options FUSED_SITES SITE_AS_TILE USE_DATABASE NO_FASM_PREFIX)
set(oneValueArgs ARCH TILE FILTER_X SITE_COORDS)
set(multiValueArgs SITE_TYPES EQUIVALENT_SITES)
set(multiValueArgs SITE_TYPES EQUIVALENT_SITES UNUSED_WIRES)
cmake_parse_arguments(
PROJECT_RAY_TILE
"${options}"
Expand Down Expand Up @@ -395,6 +397,12 @@ function(PROJECT_RAY_TILE)
set(FASM_ARGS "--no_fasm_prefix")
endif()

set(UNUSED_WIRES "")
if(PROJECT_RAY_TILE_UNUSED_WIRES)
string(REPLACE ";" "," UNUSED_WIRES_COMMA "${PROJECT_RAY_TILE_UNUSED_WIRES}")
set(UNUSED_WIRES "--unused_wires" ${UNUSED_WIRES_COMMA})
endif()

string(TOUPPER ${TILE} TILE_UPPER)

add_custom_command(
Expand All @@ -409,6 +417,7 @@ function(PROJECT_RAY_TILE)
--pin_assignments ${PIN_ASSIGNMENTS}
--output-pb-type ${CMAKE_CURRENT_BINARY_DIR}/${TILE}.pb_type.xml
--output-model ${CMAKE_CURRENT_BINARY_DIR}/${TILE}.model.xml
${UNUSED_WIRES}
${FUSED_SITES_ARGS}
${SITE_COORDS_ARGS}
${FASM_ARGS}
Expand Down Expand Up @@ -662,15 +671,17 @@ function(PROJECT_RAY_TILE_CAPACITY)
# ARCH <arch>
# TILE <tile>
# SITE_TYPES <site types>
# [UNUSED_WIRES <unused wires>]
# )
# ~~~
#
# SITE_TYPES: contains a list of sites that are used as sub tiles for the specified tile.
# The total number of instances of a site type appears as the capacity of the sub tile
# UNUSED_WIRES: optional list of wires in site to be dropped

set(options)
set(oneValueArgs ARCH TILE)
set(multiValueArgs SITE_TYPES)
set(multiValueArgs SITE_TYPES UNUSED_WIRES)
cmake_parse_arguments(
PROJECT_RAY_TILE_CAPACITY
"${options}"
Expand Down Expand Up @@ -702,6 +713,12 @@ function(PROJECT_RAY_TILE_CAPACITY)

string(TOLOWER ${TILE} TILE_LOWER)

set(UNUSED_WIRES "")
if(PROJECT_RAY_TILE_CAPACITY_UNUSED_WIRES)
string(REPLACE ";" "," UNUSED_WIRES_COMMA "${PROJECT_RAY_TILE_CAPACITY_UNUSED_WIRES}")
set(UNUSED_WIRES "--unused_wires" ${UNUSED_WIRES_COMMA})
endif()

add_custom_command(
OUTPUT ${TILE_LOWER}.tile.xml
COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${PRJRAY_DIR}:${symbiflow-arch-defs_SOURCE_DIR}/utils
Expand All @@ -713,6 +730,7 @@ function(PROJECT_RAY_TILE_CAPACITY)
--tile_type ${TILE}
--pb_types ${SITE_TYPES_COMMA}
--pin_assignments ${PIN_ASSIGNMENTS}
${UNUSED_WIRES}
DEPENDS
${TILE_CAPACITY_IMPORT}
${DEPS}
Expand Down
5 changes: 5 additions & 0 deletions xc/common/primitives/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ add_subdirectory(bufhce)
add_subdirectory(plle2_adv)
add_subdirectory(idelayctrl)
add_subdirectory(ps7)
add_subdirectory(gtpe2_common)
add_subdirectory(gtpe2_channel)
add_subdirectory(ibufds_gte2)
add_subdirectory(ipad)
add_subdirectory(opad)
2 changes: 2 additions & 0 deletions xc/common/primitives/gtpe2_channel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_file_target(FILE gtpe2_channel.model.xml SCANNER_TYPE xml)
add_file_target(FILE gtpe2_channel.pb_type.xml SCANNER_TYPE xml)

0 comments on commit 3a055cd

Please sign in to comment.