Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LUT-thru tests #87

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion boards/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ add_board(
speedgrade -9
)

# Fake board to test the test architecture
# Fake board to test test architecture(s)
add_board(
name testboard
device_family test
Expand All @@ -118,3 +118,14 @@ add_board(
no_fasm
no_bitstream
)

add_board(
name testboard_noffmux
device_family test
device testarch-noffmux
arch testarch-noffmux
package test_package
speedgrade -1
no_fasm
no_bitstream
)
3 changes: 2 additions & 1 deletion devices/chipdb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,14 @@ function(generate_chipdb)
get_target_property(BBASM programs BBASM)

get_target_property(device_loc ${device_target} LOCATION)
set(chipdb_bba ${CMAKE_CURRENT_BINARY_DIR}/chipdb.bba)
set(chipdb_bba ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba)
add_custom_command(
OUTPUT ${chipdb_bba}
COMMAND
${PYTHON3} -mfpga_interchange.nextpnr_emit
--schema_dir ${INTERCHANGE_SCHEMA_PATH}
--output_dir ${CMAKE_CURRENT_BINARY_DIR}
--suffix ${device}
--device_config ${device_config}
--device ${device_loc}
DEPENDS
Expand Down
6 changes: 5 additions & 1 deletion devices/chipdb_testarch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function(generate_testarch_device_db)
# device <common device>
# package <package>
# output_target <output device target>
# [extra_args <extra args>]
# )
# ~~~
#
Expand All @@ -17,13 +18,14 @@ function(generate_testarch_device_db)
# share the same xc7a35t device prefix
# - package: one among the parts available for a given package
# - output_target: variable name that will hold the output device target for the parent scope
# - extra_args: a list of extra arguments to be passed to the test architecture generator
#
# Targets generated:
# - rapidwright-<device>-device

set(options)
set(oneValueArgs device package output_target)
set(multiValueArgs)
set(multiValueArgs extra_args)

cmake_parse_arguments(
create_testarch_device_db
Expand All @@ -36,6 +38,7 @@ function(generate_testarch_device_db)
set(device ${create_testarch_device_db_device})
set(package ${create_testarch_device_db_package})
set(output_target ${create_testarch_device_db_output_target})
set(extra_args ${create_testarch_device_db_extra_args})

get_target_property(PYTHON3 programs PYTHON3)

Expand All @@ -47,6 +50,7 @@ function(generate_testarch_device_db)
--schema-dir ${INTERCHANGE_SCHEMA_PATH}
--out-file ${out_file}
--package ${package}
${extra_args}
)

add_custom_target(testarch-${device}-device DEPENDS ${out_file})
Expand Down
16 changes: 16 additions & 0 deletions devices/testarch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,19 @@ generate_chipdb(
device_config ${PYTHON_INTERCHANGE_PATH}/test_data/gen_device_config.yaml
test_package test_package
)

# Testarch with FFMUX disabled
generate_testarch_device_db(
device testarch-noffmux
package test_package
output_target test_arch_target
extra_args --no-ffmux
)

generate_chipdb(
device testarch-noffmux
part testarch-test_package
device_target ${test_arch_target}
device_config ${PYTHON_INTERCHANGE_PATH}/test_data/gen_device_config.yaml
test_package test_package
)
14 changes: 11 additions & 3 deletions tests/features/lut/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@ add_generic_test(
)

add_generic_test(
name lut
board_list testboard
sources lut_testarch.v
name lut_ff
board_list testboard testboard_noffmux
sources lut_ff.v
generated_xdc ${CMAKE_CURRENT_SOURCE_DIR}/testboard.xdc
)

add_generic_test(
name lut_routethru
board_list testboard_noffmux
sources lut_routethru.v
generated_xdc ${CMAKE_CURRENT_SOURCE_DIR}/lut_routethru.xdc
)

add_xc7_validation_test(
Expand Down
File renamed without changes.
30 changes: 30 additions & 0 deletions tests/features/lut/lut_routethru.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (C) 2021 The Symbiflow Authors.
//
// Use of this source code is governed by a ISC-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/ISC
//
// SPDX-License-Identifier: ISC

module top(input [3:0] i, output [3:0] o);

wire i0_wire, i1_wire, i2_wire, i3_wire;
wire o0_wire, o1_wire, o2_wire, o3_wire;

IB ib_0(.I(i0_wire), .P(i[0]));
IB ib_1(.I(i1_wire), .P(i[1]));
IB ib_2(.I(i2_wire), .P(i[2]));
IB ib_3(.I(i3_wire), .P(i[3]));

OB ob_0(.O(o0_wire), .P(o[0]));
OB ob_1(.O(o1_wire), .P(o[1]));
OB ob_2(.O(o2_wire), .P(o[2]));
OB ob_3(.O(o3_wire), .P(o[3]));

// "Free" flip-flops. In the testarch with no FFMUX they require LUT-thrus
DFFR ff_0(.D(i0_wire), .C(1'b1), .R(1'b0), .Q(o0_wire));
DFFR ff_1(.D(i1_wire), .C(1'b1), .R(1'b0), .Q(o1_wire));
DFFR ff_2(.D(i2_wire), .C(1'b1), .R(1'b0), .Q(o2_wire));
DFFR ff_3(.D(i3_wire), .C(1'b1), .R(1'b0), .Q(o3_wire));

endmodule
8 changes: 8 additions & 0 deletions tests/features/lut/lut_routethru.xdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set_property PACKAGE_PIN A1 [get_ports i[0]]
set_property PACKAGE_PIN A2 [get_ports i[1]]
set_property PACKAGE_PIN A3 [get_ports i[2]]
set_property PACKAGE_PIN A4 [get_ports i[3]]
set_property PACKAGE_PIN A5 [get_ports o[0]]
set_property PACKAGE_PIN A6 [get_ports o[1]]
set_property PACKAGE_PIN A7 [get_ports o[2]]
set_property PACKAGE_PIN A8 [get_ports o[3]]
3 changes: 1 addition & 2 deletions tests/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function(add_generic_test)
endif()
get_property(device_target TARGET device-${device} PROPERTY DEVICE_TARGET)
get_property(device_loc TARGET device-${device} PROPERTY DEVICE_LOC)
set(chipdb_loc ${CMAKE_BINARY_DIR}/devices/${device}/${device}.bin)
get_property(chipdb_loc TARGET device-${device} PROPERTY CHIPDB_BIN_LOC)

set(output_dir ${CMAKE_CURRENT_BINARY_DIR}/${board})
add_custom_command(
Expand Down Expand Up @@ -180,7 +180,6 @@ function(add_generic_test)
${netlist}
DEPENDS
${arch}-${test_name}-json
chipdb-${device}-bin
${device_target}
${device_loc}
${synth_json}
Expand Down