├── memory_bottleneck ├── result.golden.dat ├── mem_bottleneck.cpp ├── x_hls.tcl ├── mem_bottleneck.h └── mem_bottleneck_test.cpp ├── coding_free_running_pipeline ├── result.golden.dat ├── x_hls.tcl └── free_pipe_mult.h ├── coding_pointer_cast_native ├── result.golden.dat ├── x_hls.tcl └── pointer_cast_native.h ├── memory_bottleneck_resolved ├── result.golden.dat ├── x_hls.tcl ├── mem_bottleneck_resolved.h ├── mem_bottleneck_resolved.cpp └── mem_bottleneck_resolved_test.cpp ├── coding_pointer_arith ├── result.golden.dat ├── pointer_arith.h ├── pointer_arith.c ├── x_hls.tcl └── pointer_arith_test.c ├── coding_pointer_basic ├── result.golden.dat ├── pointer_basic.h └── x_hls.tcl ├── coding_pointer_stream_good ├── result.golden.dat ├── x_hls.tcl ├── pointer_stream_good.h └── pointer_stream_good.c ├── images └── logo.gif ├── coding_pointer_multi ├── result.golden.dat ├── x_hls.tcl ├── pointer_multi.h └── pointer_multi.c ├── coding_pointer_stream_better ├── result.golden.dat ├── x_hls.tcl ├── pointer_stream_better.h └── pointer_stream_better.c ├── memory_ultraram ├── result.golden.dat ├── x_hls.tcl ├── resource_uram.cpp └── resource_uram.h ├── memory_ecc_flags ├── result.dat ├── result.golden.dat ├── ecc_flags.h ├── x_hls.tcl └── ecc_flags.cpp ├── misc_rtl_as_blackbox ├── result.golden.dat ├── x_hls.tcl ├── example.h ├── rtl_model.cpp ├── example.cpp └── example_test.cpp ├── coding_pointer_double ├── result.golden.dat ├── pointer_double.h ├── x_hls.tcl └── pointer_double.c ├── coding_function_instantiate ├── result.golden.dat ├── README ├── example.h ├── x_hls.tcl ├── example.cpp └── example_test.cpp ├── algorithm_fir_systolic_scalar ├── result.golden.dat ├── x_hls.tcl ├── filter_scalar.h ├── filter_scalar_test.cpp └── filter_scalar.cpp ├── coding_loop_perfect ├── result.golden.dat ├── x_hls.tcl ├── loop_perfect.h ├── loop_perfect.cpp └── loop_perfect_test.cpp ├── coding_loop_imperfect ├── result.golden.dat ├── x_hls.tcl ├── loop_imperfect.h ├── loop_imperfect.cpp └── loop_imperfect_test.cpp ├── coding_loop_pipeline ├── result.golden.dat ├── x_hls.tcl ├── loop_pipeline.cpp ├── loop_pipeline.h └── loop_pipeline_test.cpp ├── interface_axi_stream_complex_tlast ├── example.h ├── README ├── x_hls.tcl └── example.cpp ├── coding_loop_max_bound_trick ├── result.golden.dat ├── x_hls.tcl ├── loop_max_bounds.cpp ├── loop_max_bounds.h └── loop_max_bounds_test.cpp ├── coding_loop_variable_bound ├── result.golden.dat ├── loop_var.cpp ├── x_hls.tcl ├── loop_var.h └── loop_var_test.cpp ├── coding_arbitrary_precision_casting ├── result.golden.dat ├── arbitrary_precision_casting.cpp ├── x_hls.tcl ├── arbitrary_precision_casting.h └── arbitrary_precision_casting_test.cpp ├── coding_malloc_removed ├── result.golden.dat ├── x_hls.tcl └── malloc_removed.h ├── coding_loop_labels ├── README ├── x_hls.tcl └── example_test.cpp ├── interface_axi_lite ├── README ├── x_hls.tcl ├── example.cpp └── example_test.cpp ├── interface_axi_master ├── README ├── x_hls.tcl ├── example.cpp └── example_test.cpp ├── coding_loop_functions ├── result.golden.dat ├── x_hls.tcl ├── loop_functions.h ├── loop_functions.cpp └── loop_functions_test.cpp ├── coding_loop_sequential ├── result.golden.dat ├── x_hls.tcl ├── loop_sequential.h ├── loop_sequential.cpp └── loop_sequential_test.cpp ├── coding_loop_sequential_dataflow ├── result.golden.dat ├── x_hls.tcl ├── loop_sequential.h ├── loop_sequential.cpp └── loop_sequential_test.cpp ├── interface_axi_stream_side_channel_data ├── README ├── x_hls.tcl ├── example.cpp └── example_test.cpp ├── coding_arbitrary_precision_arith ├── result.golden.dat ├── x_hls.tcl ├── cpp_ap_int_arith.cpp └── cpp_ap_int_arith.h ├── coding_hierarchy_func ├── tb_data │ ├── outD.golden.dat │ └── outC.golden.dat ├── x_hls.tcl ├── hier_func.h └── hier_func.cpp ├── coding_loop_sequential_assert ├── result.golden.dat ├── x_hls.tcl ├── loop_sequential_assert.h └── loop_sequential_assert.cpp ├── coding_hierarchy_func2 ├── tb_data │ ├── outD.golden.dat │ └── outC.golden.dat ├── x_hls.tcl ├── hier_func2.h └── hier_func2.cpp ├── coding_hierarchy_func3 ├── tb_data │ ├── outD.golden.dat │ └── outC.golden.dat └── x_hls.tcl ├── coding_hierarchy_func4 ├── tb_data │ ├── outD.golden.dat │ └── outC.golden.dat ├── x_hls.tcl └── hier_func4.h ├── interface_axi_stream_no_side_channel_data ├── README ├── example.cpp ├── x_hls.tcl └── example_test.cpp ├── algorithm_floating_mult_power_of_2 ├── README └── x_hls.tcl ├── coding_vectorized ├── README ├── x_hls.tcl ├── example_test.cpp └── run_hls.tcl ├── algorithm_2D_convolution_linebuffer ├── README ├── x_hls.tcl └── convolution.h ├── coding_remerge_ii2to1 ├── example.h ├── x_hls.tcl └── example_test.cpp ├── memory_rom_lookup_table_math ├── result.golden.dat ├── x_hls.tcl ├── lookup_math.h ├── lookup_math.cpp └── lookup_math_test.cpp ├── coding_fixed_point ├── cpp_ap_fixed.cpp ├── x_hls.tcl └── cpp_ap_fixed.h ├── algorithm_fixed_point_sqrt ├── fxp_sqrt_top.cpp ├── x_hls.tcl ├── fxp_sqrt_top.h └── README ├── memory_rom_lookup_table ├── result.golden.dat ├── x_hls.tcl ├── lookup.cpp ├── lookup.h └── lookup_test.cpp ├── algorithm_template_fir_filter ├── cpp_FIR.cpp ├── cpp_FIR.inc ├── x_hls.tcl └── cpp_FIR_test.cpp ├── coding_C++_templates ├── x_hls.tcl ├── cpp_template.h └── cpp_template.cpp ├── coding_dataflow_rewind ├── x_hls.tcl ├── result.golden.dat └── diamond.h ├── interface_hls_stream ├── x_hls.tcl └── bytestrm_dwordproc.h ├── memory_rom_coef_filter ├── x_hls.tcl └── README ├── algorithm_window_function_float ├── x_hls.tcl ├── window_fn_top.h └── window_fn_top.cpp ├── interface_axi_stream_to_master ├── x_hls.tcl ├── example_test.cpp └── example.h └── algorithm_window_function_fixed_point ├── x_hls.tcl ├── README ├── window_fn_top.h └── window_fn_top.cpp /memory_bottleneck/result.golden.dat: -------------------------------------------------------------------------------- 1 | -189 2 | -------------------------------------------------------------------------------- /coding_free_running_pipeline/result.golden.dat: -------------------------------------------------------------------------------- 1 | 84 2 | -------------------------------------------------------------------------------- /coding_pointer_cast_native/result.golden.dat: -------------------------------------------------------------------------------- 1 | -7089 2 | -------------------------------------------------------------------------------- /memory_bottleneck_resolved/result.golden.dat: -------------------------------------------------------------------------------- 1 | -189 2 | -------------------------------------------------------------------------------- /coding_pointer_arith/result.golden.dat: -------------------------------------------------------------------------------- 1 | 1 2 | 3 3 | 6 4 | 10 5 | -------------------------------------------------------------------------------- /coding_pointer_basic/result.golden.dat: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 3 4 | 6 5 | -------------------------------------------------------------------------------- /coding_pointer_stream_good/result.golden.dat: -------------------------------------------------------------------------------- 1 | Din Dout 2 | 0 1 3 | 1 6 4 | 2 5 | 3 6 | -------------------------------------------------------------------------------- /images/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jefflieu/HLS-Tiny-Tutorials/HEAD/images/logo.gif -------------------------------------------------------------------------------- /coding_pointer_multi/result.golden.dat: -------------------------------------------------------------------------------- 1 | 1 2 | 7 3 | 3 4 | 5 5 | 5 6 | 3 7 | 7 8 | 1 9 | -------------------------------------------------------------------------------- /coding_pointer_stream_better/result.golden.dat: -------------------------------------------------------------------------------- 1 | Din Dout 2 | 0 0 3 | 1 4 4 | 2 8 5 | 3 12 6 | -------------------------------------------------------------------------------- /memory_ultraram/result.golden.dat: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 4 4 | 9 5 | 16 6 | 25 7 | 36 8 | 49 9 | 64 10 | 81 11 | -------------------------------------------------------------------------------- /memory_ecc_flags/result.dat: -------------------------------------------------------------------------------- 1 | 0 2 | 200 3 | 533 4 | 900 5 | 1280 6 | 1666 7 | 2057 8 | 2450 9 | 2844 10 | 3240 -------------------------------------------------------------------------------- /memory_ecc_flags/result.golden.dat: -------------------------------------------------------------------------------- 1 | 0 2 | 200 3 | 533 4 | 900 5 | 1280 6 | 1666 7 | 2057 8 | 2450 9 | 2844 10 | 3240 -------------------------------------------------------------------------------- /misc_rtl_as_blackbox/result.golden.dat: -------------------------------------------------------------------------------- 1 | -20 2 | -6 3 | 8 4 | 22 5 | 36 6 | 50 7 | 64 8 | 78 9 | 92 10 | 106 11 | -------------------------------------------------------------------------------- /coding_pointer_double/result.golden.dat: -------------------------------------------------------------------------------- 1 | 0 2 | 27 3 | 18 4 | 35 5 | 20 6 | 35 7 | 25 8 | 36 9 | 9 10 | 28 11 | -------------------------------------------------------------------------------- /coding_function_instantiate/result.golden.dat: -------------------------------------------------------------------------------- 1 | 0 1 100 2 | 1 2 101 3 | 2 3 102 4 | 3 4 103 5 | 4 5 104 6 | 5 6 105 7 | 6 7 106 8 | 7 8 107 9 | 8 9 108 10 | 9 10 109 11 | -------------------------------------------------------------------------------- /algorithm_fir_systolic_scalar/result.golden.dat: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 0 4 | 0 5 | 0 6 | 0 7 | 0 8 | 10 9 | 16 10 | 13 11 | 11 12 | 13 13 | 18 14 | 11 15 | 3 16 | 2 17 | 3 18 | 5 19 | -1 20 | -11 21 | -------------------------------------------------------------------------------- /coding_loop_perfect/result.golden.dat: -------------------------------------------------------------------------------- 1 | 11 2 | 0 3 | 11 4 | 0 5 | 11 6 | 0 7 | 11 8 | 0 9 | 11 10 | 0 11 | 11 12 | 0 13 | 11 14 | 0 15 | 11 16 | 0 17 | 11 18 | 0 19 | 11 20 | 0 21 | -------------------------------------------------------------------------------- /coding_loop_imperfect/result.golden.dat: -------------------------------------------------------------------------------- 1 | 11 2 | 0 3 | 11 4 | 0 5 | 11 6 | 0 7 | 11 8 | 0 9 | 11 10 | 0 11 | 11 12 | 0 13 | 11 14 | 0 15 | 11 16 | 0 17 | 11 18 | 0 19 | 11 20 | 0 21 | -------------------------------------------------------------------------------- /coding_loop_pipeline/result.golden.dat: -------------------------------------------------------------------------------- 1 | 11780 2 | 2280 3 | -4180 4 | 16720 5 | -7980 6 | -5320 7 | 380 8 | -15200 9 | -3420 10 | -12920 11 | -19380 12 | 1520 13 | -23180 14 | -20520 15 | -14820 16 | -30400 17 | -18620 18 | -28120 19 | -34580 20 | -13680 21 | -------------------------------------------------------------------------------- /interface_axi_stream_complex_tlast/example.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "ap_axi_sdata.h" 3 | #include "hls_stream.h" 4 | 5 | #define SIZE 5 6 | 7 | typedef hls::axis, 0, 0, 0> data_t; 8 | typedef hls::stream mystream; 9 | 10 | extern void example(mystream &A, mystream &B); 11 | -------------------------------------------------------------------------------- /coding_loop_max_bound_trick/result.golden.dat: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 1 4 | 3 5 | 6 6 | 10 7 | 15 8 | 21 9 | 28 10 | 36 11 | 45 12 | 55 13 | 66 14 | 78 15 | 91 16 | 105 17 | 120 18 | 136 19 | 153 20 | 171 21 | 190 22 | 210 23 | 231 24 | 253 25 | 276 26 | 300 27 | 325 28 | 351 29 | 378 30 | 406 31 | 435 32 | 465 33 | -------------------------------------------------------------------------------- /coding_loop_variable_bound/result.golden.dat: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 1 4 | 3 5 | 6 6 | 10 7 | 15 8 | 21 9 | 28 10 | 36 11 | 45 12 | 55 13 | 66 14 | 78 15 | 91 16 | 105 17 | 120 18 | 136 19 | 153 20 | 171 21 | 190 22 | 210 23 | 231 24 | 253 25 | 276 26 | 300 27 | 325 28 | 351 29 | 378 30 | 406 31 | 435 32 | 465 33 | -------------------------------------------------------------------------------- /coding_arbitrary_precision_casting/result.golden.dat: -------------------------------------------------------------------------------- 1 | 4294967296 2 | 4225827840 3 | 4152496128 4 | 4074972160 5 | 3993255936 6 | 3907347456 7 | 3817246720 8 | 3722953728 9 | 3624468480 10 | 3521790976 11 | 3414921216 12 | 3303859200 13 | 3188604928 14 | 3069158400 15 | 2945519616 16 | 2817688576 17 | 2685665280 18 | 2549449728 19 | 2409041920 20 | 2264441856 21 | -------------------------------------------------------------------------------- /coding_malloc_removed/result.golden.dat: -------------------------------------------------------------------------------- 1 | 1655 2 | 1805 3 | 1956 4 | 2108 5 | 2261 6 | 2414 7 | 2568 8 | 2723 9 | 2879 10 | 3035 11 | 3192 12 | 3350 13 | 3509 14 | 3668 15 | 3828 16 | 3989 17 | 4151 18 | 4313 19 | 4476 20 | 4640 21 | 4805 22 | 4970 23 | 5136 24 | 5303 25 | 5471 26 | 5639 27 | 5808 28 | 5978 29 | 6149 30 | 6320 31 | 6492 32 | 6665 33 | -------------------------------------------------------------------------------- /coding_loop_labels/README: -------------------------------------------------------------------------------- 1 | /* 2 | * Example C code for using loop labels in Vitis HLS 3 | */ 4 | 5 | Files Included in this Package 6 | ================================================== 7 | example_test.cpp 8 | example.cpp 9 | README 10 | 11 | Running the Design (edit x_hls.tcl to run synthesis) 12 | ================================================= 13 | vitis_hls -f run_hls.tcl 14 | -------------------------------------------------------------------------------- /coding_function_instantiate/README: -------------------------------------------------------------------------------- 1 | /* 2 | * Example C++ code for the FUNCTION_INSTANTIATE pragma in Vitis HLS 3 | */ 4 | 5 | Files included in this package 6 | ================================================== 7 | example_test.cpp 8 | example.cpp 9 | README 10 | 11 | Running the design (edit x_hls.tcl to run synthesis) 12 | ================================================= 13 | vitis_hls -f run_hls.tcl 14 | -------------------------------------------------------------------------------- /interface_axi_lite/README: -------------------------------------------------------------------------------- 1 | /* 2 | * Example C++ code for implementing an AXI4-lite interface in Vitis HLS 3 | */ 4 | 5 | Files included in this package 6 | ================================================== 7 | example_test.cpp 8 | example.cpp 9 | README 10 | 11 | Running the design (edit x_hls.tcl to run synthesis) 12 | ================================================= 13 | vitis_hls -f run_hls.tcl 14 | -------------------------------------------------------------------------------- /interface_axi_master/README: -------------------------------------------------------------------------------- 1 | /* 2 | * Example C++ code for implementing an AXI4-master interface in Vitis HLS 3 | */ 4 | 5 | Files Included in this Package 6 | ================================================== 7 | example_test.cpp 8 | example.cpp 9 | README 10 | 11 | Running the Design (edit x_hls.tcl to run synthesis) 12 | ================================================= 13 | vitis_hls -f run_hls.tcl 14 | -------------------------------------------------------------------------------- /coding_loop_functions/result.golden.dat: -------------------------------------------------------------------------------- 1 | 0 31 2 | 1 61 3 | 3 90 4 | 6 118 5 | 10 145 6 | 15 171 7 | 21 196 8 | 28 220 9 | 36 243 10 | 45 265 11 | 55 286 12 | 66 306 13 | 78 325 14 | 91 343 15 | 105 360 16 | 120 376 17 | 136 391 18 | 153 405 19 | 171 418 20 | 190 430 21 | 210 441 22 | 231 451 23 | 253 460 24 | 276 468 25 | 300 475 26 | 325 481 27 | 351 486 28 | 378 490 29 | 406 493 30 | 435 495 31 | 465 496 32 | -------------------------------------------------------------------------------- /coding_loop_sequential/result.golden.dat: -------------------------------------------------------------------------------- 1 | 0 31 2 | 1 61 3 | 3 90 4 | 6 118 5 | 10 145 6 | 15 171 7 | 21 196 8 | 28 220 9 | 36 243 10 | 45 265 11 | 55 286 12 | 66 306 13 | 78 325 14 | 91 343 15 | 105 360 16 | 120 376 17 | 136 391 18 | 153 405 19 | 171 418 20 | 190 430 21 | 210 441 22 | 231 451 23 | 253 460 24 | 276 468 25 | 300 475 26 | 325 481 27 | 351 486 28 | 378 490 29 | 406 493 30 | 435 495 31 | 465 496 32 | -------------------------------------------------------------------------------- /coding_loop_sequential_dataflow/result.golden.dat: -------------------------------------------------------------------------------- 1 | 0 31 2 | 1 61 3 | 3 90 4 | 6 118 5 | 10 145 6 | 15 171 7 | 21 196 8 | 28 220 9 | 36 243 10 | 45 265 11 | 55 286 12 | 66 306 13 | 78 325 14 | 91 343 15 | 105 360 16 | 120 376 17 | 136 391 18 | 153 405 19 | 171 418 20 | 190 430 21 | 210 441 22 | 231 451 23 | 253 460 24 | 276 468 25 | 300 475 26 | 325 481 27 | 351 486 28 | 378 490 29 | 406 493 30 | 435 495 31 | 465 496 32 | -------------------------------------------------------------------------------- /interface_axi_stream_side_channel_data/README: -------------------------------------------------------------------------------- 1 | /* 2 | * Example C++ code for implementing an AXI stream interface in Vitis HLS using 3 | * all side channels. 4 | */ 5 | 6 | Files Included in this Package 7 | ================================================== 8 | example_test.cpp 9 | example.cpp 10 | README 11 | 12 | Running the Design (edit x_hls.tcl to run synthesis) 13 | ================================================= 14 | vitis_hls -f run_hls.tcl 15 | -------------------------------------------------------------------------------- /coding_arbitrary_precision_arith/result.golden.dat: -------------------------------------------------------------------------------- 1 | 2*23=46; 23+2=25; 234/2=117; 2345 mod 2=1; 2 | 3*24=72; 24+3=27; 235/3=78; 2346 mod 3=0; 3 | 4*25=100; 25+4=29; 236/4=59; 2347 mod 4=3; 4 | 5*26=130; 26+5=31; 237/5=47; 2348 mod 5=3; 5 | 6*27=162; 27+6=33; 238/6=39; 2349 mod 6=3; 6 | 7*28=196; 28+7=35; 239/7=34; 2350 mod 7=5; 7 | 8*29=232; 29+8=37; 240/8=30; 2351 mod 8=7; 8 | 9*30=270; 30+9=39; 241/9=26; 2352 mod 9=3; 9 | 10*31=310; 31+10=41; 242/10=24; 2353 mod 10=3; 10 | -------------------------------------------------------------------------------- /coding_hierarchy_func/tb_data/outD.golden.dat: -------------------------------------------------------------------------------- 1 | 183 2 | -6069 3 | -443 4 | -4089 5 | -3692 6 | -3023 7 | -3275 8 | 3908 9 | -175 10 | -932 11 | 180 12 | 5397 13 | 135 14 | 1996 15 | 132 16 | -2406 17 | -6814 18 | 3916 19 | 4194 20 | 3694 21 | -92 22 | -4146 23 | -1163 24 | 3516 25 | 2595 26 | 4656 27 | -985 28 | 308 29 | 519 30 | 4044 31 | -475 32 | 4513 33 | -1657 34 | 4275 35 | 5939 36 | -3829 37 | 4955 38 | -3159 39 | 2906 40 | 0 41 | -------------------------------------------------------------------------------- /coding_loop_sequential_assert/result.golden.dat: -------------------------------------------------------------------------------- 1 | 0 0 31 2 | 1 1 61 3 | 2 3 90 4 | 3 6 118 5 | 4 10 145 6 | 5 15 171 7 | 6 21 196 8 | 7 28 220 9 | 8 36 243 10 | 9 45 265 11 | 10 55 286 12 | 11 66 306 13 | 12 78 325 14 | 13 91 343 15 | 14 105 360 16 | 15 120 376 17 | 16 136 18 | 17 153 19 | 18 171 20 | 19 190 21 | 20 210 22 | 21 231 23 | 22 253 24 | 23 276 25 | 24 300 26 | 25 325 27 | 26 351 28 | 27 378 29 | 28 406 30 | 29 435 31 | 30 465 32 | -------------------------------------------------------------------------------- /coding_hierarchy_func2/tb_data/outD.golden.dat: -------------------------------------------------------------------------------- 1 | 183 2 | -6069 3 | -443 4 | -4089 5 | -3692 6 | -3023 7 | -3275 8 | 3908 9 | -175 10 | -932 11 | 180 12 | 5397 13 | 135 14 | 1996 15 | 132 16 | -2406 17 | -6814 18 | 3916 19 | 4194 20 | 3694 21 | -92 22 | -4146 23 | -1163 24 | 3516 25 | 2595 26 | 4656 27 | -985 28 | 308 29 | 519 30 | 4044 31 | -475 32 | 4513 33 | -1657 34 | 4275 35 | 5939 36 | -3829 37 | 4955 38 | -3159 39 | 2906 40 | 0 41 | -------------------------------------------------------------------------------- /coding_hierarchy_func3/tb_data/outD.golden.dat: -------------------------------------------------------------------------------- 1 | 183 2 | -6069 3 | -443 4 | -4089 5 | -3692 6 | -3023 7 | -3275 8 | 3908 9 | -175 10 | -932 11 | 180 12 | 5397 13 | 135 14 | 1996 15 | 132 16 | -2406 17 | -6814 18 | 3916 19 | 4194 20 | 3694 21 | -92 22 | -4146 23 | -1163 24 | 3516 25 | 2595 26 | 4656 27 | -985 28 | 308 29 | 519 30 | 4044 31 | -475 32 | 4513 33 | -1657 34 | 4275 35 | 5939 36 | -3829 37 | 4955 38 | -3159 39 | 2906 40 | 0 41 | -------------------------------------------------------------------------------- /coding_hierarchy_func4/tb_data/outD.golden.dat: -------------------------------------------------------------------------------- 1 | 183 2 | -6069 3 | -443 4 | -4089 5 | -3692 6 | -3023 7 | -3275 8 | 3908 9 | -175 10 | -932 11 | 180 12 | 5397 13 | 135 14 | 1996 15 | 132 16 | -2406 17 | -6814 18 | 3916 19 | 4194 20 | 3694 21 | -92 22 | -4146 23 | -1163 24 | 3516 25 | 2595 26 | 4656 27 | -985 28 | 308 29 | 519 30 | 4044 31 | -475 32 | 4513 33 | -1657 34 | 4275 35 | 5939 36 | -3829 37 | 4955 38 | -3159 39 | 2906 40 | 0 41 | -------------------------------------------------------------------------------- /interface_axi_stream_complex_tlast/README: -------------------------------------------------------------------------------- 1 | /* 2 | * Example C++ code for implementing an AXI stream interface in Vitis HLS using 3 | * only the TDATA field and AXI handshake signals. 4 | */ 5 | 6 | Files Included in this Package 7 | ================================================== 8 | example_test.cpp 9 | example.cpp 10 | README 11 | 12 | Running the Design (edit x_hls.tcl to run synthesis) 13 | ================================================= 14 | vitis_hls -f run_hls.tcl 15 | -------------------------------------------------------------------------------- /interface_axi_stream_no_side_channel_data/README: -------------------------------------------------------------------------------- 1 | /* 2 | * Example C++ code for implementing an AXI stream interface in Vitis HLS using 3 | * only the TDATA field and AXI handshake signals. 4 | */ 5 | 6 | Files Included in this Package 7 | ================================================== 8 | example_test.cpp 9 | example.cpp 10 | README 11 | 12 | Running the Design (edit x_hls.tcl to run synthesis) 13 | ================================================= 14 | vitis_hls -f run_hls.tcl 15 | -------------------------------------------------------------------------------- /coding_hierarchy_func/tb_data/outC.golden.dat: -------------------------------------------------------------------------------- 1 | 6090 2 | 17776 3 | 20035 4 | 13473 5 | 15975 6 | 20562 7 | 22515 8 | 8872 9 | 24798 10 | 4219 11 | 30146 12 | 19648 13 | 18393 14 | 11026 15 | 6113 16 | 11514 17 | 15586 18 | 22773 19 | 11500 20 | 15208 21 | 3448 22 | 22834 23 | 10783 24 | 16083 25 | 16633 26 | 16474 27 | 27031 28 | 23792 29 | 4684 30 | 21825 31 | 21869 32 | 12624 33 | 26672 34 | 18055 35 | 17186 36 | 8714 37 | 15237 38 | 12399 39 | 23972 40 | 0 41 | -------------------------------------------------------------------------------- /coding_hierarchy_func2/tb_data/outC.golden.dat: -------------------------------------------------------------------------------- 1 | 6090 2 | 17776 3 | 20035 4 | 13473 5 | 15975 6 | 20562 7 | 22515 8 | 8872 9 | 24798 10 | 4219 11 | 30146 12 | 19648 13 | 18393 14 | 11026 15 | 6113 16 | 11514 17 | 15586 18 | 22773 19 | 11500 20 | 15208 21 | 3448 22 | 22834 23 | 10783 24 | 16083 25 | 16633 26 | 16474 27 | 27031 28 | 23792 29 | 4684 30 | 21825 31 | 21869 32 | 12624 33 | 26672 34 | 18055 35 | 17186 36 | 8714 37 | 15237 38 | 12399 39 | 23972 40 | 0 41 | -------------------------------------------------------------------------------- /coding_hierarchy_func3/tb_data/outC.golden.dat: -------------------------------------------------------------------------------- 1 | 6090 2 | 17776 3 | 20035 4 | 13473 5 | 15975 6 | 20562 7 | 22515 8 | 8872 9 | 24798 10 | 4219 11 | 30146 12 | 19648 13 | 18393 14 | 11026 15 | 6113 16 | 11514 17 | 15586 18 | 22773 19 | 11500 20 | 15208 21 | 3448 22 | 22834 23 | 10783 24 | 16083 25 | 16633 26 | 16474 27 | 27031 28 | 23792 29 | 4684 30 | 21825 31 | 21869 32 | 12624 33 | 26672 34 | 18055 35 | 17186 36 | 8714 37 | 15237 38 | 12399 39 | 23972 40 | 0 41 | -------------------------------------------------------------------------------- /coding_hierarchy_func4/tb_data/outC.golden.dat: -------------------------------------------------------------------------------- 1 | 6090 2 | 17776 3 | 20035 4 | 13473 5 | 15975 6 | 20562 7 | 22515 8 | 8872 9 | 24798 10 | 4219 11 | 30146 12 | 19648 13 | 18393 14 | 11026 15 | 6113 16 | 11514 17 | 15586 18 | 22773 19 | 11500 20 | 15208 21 | 3448 22 | 22834 23 | 10783 24 | 16083 25 | 16633 26 | 16474 27 | 27031 28 | 23792 29 | 4684 30 | 21825 31 | 21869 32 | 12624 33 | 26672 34 | 18055 35 | 17186 36 | 8714 37 | 15237 38 | 12399 39 | 23972 40 | 0 41 | -------------------------------------------------------------------------------- /algorithm_floating_mult_power_of_2/README: -------------------------------------------------------------------------------- 1 | Files Included in this Package 2 | ================================================== 3 | fp_mul_pow2.c - Implementation source file (top-level for example) 4 | fp_mul_pow2.h - Header file w/ function prototypes 5 | fp_mul_pow2_test.cpp - Test program which for SW model validation & RTL co-sim 6 | run_hls.tcl - HLS run script 7 | x_hls.tcl - Auxilary script setting run-level 8 | README - This file 9 | 10 | Running the design 11 | ================================================= 12 | vitis_hls -f run_hls.tcl -------------------------------------------------------------------------------- /coding_vectorized/README: -------------------------------------------------------------------------------- 1 | /* 2 | * Example C++ code for using vector data type in Vitis HLS. 3 | * They can be declared using the C++ attribute vector_size or 4 | * through the hls_vector.h library which also supports HLS arbitrary precision types. 5 | * Requires C++14. 6 | */ 7 | 8 | Files Included in this Package 9 | ================================================== 10 | example_test.cpp 11 | example.cpp 12 | README 13 | run_hls.tcl 14 | x_hls.tcl 15 | 16 | Running the Design (edit x_hls.tcl to run synthesis) 17 | ================================================= 18 | vitis_hls -f run_hls.tcl 19 | -------------------------------------------------------------------------------- /algorithm_2D_convolution_linebuffer/README: -------------------------------------------------------------------------------- 1 | Example C code for implementing an 2D convolution in HLS 2 | 3 | Files Included in this Package 4 | ============================== 5 | convolution_test.cpp 6 | convolution.cpp 7 | README 8 | 9 | Running the Design (edit x_hls.tcl to specific run steps) 10 | ========================================================= 11 | vitis_hls -f run_hls.tcl 12 | 13 | This design implementation is efficient thanks to: 14 | - The optimal design is filter11x11_strm 15 | - It uses "streams": implements well in hardware 16 | - it shows an example of using a line buffer for efficient storage 17 | - It uses assert statements to state the known limit of loop bounds 18 | 19 | The test case also performs a comparison against the more intuitive coding style in filter11x11_orig -------------------------------------------------------------------------------- /coding_remerge_ii2to1/example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include "ap_int.h" 19 | using namespace hls; 20 | 21 | #include 22 | using namespace std; -------------------------------------------------------------------------------- /memory_ecc_flags/ecc_flags.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define N 10 18 | 19 | using din_t = int; 20 | 21 | void ecc_flags(din_t in1[N], din_t in2[N], const din_t Iter, din_t output[N]); -------------------------------------------------------------------------------- /memory_rom_lookup_table_math/result.golden.dat: -------------------------------------------------------------------------------- 1 | -11039 2 | -21318 3 | -30834 4 | -39584 5 | -47560 6 | -54756 7 | -61173 8 | -66808 9 | -71649 10 | -75710 11 | -78969 12 | -81432 13 | -83096 14 | -83958 15 | -84030 16 | -83280 17 | -81736 18 | -79362 19 | -76209 20 | -72220 21 | -67431 22 | -61842 23 | -55430 24 | -48216 25 | -40175 26 | -31356 27 | -21708 28 | -11256 29 | 0 30 | 12060 31 | 24924 32 | 38592 33 | 53031 34 | 68306 35 | 84350 36 | 101196 37 | 118807 38 | 137218 39 | 156429 40 | 176360 41 | 197128 42 | 218610 43 | 240886 44 | 263868 45 | 287640 46 | 312156 47 | 337413 48 | 363408 49 | 390089 50 | 417550 51 | 445689 52 | 474552 53 | 504136 54 | 534384 55 | 565290 56 | 596904 57 | 629223 58 | 662128 59 | 695787 60 | 730020 61 | 764879 62 | 800420 63 | 836514 64 | 873280 65 | -------------------------------------------------------------------------------- /coding_function_instantiate/example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | using namespace std; 20 | 21 | void top(char inval1, char inval2, char inval3, 22 | char *outval1, char *outval2, char * outval3); 23 | -------------------------------------------------------------------------------- /coding_pointer_arith/pointer_arith.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _POINTER_ARITH_H_ 18 | #define _POINTER_ARITH_H_ 19 | 20 | #include 21 | 22 | typedef int dio_t; 23 | 24 | void pointer_arith (dio_t *d); 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /coding_pointer_basic/pointer_basic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _POINTER_BASIC_H_ 18 | #define _POINTER_BASIC_H_ 19 | 20 | #include 21 | 22 | typedef int dio_t; 23 | 24 | void pointer_basic (dio_t *d); 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /coding_fixed_point/cpp_ap_fixed.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "cpp_ap_fixed.h" 18 | 19 | dout_t cpp_ap_fixed(din1_t d_in1, din2_t d_in2) { 20 | 21 | static dint_t sum; 22 | sum =+ d_in1; 23 | return sum * d_in2; 24 | } 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /algorithm_fixed_point_sqrt/fxp_sqrt_top.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "fxp_sqrt_top.h" 18 | 19 | out_data_t fxp_sqrt_top(in_data_t& in_val) 20 | { 21 | out_data_t result; 22 | fxp_sqrt(result, in_val); 23 | return result; 24 | } 25 | 26 | 27 | -------------------------------------------------------------------------------- /coding_arbitrary_precision_casting/arbitrary_precision_casting.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "arbitrary_precision_casting.h" 18 | 19 | dout_t arbitrary_precision_casting(din_t a,din_t b) { 20 | 21 | return (dout_t)a * (dout_t)b; 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /coding_pointer_arith/pointer_arith.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "pointer_arith.h" 18 | 19 | void pointer_arith (dio_t *d) { 20 | static int acc = 0; 21 | int i; 22 | 23 | for (i=0;i<4;i++) { 24 | acc += *(d+i+1); 25 | *(d+i) = acc; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /memory_rom_lookup_table/result.golden.dat: -------------------------------------------------------------------------------- 1 | -7168 2 | -21504 3 | -35840 4 | -50176 5 | -64512 6 | -78848 7 | -93184 8 | -107520 9 | -121856 10 | -136192 11 | -150528 12 | -164864 13 | -179200 14 | -193536 15 | -207872 16 | -222208 17 | -236544 18 | -250880 19 | -265216 20 | -279552 21 | -293888 22 | -308224 23 | -322560 24 | -336896 25 | -351232 26 | -365568 27 | -379904 28 | -394240 29 | -408576 30 | -422912 31 | -437248 32 | -451584 33 | -465920 34 | -480256 35 | -494592 36 | -508928 37 | -523264 38 | -537600 39 | -551936 40 | -566272 41 | -580608 42 | -594944 43 | -609280 44 | -623616 45 | -637952 46 | -652288 47 | -666624 48 | -680960 49 | -695296 50 | -709632 51 | -723968 52 | -738304 53 | -752640 54 | -766976 55 | -781312 56 | -795648 57 | -809984 58 | -824320 59 | -838656 60 | -852992 61 | -867328 62 | -881664 63 | -896000 64 | -910336 65 | -------------------------------------------------------------------------------- /coding_pointer_double/pointer_double.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _POINTER_DOUBLE_H_ 18 | #define _POINTER_DOUBLE_H_ 19 | 20 | #include 21 | 22 | 23 | typedef int data_t; 24 | 25 | data_t pointer_double(data_t pos, data_t x, data_t* flag); 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /coding_hierarchy_func/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 -------------------------------------------------------------------------------- /interface_axi_stream_no_side_channel_data/example.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | void example(int A[50], int B[50]) { 18 | #pragma HLS INTERFACE axis port=A 19 | #pragma HLS INTERFACE axis port=B 20 | 21 | int i; 22 | 23 | for(i = 0; i < 50; i++){ 24 | B[i] = A[i] + 5; 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /memory_ultraram/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | -------------------------------------------------------------------------------- /misc_rtl_as_blackbox/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | -------------------------------------------------------------------------------- /algorithm_template_fir_filter/cpp_FIR.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "cpp_FIR.h" 18 | 19 | // Top-level function with class instantiated 20 | data_t cpp_FIR(data_t x) 21 | { 22 | static CFir fir1; 23 | 24 | //cout << fir1; 25 | 26 | return fir1(x); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /memory_bottleneck/mem_bottleneck.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "mem_bottleneck.h" 18 | 19 | dout_t array_mem_bottleneck(din_t mem[N]) { 20 | 21 | dout_t sum=0; 22 | int i; 23 | 24 | SUM_LOOP:for(i=2;i &strm, data_t* out); 27 | -------------------------------------------------------------------------------- /coding_hierarchy_func2/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_hierarchy_func3/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_hierarchy_func4/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_loop_functions/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_loop_imperfect/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_loop_pipeline/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_loop_sequential/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_malloc_removed/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_pointer_arith/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_pointer_basic/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_pointer_double/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_pointer_multi/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_remerge_ii2to1/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /interface_axi_master/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /interface_axi_stream_complex_tlast/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | -------------------------------------------------------------------------------- /interface_hls_stream/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /memory_rom_coef_filter/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /memory_rom_lookup_table/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /algorithm_fixed_point_sqrt/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /algorithm_template_fir_filter/cpp_FIR.inc: -------------------------------------------------------------------------------- 1 | 396, 2 | 290, 3 | 201, 4 | -65, 5 | -477, 6 | -930, 7 | -1270, 8 | -1351, 9 | -1100, 10 | -563, 11 | 92, 12 | 627, 13 | 830, 14 | 603, 15 | 24, 16 | -664, 17 | -1147, 18 | -1167, 19 | -653, 20 | 230, 21 | 1120, 22 | 1601, 23 | 1391, 24 | 490, 25 | -784, 26 | -1886, 27 | -2269, 28 | -1631, 29 | -99, 30 | 1765, 31 | 3138, 32 | 3269, 33 | 1822, 34 | -885, 35 | -3884, 36 | -5821, 37 | -5415, 38 | -1948, 39 | 4385, 40 | 12423, 41 | 20324, 42 | 26092, 43 | 28204, 44 | 26092, 45 | 20324, 46 | 12423, 47 | 4385, 48 | -1948, 49 | -5415, 50 | -5821, 51 | -3884, 52 | -885, 53 | 1822, 54 | 3269, 55 | 3138, 56 | 1765, 57 | -99, 58 | -1631, 59 | -2269, 60 | -1886, 61 | -784, 62 | 490, 63 | 1391, 64 | 1601, 65 | 1120, 66 | 230, 67 | -653, 68 | -1167, 69 | -1147, 70 | -664, 71 | 24, 72 | 603, 73 | 830, 74 | 627, 75 | 92, 76 | -563, 77 | -1100, 78 | -1351, 79 | -1270, 80 | -930, 81 | -477, 82 | -65, 83 | 201, 84 | 290, 85 | 396 86 | -------------------------------------------------------------------------------- /algorithm_template_fir_filter/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_function_instantiate/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_loop_max_bound_trick/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_loop_sequential_assert/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_loop_variable_bound/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_pointer_cast_native/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_pointer_stream_better/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_pointer_stream_good/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /memory_bottleneck_resolved/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /memory_rom_lookup_table_math/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /algorithm_floating_mult_power_of_2/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /algorithm_window_function_float/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_arbitrary_precision_arith/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_arbitrary_precision_casting/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_loop_sequential_dataflow/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /interface_axi_stream_to_master/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /algorithm_window_function_fixed_point/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_pointer_stream_good/pointer_stream_good.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _POINTER_STREAM_GOOD_H_ 18 | #define _POINTER_STREAM_GOOD_H_ 19 | 20 | #include 21 | 22 | typedef int din_t; 23 | typedef int dout_t; 24 | 25 | void pointer_stream_good ( volatile dout_t *d_o, volatile din_t *d_i); 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /interface_axi_stream_side_channel_data/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_dataflow_rewind/result.golden.dat: -------------------------------------------------------------------------------- 1 | 25 2 | 40 3 | 55 4 | 70 5 | 85 6 | 100 7 | 115 8 | 130 9 | 145 10 | 160 11 | 175 12 | 190 13 | 205 14 | 220 15 | 235 16 | 250 17 | 9 18 | 24 19 | 39 20 | 54 21 | 69 22 | 84 23 | 99 24 | 114 25 | 129 26 | 144 27 | 159 28 | 174 29 | 189 30 | 204 31 | 219 32 | 234 33 | 249 34 | 8 35 | 23 36 | 38 37 | 53 38 | 68 39 | 83 40 | 98 41 | 113 42 | 128 43 | 143 44 | 158 45 | 173 46 | 188 47 | 203 48 | 218 49 | 233 50 | 248 51 | 7 52 | 22 53 | 37 54 | 52 55 | 67 56 | 82 57 | 97 58 | 112 59 | 127 60 | 142 61 | 157 62 | 172 63 | 187 64 | 202 65 | 217 66 | 232 67 | 247 68 | 6 69 | 21 70 | 36 71 | 51 72 | 66 73 | 81 74 | 96 75 | 111 76 | 126 77 | 141 78 | 156 79 | 171 80 | 186 81 | 201 82 | 216 83 | 231 84 | 246 85 | 5 86 | 20 87 | 35 88 | 50 89 | 65 90 | 80 91 | 95 92 | 110 93 | 125 94 | 140 95 | 155 96 | 170 97 | 185 98 | 200 99 | 215 100 | 230 101 | -------------------------------------------------------------------------------- /coding_hierarchy_func/hier_func.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _HIER_FUNC_H_ 18 | #define _HIER_FUNC_H_ 19 | 20 | #include 21 | 22 | #define NUM_TRANS 40 23 | 24 | typedef int din_t; 25 | typedef int dint_t; 26 | typedef int dout_t; 27 | 28 | void hier_func(din_t A, din_t B, dout_t *C, dout_t *D); 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /coding_loop_pipeline/loop_pipeline.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_pipeline.h" 18 | 19 | dout_t loop_pipeline(din_t A[N]) { 20 | 21 | int i,j; 22 | static dout_t acc; 23 | 24 | LOOP_I:for(i=0; i < 20; i++){ 25 | LOOP_J: for(j=0; j < 20; j++){ 26 | acc += A[j] * i; 27 | } 28 | } 29 | 30 | return acc; 31 | } 32 | -------------------------------------------------------------------------------- /coding_malloc_removed/malloc_removed.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _MALLOC_REMOVED_H_ 18 | #define _MALLOC_REMOVED_H_ 19 | 20 | #include 21 | #define N 32 22 | 23 | typedef int din_t; 24 | typedef long long dout_t; 25 | typedef int dsel_t; 26 | 27 | dout_t malloc_removed(din_t din[N], dsel_t width); 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /interface_axi_stream_no_side_channel_data/x_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Set to 0: to run setup 17 | # Set to 1: to run setup and synthesis 18 | # Set to 2: to run setup, synthesis and RTL simulation 19 | # Set to 3: to run setup, synthesis, RTL simulation and RTL synthesis 20 | # Any other value will run setup only 21 | 22 | set hls_exec 0 23 | 24 | 25 | -------------------------------------------------------------------------------- /coding_hierarchy_func2/hier_func2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _HIER_FUNC2_H_ 18 | #define _HIER_FUNC2_H_ 19 | 20 | #include 21 | 22 | #define NUM_TRANS 40 23 | 24 | typedef int din_t; 25 | typedef int dint_t; 26 | typedef int dout_t; 27 | 28 | void hier_func2(din_t A, din_t B, dout_t *C, dout_t *D); 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /coding_hierarchy_func4/hier_func4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _hier_func4_H_ 18 | #define _hier_func4_H_ 19 | 20 | #include 21 | 22 | #define NUM_TRANS 40 23 | 24 | typedef int din_t; 25 | typedef int dint_t; 26 | typedef int dout_t; 27 | 28 | void hier_func4(din_t A, din_t B, dout_t *C, dout_t *D); 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /coding_pointer_cast_native/pointer_cast_native.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _POINTER_CAST_NATIVE_H_ 18 | #define _POINTER_CAST_NATIVE_H_ 19 | 20 | #include 21 | 22 | #define N 1024 23 | 24 | typedef int data_t; 25 | typedef char dint_t; 26 | 27 | data_t pointer_cast_native (data_t index, data_t A[N]); 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /coding_pointer_multi/pointer_multi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _POINTER_MULTI_H_ 18 | #define _POINTER_MULTI_H_ 19 | 20 | #include 21 | #include 22 | 23 | typedef unsigned char din_t; 24 | typedef int dout_t; 25 | typedef bool sel_t; 26 | 27 | dout_t pointer_multi (bool sel, din_t pos); 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /coding_pointer_stream_better/pointer_stream_better.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _POINTER_STREAM_BETTER_H_ 18 | #define _POINTER_STREAM_BETTER_H_ 19 | 20 | #include 21 | 22 | typedef int din_t; 23 | typedef int dout_t; 24 | 25 | void pointer_stream_better ( volatile dout_t *d_o, volatile din_t *d_i); 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /memory_rom_lookup_table/lookup.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "lookup.h" 18 | 19 | dout_t lookup(din1_t inval, din2_t idx) 20 | { 21 | din1_t lookup_table[256]; 22 | dint_t i; 23 | 24 | for (i = 0; i < 256; i++) { 25 | lookup_table[i] = 256 * (i - 128); 26 | } 27 | 28 | return (dout_t)inval * (dout_t)lookup_table[idx]; 29 | } 30 | -------------------------------------------------------------------------------- /coding_loop_max_bound_trick/loop_max_bounds.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_max_bounds.h" 18 | 19 | dout_t loop_max_bounds(din_t A[N], dsel_t width) { 20 | 21 | dout_t out_accum=0; 22 | dsel_t x; 23 | 24 | LOOP_X:for (x=0;x 21 | #include 22 | using namespace std; 23 | 24 | typedef short din1_t; 25 | typedef unsigned char din2_t; 26 | typedef unsigned int dint_t; 27 | typedef int dout_t; 28 | 29 | dout_t lookup(din1_t inval, din2_t idx); 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /coding_C++_templates/cpp_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _CPP_TEMPLATE_H_ 18 | #define _CPP_TEMPLATE_H_ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | using namespace std; 25 | 26 | #define FIB_N 5 27 | 28 | typedef int data_t; 29 | 30 | void cpp_template(data_t a, data_t b, data_t &dout); 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /interface_axi_lite/example.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | 20 | void example(char *a, char *b, char *c) 21 | { 22 | #pragma HLS INTERFACE s_axilite port=a bundle=BUS_A 23 | #pragma HLS INTERFACE s_axilite port=b bundle=BUS_A 24 | #pragma HLS INTERFACE s_axilite port=c bundle=BUS_A 25 | #pragma HLS INTERFACE s_axilite port=return bundle=BUS_A 26 | 27 | *c += *a + *b; 28 | } -------------------------------------------------------------------------------- /memory_bottleneck/mem_bottleneck.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _ARRAY_MEM_BOTTLENECK_H_ 18 | #define _ARRAY_MEM_BOTTLENECK_H_ 19 | 20 | #include 21 | #include 22 | using namespace std; 23 | 24 | #include "ap_int.h" 25 | #define N 128 26 | 27 | typedef ap_int<7> din_t; 28 | typedef ap_int<10> dout_t; 29 | 30 | dout_t array_mem_bottleneck(din_t mem[N]); 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /coding_loop_pipeline/loop_pipeline.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LOOP_PIPELINE_H_ 18 | #define _LOOP_PIPELINE_H_ 19 | 20 | #include 21 | #include 22 | using namespace std; 23 | 24 | #include "ap_int.h" 25 | #define N 20 26 | #define NUM_TRANS 20 27 | 28 | typedef ap_int<5> din_t; 29 | typedef ap_int<20> dout_t; 30 | 31 | dout_t loop_pipeline(din_t A[N]); 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /coding_pointer_multi/pointer_multi.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "pointer_multi.h" 18 | 19 | dout_t pointer_multi (sel_t sel, din_t pos) { 20 | static const dout_t a[8] = {1, 2, 3, 4, 5, 6, 7, 8}; 21 | static const dout_t b[8] = {8, 7, 6, 5, 4, 3, 2, 1}; 22 | 23 | dout_t* ptr; 24 | if (sel) 25 | ptr = a; 26 | else 27 | ptr = b; 28 | 29 | return ptr[pos]; 30 | } 31 | 32 | 33 | -------------------------------------------------------------------------------- /memory_bottleneck_resolved/mem_bottleneck_resolved.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _ARRAY_MEM_PERFORM_H_ 18 | #define _ARRAY_MEM_PERFORM_H_ 19 | 20 | #include 21 | #include 22 | using namespace std; 23 | 24 | #include "ap_int.h" 25 | #define N 128 26 | 27 | typedef ap_int<7> din_t; 28 | typedef ap_int<10> dout_t; 29 | 30 | dout_t mem_bottleneck_resolved(din_t mem[N]); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /coding_loop_perfect/loop_perfect.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LOOP_PERFECT_H_ 18 | #define _LOOP_PERFECT_H_ 19 | 20 | #include 21 | #include 22 | using namespace std; 23 | 24 | #include "ap_int.h" 25 | #define N 20 26 | 27 | typedef ap_int<5> din_t; 28 | typedef ap_int<12> dint_t; 29 | typedef ap_int<6> dout_t; 30 | 31 | void loop_perfect(din_t A[N], dout_t B[N]); 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /coding_loop_variable_bound/loop_var.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LOOP_VAR_H_ 18 | #define _LOOP_VAR_H_ 19 | 20 | #include 21 | #include 22 | using namespace std; 23 | 24 | #include "ap_int.h" 25 | #define N 32 26 | 27 | typedef ap_int<8> din_t; 28 | typedef ap_int<13> dout_t; 29 | typedef ap_uint<5> dsel_t; 30 | 31 | dout_t loop_var(din_t A[N], dsel_t width); 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /misc_rtl_as_blackbox/example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _EXAMPLE_H_ 18 | #define _EXAMPLE_H_ 19 | 20 | #include 21 | #include 22 | using namespace std; 23 | 24 | #include "ap_int.h" 25 | 26 | typedef ap_int<10> data_t; 27 | 28 | void example(data_t a1, data_t a2, data_t a3, data_t a4, 29 | data_t b1, data_t b2, data_t b3, data_t b4, 30 | data_t &sigma); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /coding_loop_imperfect/loop_imperfect.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LOOP_IMPERFECT_H_ 18 | #define _LOOP_IMPERFECT_H_ 19 | 20 | #include 21 | #include 22 | using namespace std; 23 | 24 | #include "ap_int.h" 25 | #define N 20 26 | 27 | typedef ap_int<5> din_t; 28 | typedef ap_int<12> dint_t; 29 | typedef ap_int<6> dout_t; 30 | 31 | void loop_imperfect(din_t A[N], dout_t B[N]); 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /coding_arbitrary_precision_arith/cpp_ap_int_arith.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "cpp_ap_int_arith.h" 18 | 19 | void cpp_ap_int_arith(dinA_t inA, dinB_t inB, dinC_t inC, dinD_t inD, 20 | dout1_t *out1, dout2_t *out2, dout3_t *out3, dout4_t *out4 21 | ) { 22 | 23 | // Basic arithmetic operations 24 | *out1 = inA * inB; 25 | *out2 = inB + inA; 26 | *out3 = inC / inA; 27 | *out4 = inD % inA; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /coding_function_instantiate/example.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | char foo(char inval, char incr) { 18 | #pragma HLS INLINE OFF 19 | #pragma HLS FUNCTION_INSTANTIATE variable=incr 20 | return inval + incr; 21 | } 22 | 23 | void top(char inval1, char inval2, char inval3, 24 | char *outval1, char *outval2, char *outval3) 25 | { 26 | *outval1 = foo(inval1, 0); 27 | *outval2 = foo(inval2, 1); 28 | *outval3 = foo(inval3, 100); 29 | } 30 | -------------------------------------------------------------------------------- /coding_arbitrary_precision_casting/arbitrary_precision_casting.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _ARBITRARY_PRECISION_CASTING_H_ 18 | #define _ARBITRARY_PRECISION_CASTING_H_ 19 | 20 | #include 21 | #include 22 | using namespace std; 23 | 24 | #include "ap_int.h" 25 | 26 | typedef ap_int<18> din_t; 27 | typedef ap_int<36> dout_t; 28 | 29 | dout_t arbitrary_precision_casting(din_t a,din_t b); 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /coding_loop_max_bound_trick/loop_max_bounds.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LOOP_MAX_BOUNDS_H_ 18 | #define _LOOP_MAX_BOUNDS_H_ 19 | 20 | #include 21 | #include 22 | using namespace std; 23 | 24 | #include "ap_int.h" 25 | #define N 32 26 | 27 | typedef ap_int<8> din_t; 28 | typedef ap_int<13> dout_t; 29 | typedef ap_uint<5> dsel_t; 30 | 31 | dout_t loop_max_bounds(din_t A[N], dsel_t width); 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /misc_rtl_as_blackbox/rtl_model.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "example.h" 18 | //-------------------------------------------------------- 19 | void rtl_model(data_t a1, data_t a2, data_t a3, data_t a4, 20 | data_t b1, data_t b2, data_t b3, data_t b4, 21 | data_t &z1, data_t &z2, data_t &z3, data_t &z4) 22 | { 23 | #pragma HLS inline off 24 | z1=a1+b1; 25 | z2=a2+b2; 26 | z3=a3+b3; 27 | z4=a4+b4; 28 | } 29 | -------------------------------------------------------------------------------- /coding_dataflow_rewind/diamond.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define N 100 18 | typedef unsigned char data_t; 19 | 20 | // Top function 21 | void diamond(data_t vecIn[N], data_t vecOut[N]); 22 | 23 | // Sub functions 24 | void funcA(data_t f1In[N], data_t f1Out[N], data_t f1bisOut[N]); 25 | void funcB(data_t f2In[N], data_t f2Out[N]); 26 | void funcC(data_t f3In[N], data_t f3Out[N]); 27 | void funcD(data_t f4In[N], data_t f4bisIn[N], data_t f4Out[N]); -------------------------------------------------------------------------------- /interface_axi_stream_side_channel_data/example.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "ap_axi_sdata.h" 18 | #include "hls_stream.h" 19 | 20 | 21 | void example(hls::stream< ap_axis<32,2,5,6> > &A, 22 | hls::stream< ap_axis<32,2,5,6> > &B) 23 | { 24 | #pragma HLS INTERFACE axis port=A 25 | #pragma HLS INTERFACE axis port=B 26 | 27 | ap_axis<32,2,5,6> tmp; 28 | 29 | A.read(tmp); 30 | tmp.data = tmp.data.to_int() + 5; 31 | B.write(tmp); 32 | } 33 | -------------------------------------------------------------------------------- /memory_rom_lookup_table_math/lookup_math.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LOOKUP_MATH_H_ 18 | #define _LOOKUP_MATH_H_ 19 | 20 | #include 21 | #include 22 | using namespace std; 23 | 24 | 25 | typedef short din1_t; 26 | typedef unsigned char din2_t; 27 | typedef double dint_t; 28 | typedef int dout_t; 29 | 30 | #define M_PI 3.14159265358979323846 31 | 32 | dout_t lookup_math(din1_t inval, din2_t idx); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /interface_hls_stream/bytestrm_dwordproc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef BYTESTRM_DWORDPROC_H 18 | #define BYTESTRM_DWORDPROC_H 19 | 20 | #include "bytestrm_util.h" 21 | 22 | using namespace hls; 23 | 24 | #define DECIMATION_RATE 4 25 | #define LOG2_DECIMATION_RATE 2 26 | 27 | void bytestrm_dwordproc( 28 | stream &strm_out, 29 | stream &strm_in, 30 | uint16_t strm_len 31 | ); 32 | 33 | #endif // BYTESTRM_DWORDPROC_H 34 | 35 | -------------------------------------------------------------------------------- /coding_loop_functions/loop_functions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LOOP_FUNCTIONS_H_ 18 | #define _LOOP_FUNCTIONS_H_ 19 | 20 | #include 21 | #include 22 | using namespace std; 23 | 24 | #include "ap_int.h" 25 | #define N 32 26 | 27 | typedef ap_int<8> din_t; 28 | typedef ap_int<13> dout_t; 29 | typedef ap_uint<5> dsel_t; 30 | 31 | void loop_functions(din_t A[N], din_t B[N], dout_t X[N], dout_t Y[N], dsel_t xlimit, dsel_t ylimit); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /coding_loop_imperfect/loop_imperfect.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_imperfect.h" 18 | 19 | void loop_imperfect(din_t A[N], dout_t B[N]) { 20 | 21 | int i,j; 22 | dint_t acc; 23 | 24 | LOOP_I:for(i=0; i < 20; i++){ 25 | acc = 0; 26 | LOOP_J: for(j=0; j < 20; j++){ 27 | acc += A[j] * j; 28 | } 29 | if (i%2 == 0) 30 | B[i] = acc / 20; 31 | else 32 | B[i] = 0; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /coding_loop_sequential/loop_sequential.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LOOP_SEQUENTIAL_H_ 18 | #define _LOOP_SEQUENTIAL_H_ 19 | 20 | #include 21 | #include 22 | using namespace std; 23 | 24 | #include "ap_int.h" 25 | #define N 32 26 | 27 | typedef ap_int<8> din_t; 28 | typedef ap_int<13> dout_t; 29 | typedef ap_uint<5> dsel_t; 30 | 31 | void loop_sequential(din_t A[N], din_t B[N], dout_t X[N], dout_t Y[N], dsel_t xlimit, dsel_t ylimit); 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /memory_bottleneck_resolved/mem_bottleneck_resolved.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "mem_bottleneck_resolved.h" 18 | 19 | dout_t mem_bottleneck_resolved(din_t mem[N]) { 20 | 21 | din_t tmp0, tmp1, tmp2; 22 | dout_t sum=0; 23 | int i; 24 | 25 | tmp0 = mem[0]; 26 | tmp1 = mem[1]; 27 | SUM_LOOP:for (i = 2; i < N; i++) { 28 | tmp2 = mem[i]; 29 | sum += tmp2 + tmp1 + tmp0; 30 | tmp0 = tmp1; 31 | tmp1 = tmp2; 32 | } 33 | 34 | return sum; 35 | } 36 | -------------------------------------------------------------------------------- /memory_rom_coef_filter/README: -------------------------------------------------------------------------------- 1 | /* 2 | * Example code for a scaled-integer fixed-point Hamming window function. 3 | * This example is intended to demonstrates the recommended coding style 4 | * when an array should be implemented as a ROM. The key guideline is that 5 | * the ROM's source (in the C code) array should be initialized by a sub- 6 | * function to the function that access (reads from) the array. When the 7 | * array is properly inferred to be a ROM, the initialization function will 8 | * be optimized away during HLS. 9 | * 10 | */ 11 | 12 | Files Included in this Package 13 | ================================================== 14 | hamming_window.c - source for the hamming_window() function 15 | hamming_window.h - header file with function prototype and default params 16 | hamming_window_test.c - test program for SW model validation & RTL co-sim 17 | run_hls.tcl - HLS run script 18 | x_hls.tcl - auxilary script setting HLS run-level 19 | README - this file 20 | 21 | Running the Design 22 | ================================================= 23 | vitis_hls -f run_hls.tcl 24 | -------------------------------------------------------------------------------- /coding_loop_sequential_dataflow/loop_sequential.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LOOP_SEQUENTIAL_H_ 18 | #define _LOOP_SEQUENTIAL_H_ 19 | 20 | #include 21 | #include 22 | using namespace std; 23 | 24 | #include "ap_int.h" 25 | #define N 32 26 | 27 | typedef ap_int<8> din_t; 28 | typedef ap_int<13> dout_t; 29 | typedef ap_uint<5> dsel_t; 30 | 31 | void loop_sequential(din_t A[N], din_t B[N], dout_t X[N], dout_t Y[N], dsel_t xlimit, dsel_t ylimit); 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /coding_loop_sequential/loop_sequential.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_sequential.h" 18 | 19 | void loop_sequential(din_t A[N], din_t B[N], dout_t X[N], dout_t Y[N], dsel_t xlimit, dsel_t ylimit) { 20 | 21 | dout_t X_accum=0; 22 | dout_t Y_accum=0; 23 | int i,j; 24 | 25 | SUM_X:for (i=0;i 21 | #include 22 | using namespace std; 23 | 24 | #include 25 | #include "ap_int.h" 26 | #define N 32 27 | 28 | typedef ap_int<8> din_t; 29 | typedef ap_int<13> dout_t; 30 | typedef ap_uint<8> dsel_t; 31 | 32 | void loop_sequential_assert(din_t A[N], din_t B[N], dout_t X[N], dout_t Y[N], dsel_t xlimit, dsel_t ylimit); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /memory_rom_lookup_table_math/lookup_math.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "lookup_math.h" 18 | #include 19 | 20 | void init_sin_table(din1_t sin_table[256]) 21 | { 22 | int i; 23 | for (i = 0; i < 256; i++) { 24 | dint_t real_val = sin(M_PI * (dint_t)(i - 128) / 256.0); 25 | sin_table[i] = (din1_t)(32768.0 * real_val); 26 | } 27 | } 28 | 29 | dout_t lookup_math(din1_t inval, din2_t idx) 30 | { 31 | short sin_table[256]; 32 | init_sin_table(sin_table); 33 | return (int)inval * (int)sin_table[idx]; 34 | } 35 | -------------------------------------------------------------------------------- /coding_loop_perfect/loop_perfect.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_perfect.h" 18 | 19 | void loop_perfect(din_t A[N], dout_t B[N]) { 20 | int i,j; 21 | dint_t acc; 22 | 23 | LOOP_I:for(i=0; i < 20; i++){ 24 | LOOP_J: for(j=0; j < 20; j++){ 25 | if(j==0) acc = 0; 26 | acc += A[j] * j; 27 | if(j==19) { 28 | if (i%2 == 0) 29 | B[i] = acc / 20; 30 | else 31 | B[i] = 0; 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /coding_loop_functions/loop_functions.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_functions.h" 18 | 19 | void sub_func(din_t I[N], dout_t O[N], dsel_t limit) { 20 | int i; 21 | dout_t accum=0; 22 | 23 | SUM:for (i=0;i 21 | #include 22 | #include 23 | #include 24 | #include 25 | using namespace std; 26 | #include "ap_fixed.h" 27 | 28 | typedef ap_ufixed<10,8, AP_RND, AP_SAT> din1_t; 29 | typedef ap_fixed<6,3, AP_RND, AP_WRAP> din2_t; 30 | typedef ap_fixed<22,17, AP_TRN, AP_SAT> dint_t; 31 | typedef ap_fixed<36,30> dout_t; 32 | 33 | dout_t cpp_ap_fixed(din1_t d_in1, din2_t d_in2); 34 | 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /coding_hierarchy_func/hier_func.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "hier_func.h" 18 | 19 | void sumsub_func(din_t *in1, din_t *in2, dint_t *outSum, dint_t *outSub) 20 | { 21 | *outSum = *in1 + *in2; 22 | *outSub = *in1 - *in2; 23 | } 24 | 25 | void shift_func(dint_t *in1, dint_t *in2, dout_t *outA, dout_t *outB) 26 | { 27 | *outA = *in1 >> 1; 28 | *outB = *in2 >> 2; 29 | } 30 | 31 | void hier_func(din_t A, din_t B, dout_t *C, dout_t *D) 32 | { 33 | dint_t apb, amb; 34 | 35 | sumsub_func(&A,&B,&apb,&amb); 36 | shift_func(&apb,&amb,C,D); 37 | } -------------------------------------------------------------------------------- /interface_axi_stream_to_master/example_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "example.h" 18 | 19 | int main() { 20 | int err = 0; 21 | ap_uint<64> out_t[1024]; 22 | hls::stream inStream_t; 23 | trans_pkt dataStream_t; 24 | 25 | for(int i=0;i<1024;i++){ 26 | dataStream_t.data=i; 27 | dataStream_t.keep=-1; 28 | if(i<1023){ 29 | dataStream_t.last=0; 30 | } else { 31 | dataStream_t.last=1; 32 | } 33 | inStream_t.write(dataStream_t); 34 | } 35 | 36 | example(inStream_t,out_t); 37 | return err; 38 | } 39 | -------------------------------------------------------------------------------- /memory_ultraram/resource_uram.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "resource_uram.h" 18 | 19 | void resource_uram(bool wren, bool rden, 20 | addr_t addrW, data_t datain, 21 | addr_t AddrR, data_t *dataout) 22 | { 23 | #pragma HLS PIPELINE II=1 24 | 25 | static data_t buffer[NWORDS]; 26 | #pragma HLS DEPENDENCE variable=buffer inter WAR false 27 | #pragma HLS BIND_STORAGE variable=buffer type=ram_2p impl=uram 28 | 29 | if (rden) 30 | *dataout = buffer[AddrR]; 31 | 32 | if (wren) 33 | buffer[addrW] = datain; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /coding_C++_templates/cpp_template.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "cpp_template.h" 18 | 19 | // Tail recursive call 20 | template 21 | struct fibon_s { 22 | template 23 | static T fibon_f(T a, T b) { 24 | return fibon_s::fibon_f(b, (a+b)); 25 | } 26 | }; 27 | 28 | // Termination condition 29 | template<> struct fibon_s<1> { 30 | template 31 | static T fibon_f(T a, T b) { 32 | return b; 33 | } 34 | }; 35 | 36 | void cpp_template(data_t a, data_t b, data_t &dout){ 37 | dout = fibon_s::fibon_f(a,b); 38 | } 39 | -------------------------------------------------------------------------------- /coding_loop_sequential_assert/loop_sequential_assert.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_sequential_assert.h" 18 | 19 | void loop_sequential_assert(din_t A[N], din_t B[N], dout_t X[N], dout_t Y[N], dsel_t xlimit, dsel_t ylimit) { 20 | 21 | dout_t X_accum=0; 22 | dout_t Y_accum=0; 23 | int i,j; 24 | 25 | assert(xlimit<32); 26 | SUM_X:for (i=0;i<=xlimit; i++) { 27 | X_accum += A[i]; 28 | X[i] = X_accum; 29 | } 30 | 31 | assert(ylimit<16); 32 | SUM_Y:for (i=0;i<=ylimit; i++) { 33 | Y_accum += B[i]; 34 | Y[i] = Y_accum; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /coding_hierarchy_func2/hier_func2.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "hier_func2.h" 18 | 19 | void sumsub_func(din_t *in1, din_t *in2, dint_t *outSum, dint_t *outSub) 20 | { 21 | *outSum = *in1 + *in2; 22 | *outSub = *in1 - *in2; 23 | } 24 | 25 | void shift_func(dint_t *in1, dint_t *in2, dout_t *outA, dout_t *outB) 26 | { 27 | *outA = *in1 >> 1; 28 | *outB = *in2 >> 2; 29 | } 30 | 31 | void hier_func2(din_t A, din_t B, dout_t *C, dout_t *D) 32 | { 33 | dint_t apb, amb; 34 | 35 | sumsub_func(&A,&B,&apb,&amb); 36 | shift_func(&apb,&amb,C,D); 37 | } 38 | 39 | 40 | -------------------------------------------------------------------------------- /coding_remerge_ii2to1/example_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "example.h" 18 | 19 | void example(stream &in, stream &out); 20 | 21 | int main() 22 | { 23 | 24 | stream in("in_stream"); 25 | stream out("out_stream"); 26 | 27 | int N = 50; 28 | for (int i = 0; i < N; i++) 29 | in << i; 30 | 31 | example(in, out); 32 | 33 | for (int p = 0; p < N; p++) 34 | { 35 | int var; 36 | out.read(var); 37 | if (var != p) 38 | { 39 | std::cout << "Test pattern failed" << std::endl; 40 | return 1; 41 | } 42 | } 43 | return 0; 44 | } -------------------------------------------------------------------------------- /memory_ultraram/resource_uram.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | using namespace std; 21 | 22 | #define ADDRBITS 14 23 | #define NWORDS 1 << ADDRBITS 24 | 25 | // Switch between regular and hw data types 26 | #if 0 27 | typedef int data_t; 28 | typedef int addr_t; 29 | #else 30 | #include "ap_int.h" 31 | #define DATAWIDTH 128 32 | typedef ap_uint data_t; 33 | typedef ap_uint addr_t; 34 | #endif 35 | 36 | void resource_uram(bool wren, bool rden, 37 | addr_t addrW, data_t datain, 38 | addr_t AddrR, data_t *dataout); 39 | -------------------------------------------------------------------------------- /coding_loop_sequential_dataflow/loop_sequential.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_sequential.h" 18 | 19 | void loop_sequential(din_t A[N], din_t B[N], dout_t X[N], dout_t Y[N], dsel_t xlimit, dsel_t ylimit) { 20 | 21 | // The dataflow directive will enable the concurrent 22 | // execution of the two accumulators described below 23 | #pragma HLS DATAFLOW 24 | 25 | dout_t X_accum=0; 26 | dout_t Y_accum=0; 27 | int i,j; 28 | 29 | SUM_X:for (i=0;i 22 | 23 | #define IN_BW 24 24 | #define IN_IW 8 25 | #define OUT_BW 28 26 | #define OUT_IW 4 // ((IN_IW + 1) / 2) 27 | 28 | // typedefs for top-level input and output fixed-point formats 29 | typedef ap_ufixed in_data_t; 30 | typedef ap_ufixed out_data_t; 31 | 32 | // Top level wrapper function - calls the core template function w/ above types 33 | out_data_t fxp_sqrt_top(in_data_t& in_val); 34 | 35 | #endif // FXP_SQRT_TOP_H_ not defined 36 | 37 | -------------------------------------------------------------------------------- /coding_loop_labels/example_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | void example_no_label(int A[50], int B[50]); 20 | void example_label(int A[50], int B[50]); 21 | 22 | int main() 23 | { 24 | int i; 25 | int A[50]; 26 | int B[50]; 27 | int C[50]; 28 | 29 | for(i=0; i < 50; i++){ 30 | A[i] = i; 31 | } 32 | 33 | example_no_label(A,B); 34 | example_label(A,C); 35 | 36 | for(i=0; i < 50; i++){ 37 | if(B[i] != C[i]){ 38 | printf("ERROR: example_label and example_no_label mismatch\n"); 39 | return 1; 40 | } 41 | } 42 | 43 | printf("Success: results from both functions match\n"); 44 | return 0; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /interface_axi_stream_to_master/example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "ap_int.h" 18 | #include "ap_axi_sdata.h" 19 | #include "hls_stream.h" 20 | 21 | typedef ap_axiu<64, 0, 0, 0> trans_pkt; 22 | 23 | void example(hls::stream& inStreamTop, 24 | ap_uint<64> outTop[1024] ) ; 25 | 26 | // Expects max bandwidth at 64 beats burst (for 64-bit data) 27 | static constexpr int MAX_BURST_LENGTH = 64; 28 | static constexpr int BUFFER_FACTOR = 64; 29 | 30 | // Buffer sizes 31 | static constexpr int DATA_DEPTH = MAX_BURST_LENGTH * BUFFER_FACTOR; 32 | static constexpr int COUNT_DEPTH = BUFFER_FACTOR; 33 | 34 | struct data { 35 | ap_int<64> data_filed; 36 | ap_int<1> last; 37 | }; 38 | -------------------------------------------------------------------------------- /algorithm_fixed_point_sqrt/README: -------------------------------------------------------------------------------- 1 | /* 2 | * Example code for template function that implements a fixed point square- 3 | * root algorithm for HLS. 4 | * 5 | * While the (or ) square-root (sqrt(), sqrtf(), etc) are 6 | * supported for HLS, they are always implemented as floating point operations 7 | * and result in the instantiation of a CoreGen Floating Point Operator core 8 | * in the final RTL, regardless of the types passed. This template function 9 | * can result in a more efficient implementation for fixed point (and integer) 10 | * data types while maintaining precision of results (see comments in 11 | * fxp_sqrt.h for more details). 12 | */ 13 | 14 | Files Included in this Package 15 | ================================================== 16 | fxp_sqrt.h - Header file w/ fxp_sqrt template function implementation 17 | fxp_sqrt_top.c - Implementation source file (top-level for example) 18 | fxp_sqrt_top.h - Header file w/ function prototype and params for top-level 19 | fxp_sqrt_test.cpp - test program which for SW model validation & RTL co-sim 20 | run_hls.tcl - HLS run script 21 | x_hls.tcl - auxilary script setting run-level 22 | README - this file 23 | 24 | Running the Design 25 | ================================================= 26 | vitis_hls -f run_hls.tcl 27 | 28 | -------------------------------------------------------------------------------- /algorithm_window_function_float/window_fn_top.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef WINDOW_FN_TOP_H_ 18 | #define WINDOW_FN_TOP_H_ 19 | 20 | #include "window_fn_class.h" 21 | 22 | // Test parameters 23 | #define FLOAT_DATA // Used to select error tolerance in test program 24 | #define WIN_TYPE xhls_window_fn::HANN 25 | #define WIN_LEN 32 26 | 27 | // Define floating point types for input, output and window coefficients 28 | typedef float win_fn_in_t; 29 | typedef float win_fn_out_t; 30 | typedef float win_fn_coef_t; 31 | 32 | // Top level function prototype - wraps all object, method and functions for HLS 33 | void window_fn_top(win_fn_out_t outdata[WIN_LEN], win_fn_in_t indata[WIN_LEN]); 34 | 35 | #endif // WINDOW_FN_TOP_H_ 36 | 37 | -------------------------------------------------------------------------------- /coding_vectorized/example_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | typedef float float16 __attribute__((vector_size(64))); 21 | 22 | extern "C" 23 | void example(float16*res, const float16 *lhs, const float16 *rhs, int n); 24 | 25 | int main(int, char**) { 26 | std::vector lhs(1000); 27 | std::vector rhs(1000); 28 | std::vector res(1000); 29 | 30 | float16 temp = {3.2, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 3.2, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1}; 31 | 32 | lhs[1] = temp; 33 | rhs[1] = temp; 34 | 35 | example(res.data(), lhs.data(), rhs.data(), 4); 36 | 37 | std::cout << "The output value for res[1][1] should be 2.2 and is " << res[1][1] << std::endl; 38 | 39 | return 0; 40 | } -------------------------------------------------------------------------------- /algorithm_window_function_fixed_point/README: -------------------------------------------------------------------------------- 1 | /* 2 | * Example code for a fixed-point "window function" based on a template class. 3 | * This example demonstrates several Xilinx High Level Synthesis (HLS) C++ 4 | * language support features, ehancements and coding style techniques including: 5 | * - C+ coding style for ROM inference - init functions must be global-scope 6 | * - use of functions to init ROMs - no HW created by HLS 7 | * - use of the ap_fixed<> data type in both HLS and C++ functional modeling 8 | * - code reuse/parameterization via C++ templates 9 | * - top level wrapper function for HLS of class objets cand methods 10 | * - TCL directive syntax for a class member (see run_hls.tcl) 11 | * - namespaces to control visibility and prevent naming clashes 12 | */ 13 | 14 | Files Included in this Package 15 | ================================================== 16 | window_fn_top.cpp - top level wrapper function 17 | window_fn_top.h - top level header with function prototype, typedefs, etc 18 | window_fn_class.h - header file for window function class 19 | window_fn_test.cpp - test program which for SW model validation & RTL co-sim 20 | run_hls.tcl - HLS run script 21 | x_hls.tcl - auxilary script setting run-level 22 | README - this file 23 | 24 | Running the Design 25 | ================================================= 26 | vitis_hls -f run_hls.tcl -------------------------------------------------------------------------------- /misc_rtl_as_blackbox/example.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "example.h" 18 | //-------------------------------------------------------- 19 | void rtl_model(data_t a1, data_t a2, data_t a3, data_t a4, 20 | data_t b1, data_t b2, data_t b3, data_t b4, 21 | data_t &z1, data_t &z2, data_t &z3, data_t &z4); 22 | //-------------------------------------------------------- 23 | void example(data_t a1, data_t a2, data_t a3, data_t a4, 24 | data_t b1, data_t b2, data_t b3, data_t b4, 25 | data_t &sigma) { 26 | 27 | data_t tmp1, tmp2,tmp3, tmp4; 28 | 29 | rtl_model(a1, a2, a3, a4, b1, b2, b3, b4, tmp1, tmp2, tmp3, tmp4); 30 | sigma = tmp1 + tmp2 + tmp3 + tmp4; 31 | } 32 | //-------------------------------------------------------- 33 | -------------------------------------------------------------------------------- /algorithm_2D_convolution_linebuffer/convolution.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef CONVOLUTION_H_ 18 | #define CONVOLUTION_H_ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #define MAX_IMG_ROWS 1080 25 | #define MAX_IMG_COLS 1920 26 | 27 | #define TEST_IMG_ROWS 135 28 | #define TEST_IMG_COLS 240 29 | #define TEST_IMG_SIZE (TEST_IMG_ROWS * TEST_IMG_COLS) 30 | 31 | typedef uint32_t data_t; 32 | 33 | // External function prototypes 34 | void filter11x11_orig( 35 | int w, int h, 36 | const data_t *src_image, data_t *dst_image); 37 | 38 | void filter11x11_strm( 39 | int w, int h, 40 | hls::stream &src_image, hls::stream &dst_image); 41 | 42 | #endif // CONVOLUTION_H_ not defined 43 | 44 | -------------------------------------------------------------------------------- /interface_axi_master/example.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file contains an example for creating an AXI4-master interface in Vivado HLS 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | void example(volatile int *a){ 25 | 26 | #pragma HLS INTERFACE m_axi port=a depth=50 27 | 28 | int i; 29 | int buff[50]; 30 | 31 | //memcpy creates a burst access to memory 32 | //multiple calls of memcpy cannot be pipelined and will be scheduled sequentially 33 | //memcpy requires a local buffer to store the results of the memory transaction 34 | memcpy(buff,(const int*)a,50*sizeof(int)); 35 | 36 | for(i=0; i < 50; i++){ 37 | buff[i] = buff[i] + 100; 38 | } 39 | 40 | memcpy((int *)a,buff,50*sizeof(int)); 41 | } 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /interface_axi_lite/example_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | void example(char *a, char *b, char *c); 20 | 21 | int main() 22 | { 23 | 24 | char a; 25 | char b; 26 | char c; 27 | char d; 28 | char sw_result; 29 | 30 | 31 | printf("HLS AXI-Lite Example\n"); 32 | printf("Function c += a + b\n"); 33 | printf("Initial values a = 5, b = 10, c = 0\n"); 34 | 35 | a = 5; 36 | b = 10; 37 | c = 0; 38 | d = 0; 39 | 40 | example(&a,&b,&c); 41 | d += a + b; 42 | 43 | printf("HW result = %d\n",c); 44 | printf("SW result = %d\n",d); 45 | 46 | if(d == c){ 47 | printf("Success SW and HW results match\n"); 48 | return 0; 49 | } 50 | else{ 51 | printf("ERROR SW and HW results mismatch\n"); 52 | return 1; 53 | } 54 | } 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /coding_pointer_double/pointer_double.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "pointer_double.h" 18 | 19 | data_t sub(data_t ptr[10], data_t size, data_t**flagPtr) 20 | { 21 | data_t x, i; 22 | 23 | x = 0; 24 | // Sum x if AND of local index and double-pointer index is true 25 | for(i=0; i=0 & pos < 10) 41 | *(array+pos) = x; 42 | 43 | // Pass same index (as pos) as pointer to another function 44 | return sub(array, 10, &ptrFlag); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /memory_bottleneck/mem_bottleneck_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "mem_bottleneck.h" 18 | 19 | int main () { 20 | din_t A[N]; 21 | dout_t sum; 22 | 23 | int i, retval=0; 24 | ofstream FILE; 25 | 26 | // Create input data 27 | for(i=0; i 18 | #include "ap_axi_sdata.h" 19 | #include "hls_stream.h" 20 | using namespace std; 21 | 22 | void example(hls::stream > &A, hls::stream > &B); 23 | 24 | int main() 25 | { 26 | int i=100; 27 | hls::stream > A, B; 28 | ap_axis<32,2,5,6> tmp1, tmp2; 29 | 30 | tmp1.data = i; 31 | tmp1.keep = 1; 32 | tmp1.strb = 1; 33 | tmp1.user = 1; 34 | tmp1.last = 0; 35 | tmp1.id = 0; 36 | tmp1.dest = 1; 37 | 38 | A.write(tmp1); 39 | example(A,B); 40 | B.read(tmp2); 41 | 42 | if (tmp2.data.to_int() != 105) 43 | { 44 | cout << "ERROR: results mismatch" << endl; 45 | return 1; 46 | } 47 | else 48 | { 49 | cout << "Success: results match" << endl; 50 | return 0; 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /coding_loop_max_bound_trick/loop_max_bounds_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_max_bounds.h" 18 | 19 | int main () { 20 | din_t A[N]; 21 | dsel_t x=0; 22 | dout_t accum; 23 | 24 | int i, retval=0; 25 | ofstream FILE; 26 | 27 | for(i=0; i 18 | 19 | void example(int A[50], int B[50]); 20 | 21 | int main() 22 | { 23 | int i; 24 | int A[50]; 25 | int B[50]; 26 | int C[50]; 27 | 28 | printf("HLS AXI-Stream no side-channel data example\n"); 29 | //Put data into A 30 | for(i=0; i < 50; i++){ 31 | A[i] = i; 32 | } 33 | 34 | //Call the hardware function 35 | example(A,B); 36 | 37 | //Run a software version of the hardware function to validate results 38 | for(i=0; i < 50; i++){ 39 | C[i] = A[i] + 5; 40 | } 41 | 42 | //Compare results 43 | for(i=0; i < 50; i++){ 44 | if(B[i] != C[i]){ 45 | printf("ERROR HW and SW results mismatch\n"); 46 | return 1; 47 | } 48 | } 49 | printf("Success HW and SW results match\n"); 50 | return 0; 51 | } 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /coding_loop_variable_bound/loop_var_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_var.h" 18 | 19 | int main () { 20 | din_t A[N]; 21 | dsel_t x=0; 22 | dout_t accum; 23 | 24 | int i, retval=0; 25 | ofstream FILE; 26 | 27 | for(i=0; i 18 | 19 | void example(volatile int *a); 20 | 21 | int main() 22 | { 23 | int i; 24 | int A[50]; 25 | int B[50]; 26 | 27 | printf("HLS AXI-Stream no side-channel data example\n"); 28 | //Put data into A 29 | for(i=0; i < 50; i++){ 30 | A[i] = i; 31 | } 32 | 33 | //Call the hardware function 34 | example(A); 35 | 36 | //Run a software version of the hardware function to validate results 37 | for(i=0; i < 50; i++){ 38 | B[i] = i + 100; 39 | } 40 | 41 | //Compare results 42 | for(i=0; i < 50; i++){ 43 | if(B[i] != A[i]){ 44 | printf("i = %d A = %d B= %d\n",i,A[i],B[i]); 45 | printf("ERROR HW and SW results mismatch\n"); 46 | return 1; 47 | } 48 | } 49 | printf("Success HW and SW results match\n"); 50 | return 0; 51 | } 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /misc_rtl_as_blackbox/example_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include "example.h" 19 | 20 | int main() 21 | { 22 | 23 | data_t sum; 24 | int i, j, retval=0; 25 | ofstream FILE; 26 | 27 | // Save the results to a file 28 | FILE.open ("result.dat"); 29 | 30 | // Create input data 31 | for(i=0; i<10;++i) { 32 | example(i, i-10, i+10, i-20, i, 2*i, 3*i, 4*i, sum); 33 | cout << " sum " << (int)sum << endl; 34 | FILE << sum << endl; 35 | } 36 | 37 | // Closing FILE 38 | FILE.close(); 39 | 40 | // Compare the results file with the golden results 41 | retval = system("diff --brief -w result.dat result.golden.dat"); 42 | if (retval != 0) { 43 | cout << "Test failed !!!" << endl; 44 | retval=1; 45 | } else { 46 | cout << "Test passed !" << endl; 47 | } 48 | 49 | // Return 0 if the test passes 50 | return retval; 51 | } 52 | -------------------------------------------------------------------------------- /coding_arbitrary_precision_arith/cpp_ap_int_arith.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _CPP_AP_INT_ARITH_H_ 18 | #define _CPP_AP_INT_ARITH_H_ 19 | 20 | #include 21 | #include "ap_int.h" 22 | 23 | #define N 9 24 | 25 | // Old data types 26 | //typedef char dinA_t; 27 | //typedef short dinB_t; 28 | //typedef int dinC_t; 29 | //typedef long long dinD_t; 30 | //typedef int dout1_t; 31 | //typedef unsigned int dout2_t; 32 | //typedef int32_t dout3_t; 33 | //typedef int64_t dout4_t; 34 | 35 | typedef ap_int<6> dinA_t; 36 | typedef ap_int<12> dinB_t; 37 | typedef ap_int<22> dinC_t; 38 | typedef ap_int<33> dinD_t; 39 | 40 | typedef ap_int<18> dout1_t; 41 | typedef ap_uint<13> dout2_t; 42 | typedef ap_int<22> dout3_t; 43 | typedef ap_int<6> dout4_t; 44 | 45 | void cpp_ap_int_arith(dinA_t inA,dinB_t inB,dinC_t inC,dinD_t inD,dout1_t *out1,dout2_t *out2,dout3_t *out3,dout4_t *out4); 46 | 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /coding_loop_perfect/loop_perfect_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_perfect.h" 18 | 19 | int main() { 20 | din_t A[N]; 21 | dout_t B[N]; 22 | 23 | int i, retval = 0; 24 | ofstream FILE; 25 | 26 | for (i = 0; i < N; ++i) { 27 | A[i] = i; 28 | } 29 | // Save the results to a file 30 | FILE.open ("result.dat"); 31 | 32 | // Call the function 33 | loop_perfect(A, B); 34 | for (i = 0; i < N; ++i) { 35 | FILE << B[i] << endl; 36 | } 37 | FILE.close(); 38 | 39 | // Compare the results file with the golden results 40 | retval = system("diff --brief -w result.dat result.golden.dat"); 41 | if (retval != 0) { 42 | printf("Test failed !!!\n"); 43 | retval = 1; 44 | } else { 45 | printf("Test passed !\n"); 46 | } 47 | 48 | // Return 0 if the test passed 49 | return retval; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /memory_rom_lookup_table/lookup_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "lookup.h" 18 | 19 | int main () { 20 | din1_t data1_i = 1; 21 | din2_t data2_i = 100; 22 | dout_t data_o; 23 | 24 | int i, retval=0; 25 | ofstream FILE; 26 | 27 | // Save the results to a file 28 | FILE.open ("result.dat"); 29 | 30 | // Call the function for multiple transactions 31 | for (i=0; i<64; i++) { 32 | data_o = lookup(data1_i, data2_i); 33 | FILE << data_o << endl; 34 | data1_i = data1_i + 1; 35 | data1_i = data1_i + 1; 36 | } 37 | FILE.close(); 38 | 39 | 40 | // Compare the results file with the golden results 41 | retval = system("diff --brief -w result.dat result.golden.dat"); 42 | if (retval != 0) { 43 | cout << "Test failed !!!" << endl; 44 | retval=1; 45 | } else { 46 | cout << "Test passed !" << endl; 47 | } 48 | 49 | // Return 0 if the test passes 50 | return retval; 51 | } 52 | -------------------------------------------------------------------------------- /coding_arbitrary_precision_casting/arbitrary_precision_casting_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "arbitrary_precision_casting.h" 18 | 19 | int main () { 20 | din_t A, B; 21 | dout_t RES; 22 | int i, retval=0; 23 | ofstream FILE; 24 | 25 | // Save the results to a file 26 | FILE.open ("result.dat"); 27 | 28 | // Call the function 29 | A=65536; 30 | B=65536; 31 | for(i=0; i<20;++i) { 32 | RES=arbitrary_precision_casting(A,B); 33 | FILE << RES << endl; 34 | A=A+1024; 35 | B=B-2047; 36 | } 37 | FILE.close(); 38 | 39 | // Compare the results file with the golden results 40 | retval = system("diff --brief -w result.dat result.golden.dat"); 41 | if (retval != 0) { 42 | cout << "Test failed !!!" << endl; 43 | retval=1; 44 | } else { 45 | cout << "Test passed !" << endl; 46 | } 47 | 48 | // Return 0 if the test passes 49 | return retval; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /coding_function_instantiate/example_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "example.h" 18 | 19 | int main() { 20 | 21 | int i, retval = 0; 22 | const char N = 10; 23 | char a, b, c; 24 | ofstream FILE; 25 | 26 | // Save the results to a file 27 | FILE.open ("result.dat"); 28 | 29 | for (i = 0; i < N; ++i) { 30 | // Call the function 31 | top(i, i, i, &a, &b, &c); 32 | FILE << (int)a << " " << (int)b << " " << (int)c << endl; 33 | cout << (int)a << " " << (int)b << " " << (int)c << endl; 34 | } 35 | 36 | FILE.close(); 37 | 38 | // Compare the results file with the golden results 39 | retval = system("diff --brief -w result.dat result.golden.dat"); 40 | if (retval != 0) { 41 | printf("Test failed !!!\n"); 42 | retval = 1; 43 | } else { 44 | printf("Test passed !\n"); 45 | } 46 | 47 | // Return 0 if the test passed 48 | return retval; 49 | } 50 | 51 | -------------------------------------------------------------------------------- /coding_loop_imperfect/loop_imperfect_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_imperfect.h" 18 | 19 | int main() { 20 | din_t A[N]; 21 | dout_t B[N]; 22 | 23 | int i, retval = 0; 24 | ofstream FILE; 25 | 26 | 27 | for (i = 0; i < N; ++i) { 28 | A[i] = i; 29 | } 30 | // Save the results to a file 31 | FILE.open ("result.dat"); 32 | 33 | // Call the function 34 | loop_imperfect(A, B); 35 | for (i = 0; i < N; ++i) { 36 | FILE << B[i] << endl; 37 | } 38 | FILE.close(); 39 | 40 | // Compare the results file with the golden results 41 | retval = system("diff --brief -w result.dat result.golden.dat"); 42 | if (retval != 0) { 43 | cout << "Test failed !!!" << endl; 44 | retval = 1; 45 | } else { 46 | cout << "Test passed !" << endl; 47 | } 48 | 49 | // Return 0 if the test passed 50 | return retval; 51 | } 52 | 53 | -------------------------------------------------------------------------------- /algorithm_fir_systolic_scalar/filter_scalar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | using namespace std; 21 | 22 | #if 0 23 | typedef int data_t; 24 | typedef int coef_t; 25 | typedef int sum_t; 26 | #else 27 | #include "ap_int.h" 28 | typedef ap_int<16> data_t; 29 | typedef ap_int<16> coef_t; 30 | typedef ap_int<34> sum_t; 31 | #endif 32 | 33 | const int TAP = 4; 34 | 35 | void filter(data_t &x, coef_t h[TAP], sum_t &y); 36 | 37 | // Filtering unit cell class 38 | template 39 | class systolic 40 | { 41 | private: 42 | T0 x, x1; 43 | T2 y0, y1; 44 | 45 | public: 46 | // Based on systolic fir description in Xilinx UG073 47 | void exec(T0 &x_in, T1 &h, T2 &y_in, T0 &x_out, T2 &y) 48 | { 49 | x_out = x1; 50 | x1 = x; 51 | x = x_in; 52 | y = y1; 53 | y1 = y0 + y_in; 54 | y0 = x_out * h; 55 | } 56 | }; 57 | -------------------------------------------------------------------------------- /algorithm_template_fir_filter/cpp_FIR_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "cpp_FIR.h" 18 | 19 | int main() 20 | { 21 | ofstream result; 22 | data_t output; 23 | int retval=0; 24 | 25 | 26 | // Open a file to save the results 27 | result.open("result.dat"); 28 | 29 | // Apply stimuli, call the top-level function and save the results 30 | for (int i = 0; i <= 250; i++) 31 | { 32 | output = cpp_FIR(i); 33 | 34 | result << setw(10) << i; 35 | result << setw(20) << output; 36 | result << endl; 37 | 38 | } 39 | result.close(); 40 | 41 | // Compare the results file with the golden results 42 | retval = system("diff --brief -w result.dat result.golden.dat"); 43 | if (retval != 0) { 44 | printf("Test failed !!!\n"); 45 | retval=1; 46 | } else { 47 | printf("Test passed !\n"); 48 | } 49 | 50 | // Return 0 if the test passes 51 | return retval; 52 | } 53 | 54 | -------------------------------------------------------------------------------- /coding_pointer_arith/pointer_arith_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "pointer_arith.h" 18 | 19 | int main () { 20 | dio_t d[5], ref[5]; 21 | int i, retval=0; 22 | FILE *fp; 23 | 24 | // Create input data 25 | for (i=0;i<5;i++) { 26 | d[i] = i; 27 | ref[i] = i; 28 | } 29 | 30 | // Call the function to operate on the data 31 | pointer_arith(d); 32 | 33 | // Save the results to a file 34 | fp=fopen("result.dat","w"); 35 | printf(" Din Dout\n"); 36 | for (i=0;i<4;i++) { 37 | fprintf(fp, "%d \n", d[i]); 38 | printf(" %d %d\n", ref[i], d[i]); 39 | } 40 | fclose(fp); 41 | 42 | // Compare the results file with the golden results 43 | retval = system("diff --brief -w result.dat result.golden.dat"); 44 | if (retval != 0) { 45 | printf("Test failed !!!\n"); 46 | retval=1; 47 | } else { 48 | printf("Test passed !\n"); 49 | } 50 | 51 | // Return 0 if the test passed 52 | return retval; 53 | } 54 | -------------------------------------------------------------------------------- /algorithm_window_function_fixed_point/window_fn_top.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef WINDOW_FN_TOP_H_ 18 | #define WINDOW_FN_TOP_H_ 19 | 20 | #include "window_fn_class.h" 21 | 22 | // Test parameters 23 | #define WIN_TYPE xhls_window_fn::HANN 24 | #define WIN_LEN 32 25 | 26 | // Types and top-level function prototype 27 | #include 28 | // Define widths of fixed point fields 29 | #define W_IN 8 30 | #define IW_IN 8 31 | #define W_OUT 24 32 | #define IW_OUT 8 33 | #define W_COEF 18 34 | #define IW_COEF 2 35 | 36 | // Define fixed point types for input, output and coefficients 37 | typedef ap_fixed win_fn_in_t; 38 | typedef ap_fixed win_fn_out_t; 39 | typedef ap_fixed win_fn_coef_t; 40 | 41 | // Top level function prototype - wraps all object, method and functions for HLS 42 | void window_fn_top(win_fn_out_t outdata[WIN_LEN], win_fn_in_t indata[WIN_LEN]); 43 | 44 | #endif // WINDOW_FN_TOP_H_ 45 | 46 | -------------------------------------------------------------------------------- /memory_rom_lookup_table_math/lookup_math_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "lookup_math.h" 18 | 19 | int main () { 20 | din1_t data1_i = 1; 21 | din2_t data2_i = 100; 22 | dout_t data_o; 23 | 24 | int i, retval=0; 25 | ofstream FILE; 26 | 27 | // Save the results to a file 28 | FILE.open ("result.dat"); 29 | 30 | // Call the function for multiple transactions 31 | for (i=0; i<64; i++) { 32 | data_o = lookup_math(data1_i, data2_i); 33 | FILE << data_o << endl; 34 | data1_i = data1_i + 1; 35 | data2_i = data2_i + 1; 36 | } 37 | FILE.close(); 38 | 39 | 40 | // Compare the results file with the golden results 41 | retval = system("diff --brief -w result.dat result.golden.dat"); 42 | if (retval != 0) { 43 | cout << "Test failed !!!" << endl; 44 | retval=1; 45 | } else { 46 | cout << "Test passed !" << endl; 47 | } 48 | 49 | // Return 0 if the test passes 50 | return retval; 51 | } 52 | 53 | -------------------------------------------------------------------------------- /coding_loop_pipeline/loop_pipeline_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_pipeline.h" 18 | 19 | int main () { 20 | din_t A[N]; 21 | dout_t accum; 22 | 23 | int i, j, retval=0; 24 | ofstream FILE; 25 | 26 | // Create input data 27 | for(i=0; i my_win_fn; 33 | 34 | // Call the apply() method - an input data set is windowed for each "call" 35 | // to window_fn_top() 36 | my_win_fn.apply(outdata, indata); 37 | } 38 | 39 | 40 | -------------------------------------------------------------------------------- /coding_loop_sequential/loop_sequential_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_sequential.h" 18 | 19 | int main () { 20 | din_t A[N], B[N]; 21 | dout_t X[N], Y[N]; 22 | dsel_t xlimit, ylimit; 23 | 24 | int i, retval=0; 25 | ofstream FILE; 26 | 27 | // Create input data 28 | for(i=0; i my_win_fn; 33 | 34 | // Call the apply() method - an input data set is windowed for each "call" 35 | // to window_fn_top() 36 | my_win_fn.apply(outdata, indata); 37 | } 38 | 39 | 40 | -------------------------------------------------------------------------------- /coding_loop_sequential_dataflow/loop_sequential_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Xilinx, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "loop_sequential.h" 18 | 19 | int main () { 20 | din_t A[N], B[N]; 21 | dout_t X[N], Y[N]; 22 | dsel_t xlimit, ylimit; 23 | 24 | int i, retval=0; 25 | ofstream FILE; 26 | 27 | // Create input data 28 | for(i=0; i s[TAP]; 27 | coef_t h[TAP]; 28 | data_t x_int[TAP]; 29 | sum_t y_int[TAP]; 30 | sum_t tmp = 0; 31 | 32 | // Copy, partition the coefficients to make them available in 33 | // parallel. 34 | #pragma HLS ARRAY_PARTITION variable = h complete dim = 1 35 | for (int i = 0; i < TAP; i++) { 36 | h[i] = coef[i]; 37 | } 38 | 39 | // Connect the filter execution blocks to implement the systolic 40 | // filter chain. 41 | connect: 42 | for (int i = 0; i < TAP; i++) 43 | { 44 | if (i == 0) 45 | s[0].exec(x, h[i], tmp, x_int[i], y_int[i]); 46 | else 47 | s[i].exec(x_int[i - 1], h[i], y_int[i - 1], x_int[i], y_int[i]); 48 | y = y_int[TAP - 1]; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /coding_vectorized/run_hls.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Xilinx, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Create a project 17 | open_project -reset proj_example 18 | 19 | # Add design files 20 | add_files example.cpp 21 | 22 | # Add test bench & files 23 | add_files -tb example_test.cpp -cflags "-std=gnu++14" 24 | 25 | # Set the top-level function 26 | set_top example 27 | 28 | # ######################################################## 29 | # Create a solution 30 | open_solution -reset solution1 31 | # Define technology and clock rate 32 | set_part {xcvu9p-flga2104-2-i} 33 | create_clock -period 5 34 | 35 | # Source x_hls.tcl to determine which steps to execute 36 | source x_hls.tcl 37 | csim_design 38 | 39 | if {$hls_exec == 1} { 40 | # Run Synthesis and Exit 41 | csynth_design 42 | } elseif {$hls_exec == 2} { 43 | # Run Synthesis, RTL Simulation and Exit 44 | csynth_design 45 | cosim_design 46 | } elseif {$hls_exec == 3} { 47 | # Run Synthesis, RTL Simulation, RTL implementation and Exit 48 | csynth_design 49 | cosim_design 50 | export_design 51 | } else { 52 | # Default is to exit after setup 53 | csynth_design 54 | } 55 | 56 | exit --------------------------------------------------------------------------------