From 8e875f34533f94a78f437391e27077e30754f4f5 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Thu, 2 Nov 2023 21:08:36 -0700 Subject: [PATCH] [test] add a new test case to validate the new feature --- ...testbench_template_example_script.openfpga | 57 +++++++++++++++++++ .../regression_test_scripts/basic_reg_test.sh | 1 + .../config/counter8_bus_group.xml | 12 ++++ .../config/mac4_bus_group.xml | 26 +++++++++ .../config/pin_constraints_dummy.xml | 5 ++ .../config/pin_constraints_reset.xml | 7 +++ .../config/task.conf | 51 +++++++++++++++++ 7 files changed, 159 insertions(+) create mode 100644 openfpga_flow/openfpga_shell_scripts/write_testbench_template_example_script.openfpga create mode 100644 openfpga_flow/tasks/basic_tests/generate_template_testbench/config/counter8_bus_group.xml create mode 100644 openfpga_flow/tasks/basic_tests/generate_template_testbench/config/mac4_bus_group.xml create mode 100644 openfpga_flow/tasks/basic_tests/generate_template_testbench/config/pin_constraints_dummy.xml create mode 100644 openfpga_flow/tasks/basic_tests/generate_template_testbench/config/pin_constraints_reset.xml create mode 100644 openfpga_flow/tasks/basic_tests/generate_template_testbench/config/task.conf diff --git a/openfpga_flow/openfpga_shell_scripts/write_testbench_template_example_script.openfpga b/openfpga_flow/openfpga_shell_scripts/write_testbench_template_example_script.openfpga new file mode 100644 index 000000000..7f0f8eeaf --- /dev/null +++ b/openfpga_flow/openfpga_shell_scripts/write_testbench_template_example_script.openfpga @@ -0,0 +1,57 @@ +# Run VPR for the 'and' design +#--write_rr_graph example_rr_graph.xml +vpr ${VPR_ARCH_FILE} ${VPR_TESTBENCH_BLIF} --clock_modeling ideal + +# Read OpenFPGA architecture definition +read_openfpga_arch -f ${OPENFPGA_ARCH_FILE} + +# Read OpenFPGA simulation settings +read_openfpga_simulation_setting -f ${OPENFPGA_SIM_SETTING_FILE} + +# Annotate the OpenFPGA architecture to VPR data base +# to debug use --verbose options +link_openfpga_arch --sort_gsb_chan_node_in_edges + +# Check and correct any naming conflicts in the BLIF netlist +check_netlist_naming_conflict --fix --report ./netlist_renaming.xml + +# Apply fix-up to Look-Up Table truth tables based on packing results +lut_truth_table_fixup + +# Build the module graph +# - Enabled compression on routing architecture modules +# - Enable pin duplication on grid modules +build_fabric --compress_routing #--verbose + +# Write the fabric hierarchy of module graph to a file +# This is used by hierarchical PnR flows +write_fabric_hierarchy --file ./fabric_hierarchy.txt + +# Repack the netlist to physical pbs +# This must be done before bitstream generator and testbench generation +# Strongly recommend it is done after all the fix-up have been applied +repack #--verbose + +# Build the bitstream +# - Output the fabric-independent bitstream to a file +build_architecture_bitstream --verbose --write_file fabric_independent_bitstream.xml + +# Build fabric-dependent bitstream +build_fabric_bitstream --verbose + +# Write fabric-dependent bitstream +write_fabric_bitstream --file fabric_bitstream.bit --format plain_text + +# Write the Verilog netlist for FPGA fabric +# - Enable the use of explicit port mapping in Verilog netlist +write_fabric_verilog --file ./SRC --explicit_port_mapping --include_timing --verbose + +# Write template testbenches +write_testbench_template --file ./TESTBENCH/template_testbench.v --top_module template_top_tb ${OPENFPGA_VERILOG_PORT_MAPPING} +write_testbench_io_connection --file ./TESTBENCH/io_connections.v --pin_constraints_file ${OPENFPGA_PIN_CONSTRAINTS_FILE} --bus_group_file ${OPENFPGA_BUS_GROUP_FILE} + +# Finish and exit OpenFPGA +exit + +# Note : +# To run verification at the end of the flow maintain source in ./SRC directory diff --git a/openfpga_flow/regression_test_scripts/basic_reg_test.sh b/openfpga_flow/regression_test_scripts/basic_reg_test.sh index dd945b427..e240b64dd 100755 --- a/openfpga_flow/regression_test_scripts/basic_reg_test.sh +++ b/openfpga_flow/regression_test_scripts/basic_reg_test.sh @@ -99,6 +99,7 @@ run-task basic_tests/generate_fabric $@ echo -e "Testing Verilog testbench generation only"; run-task basic_tests/generate_testbench $@ +run-task basic_tests/generate_template_testbench $@ echo -e "Testing separated Verilog fabric netlists and testbench locations"; run-task basic_tests/custom_fabric_netlist_location $@ diff --git a/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/counter8_bus_group.xml b/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/counter8_bus_group.xml new file mode 100644 index 000000000..a0fd22f77 --- /dev/null +++ b/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/counter8_bus_group.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/mac4_bus_group.xml b/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/mac4_bus_group.xml new file mode 100644 index 000000000..50a42a566 --- /dev/null +++ b/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/mac4_bus_group.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/pin_constraints_dummy.xml b/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/pin_constraints_dummy.xml new file mode 100644 index 000000000..9d692672b --- /dev/null +++ b/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/pin_constraints_dummy.xml @@ -0,0 +1,5 @@ + + + + diff --git a/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/pin_constraints_reset.xml b/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/pin_constraints_reset.xml new file mode 100644 index 000000000..abcf209f6 --- /dev/null +++ b/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/pin_constraints_reset.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/task.conf b/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/task.conf new file mode 100644 index 000000000..e869ac5a1 --- /dev/null +++ b/openfpga_flow/tasks/basic_tests/generate_template_testbench/config/task.conf @@ -0,0 +1,51 @@ +# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = +# Configuration file for running experiments +# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = +# timeout_each_job : FPGA Task script splits fpga flow into multiple jobs +# Each job execute fpga_flow script on combination of architecture & benchmark +# timeout_each_job is timeout for each job +# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = + +[GENERAL] +run_engine=openfpga_shell +power_tech_file = ${PATH:OPENFPGA_PATH}/openfpga_flow/tech/PTM_45nm/45nm.xml +power_analysis = false +spice_output=false +verilog_output=true +timeout_each_job = 20*60 +fpga_flow=yosys_vpr + +[OpenFPGA_SHELL] +openfpga_shell_template=${PATH:OPENFPGA_PATH}/openfpga_flow/openfpga_shell_scripts/write_testbench_template_example_script.openfpga +openfpga_arch_file=${PATH:OPENFPGA_PATH}/openfpga_flow/openfpga_arch/k6_frac_N10_adder_chain_dpram8K_dsp36_fracff_40nm_openfpga.xml +openfpga_sim_setting_file=${PATH:OPENFPGA_PATH}/openfpga_flow/openfpga_simulation_settings/fixed_sim_openfpga.xml +openfpga_verilog_port_mapping=--explicit_port_mapping + +[ARCHITECTURES] +arch0=${PATH:OPENFPGA_PATH}/openfpga_flow/vpr_arch/k6_frac_N10_tileable_adder_chain_dpram8K_dsp36_fracff_40nm.xml + +[BENCHMARKS] +bench0=${PATH:OPENFPGA_PATH}/openfpga_flow/benchmarks/micro_benchmark/counters/counter_8bit_async_reset/counter.v +bench1=${PATH:OPENFPGA_PATH}/openfpga_flow/benchmarks/micro_benchmark/mac/mac_4/mac_4.v + +[SYNTHESIS_PARAM] +# Yosys script parameters +bench_yosys_cell_sim_verilog_common=${PATH:OPENFPGA_PATH}/openfpga_flow/openfpga_yosys_techlib/k6_frac_N10_tileable_adder_chain_dpram8K_dsp36_fracff_40nm_cell_sim.v +bench_yosys_dff_map_verilog_common=${PATH:OPENFPGA_PATH}/openfpga_flow/openfpga_yosys_techlib/k6_frac_N10_tileable_adder_chain_dpram8K_dsp36_fracff_40nm_dff_map.v +bench_yosys_bram_map_rules_common=${PATH:OPENFPGA_PATH}/openfpga_flow/openfpga_yosys_techlib/k6_frac_N10_tileable_adder_chain_dpram8K_dsp36_40nm_bram.txt +bench_yosys_bram_map_verilog_common=${PATH:OPENFPGA_PATH}/openfpga_flow/openfpga_yosys_techlib/k6_frac_N10_tileable_adder_chain_dpram8K_dsp36_40nm_bram_map.v +bench_yosys_dsp_map_verilog_common=${PATH:OPENFPGA_PATH}/openfpga_flow/openfpga_yosys_techlib/k6_frac_N10_tileable_adder_chain_dpram8K_dsp36_40nm_dsp_map.v +bench_yosys_dsp_map_parameters_common=-D DSP_A_MAXWIDTH=36 -D DSP_B_MAXWIDTH=36 -D DSP_A_MINWIDTH=2 -D DSP_B_MINWIDTH=2 -D DSP_NAME=mult_36x36 +bench_read_verilog_options_common = -nolatches +bench_yosys_common=${PATH:OPENFPGA_PATH}/openfpga_flow/misc/ys_tmpl_yosys_vpr_dff_flow.ys +bench_yosys_rewrite_common=${PATH:OPENFPGA_PATH}/openfpga_flow/misc/ys_tmpl_yosys_vpr_flow_with_rewrite.ys + +bench0_top = counter +bench0_openfpga_pin_constraints_file=${PATH:TASK_DIR}/config/pin_constraints_reset.xml +bench0_openfpga_bus_group_file=${PATH:TASK_DIR}/config/counter8_bus_group.xml + +bench1_top = mac_4 +bench1_openfpga_pin_constraints_file=${PATH:TASK_DIR}/config/pin_constraints_dummy.xml +bench1_openfpga_bus_group_file=${PATH:TASK_DIR}/config/mac4_bus_group.xml + +[SCRIPT_PARAM_MIN_ROUTE_CHAN_WIDTH]