Skip to content

Commit 970bd72

Browse files
acastellanebmesnetacastellane
authored
Vitis hls (#136)
* changes to support vitis HLS * remove unused Flash wrapper * restore 12 HBM * adapt scripts for hbm * update for ubuntu default shell * bsp_wo_pblock_1 * correct lib calls * tune axis for vitis * tune path before calling xsim with vivado 2020.1 and later * Update hls.mk * Update create_framework.tcl * synchro with oc-bip Co-authored-by: Bruno Mesnet <bruno.mesnet@fr.ibm.com> Co-authored-by: acastellane <castella@fr.ibm.com>
1 parent 7893c7b commit 970bd72

23 files changed

Lines changed: 239 additions & 69 deletions

File tree

actions/hls.mk

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,14 @@ $(syn_dir): $(srcs) run_hls_script.tcl
5151
@if [ ! -d "$(SNAP_ROOT)/hardware/logs" ]; then \
5252
mkdir -p $(SNAP_ROOT)/hardware/logs; \
5353
fi
54-
@echo " Compiling action with Vivado HLS `vivado_hls -version|head -n1|cut -d " " -f 11`"
5554
@echo " Clock period used for HLS is $(HLS_ACTION_CLOCK) ns"
56-
vivado_hls -f run_hls_script.tcl > $(SNAP_ROOT)/hardware/logs/action_make.log
55+
@if [ "X$(HLS_VITIS_USED)" = "XTRUE" ]; then \
56+
echo " Compiling action with Vitis HLS `vitis_hls -version|head -n1|cut -d " " -f 11`"; \
57+
vitis_hls -f run_hls_script.tcl > $(SNAP_ROOT)/hardware/logs/action_make.log; \
58+
else \
59+
echo " Compiling action with Vivado HLS `vivado_hls -version|head -n1|cut -d " " -f 11`"; \
60+
vivado_hls -f run_hls_script.tcl > $(SNAP_ROOT)/hardware/logs/action_make.log; \
61+
fi
5762
$(RM) -rf $@/systemc $@/verilog
5863

5964
# Create symlinks for simpler access
@@ -76,29 +81,28 @@ $(SOLUTION_NAME): $(objs)
7681

7782
# FIXME That those things are not resulting in an error is problematic.
7883
# If we get critical warnings we stay away from continuing now,
79-
# since that will according to our experience with vivado_hls, lead
84+
# since that will according to our experience with vivado/vitis_hls, lead
8085
# to strange problems later on. So let us work on fixing the design
8186
# if they occur. Rather than challenging our luck.
8287
#
8388
# Check that last HLS compilation of the action was done with the same clock period. Exit if occurs.
8489
# Check for CRITICAL warnings and exit if those occur. Add more if needed.
8590
# Check for critical warnings and exit if those occur. Add more if needed.
8691
# Check for reserved HLS MMIO reg at offset 0x17c.
87-
#
92+
8893
check: $(syn_dir)
89-
@if [ X$(HLS_ACTION_CLOCK) != X$(shell grep "Setting up clock" vivado_hls.log |cut -d " " -f 12|cut -d "n" -f 1) ]; then \
90-
echo " ---------------------------------------------------------- "; \
91-
echo " ERROR: Action was last compiled with a different HLS clock."; \
92-
echo " Please force the recompilation with a 'make clean' command"; \
93-
echo " ---------------------------------------------------------- "; exit -1; \
94+
@if [ "${HLS_ACTION_CLOCK}" != "${shell grep "Setting up clock" *_hls.log |cut -d " " -f 12|cut -d "n" -f 1}" ]; then \
95+
echo " ERROR with Vivado/Vitis HLS. HLS Action was last compiled with a different HLS clock."; \
96+
echo " Please force the recompilation with a 'make clean' command"; \
97+
echo " ---------------------------------------------------------- "; exit 1; \
9498
fi
9599
@echo -n " Checking for critical warnings during HLS synthesis .... "
96-
@grep -A8 CRITICAL vivado_hls.log; \
100+
@grep -A8 CRITICAL *_hls.log; \
97101
test $$? = 1
98102
@echo "OK"
99103
@if [ $(HLS_ACTION_CLOCK) == $(HLS_ACTION_CLOCK_DEFAULT) ]; then \
100104
echo -n " Checking for critical timings during HLS synthesis .... "; \
101-
grep -A8 critical vivado_hls.log; \
105+
grep -A8 critical *_hls.log; \
102106
if [ $$? -eq 0 ]; then \
103107
echo "------------------------------------------------------------------ "; \
104108
echo "TIMING ERROR: Please correct your action code before going further"!; \
@@ -113,11 +117,11 @@ check: $(syn_dir)
113117
echo " By defining a HLS clock different than the default 5ns, the automatic checking"; \
114118
echo " of the critical timings is disabled. You need to manually check them."; \
115119
echo " FYI action was compiled with following HLS clock:"; \
116-
grep "Setting up clock" vivado_hls.log ; \
120+
grep "Setting up clock" *_hls.log ; \
117121
echo " --------------------------------------------------------------------------- "; \
118122
echo " please CHECK the below list (if any) for HLS synthesis critical timing .... "; \
119123
echo " --------------------------------------------------------------------------- "; \
120-
grep -A8 critical vivado_hls.log ; \
124+
grep -A8 critical *_hls.log ; \
121125
echo " --------------------------------------------------------------------------- "; \
122126
if [ $$? -ne 0 ]; then \
123127
echo "OK"; \

actions/hls_decimal_mult/hw/action_decimal_mult.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,12 @@ void hls_action(snap_membus_512_t *din_gmem,
140140

141141
// Host Memory AXI Lite Master Interface
142142

143-
#pragma HLS DATA_PACK variable=act_reg
143+
#ifdef HLS_VITIS_USED
144+
#pragma HLS AGGREGATE variable=act_reg
145+
#else
146+
#pragma HLS DATA_PACK variable=act_reg
147+
#endif
148+
144149
#pragma HLS INTERFACE s_axilite port=act_reg bundle=ctrl_reg offset=0x100
145150
#pragma HLS INTERFACE s_axilite port=return bundle=ctrl_reg
146151

actions/hls_hbm_memcopy_1024/hw/hw_action_hbm_memcopy_1024.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
// the application shouldn't use more interfaces than the number you have defined in Kconfig menu.
3333
// (extra interfaces not connected will be removed if not connected to the wrapper)
3434

35-
#define HBM_AXI_IF_NB 12
35+
#define HBM_AXI_IF_NB 12
3636

3737
//===================================================================================//
3838

@@ -835,7 +835,13 @@ void hls_action(snap_membus_1024_t *din_gmem,
835835
max_read_burst_length=64 max_write_burst_length=64
836836

837837
// Host Memory AXI Lite Master Interface
838-
#pragma HLS DATA_PACK variable=act_reg
838+
839+
#ifdef HLS_VITIS_USED
840+
#pragma HLS AGGREGATE variable=act_reg
841+
#else
842+
#pragma HLS DATA_PACK variable=act_reg
843+
#endif
844+
839845
#pragma HLS INTERFACE s_axilite port=act_reg bundle=ctrl_reg offset=0x100
840846
#pragma HLS INTERFACE s_axilite port=return bundle=ctrl_reg
841847

actions/hls_helloworld_1024/hw/action_uppercase.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ void hls_action(snap_membus_1024_t *din_gmem,
9696
* #pragma HLS INTERFACE s_axilite port=d_ddrmem bundle=ctrl_reg offset=0x050
9797
*/
9898
// Host Memory AXI Lite Master Interface - NO CHANGE BELOW
99-
#pragma HLS DATA_PACK variable=act_reg
99+
#ifdef HLS_VITIS_USED
100+
#pragma HLS AGGREGATE variable=act_reg
101+
#else
102+
#pragma HLS DATA_PACK variable=act_reg
103+
#endif
100104
#pragma HLS INTERFACE s_axilite port=act_reg bundle=ctrl_reg offset=0x100
101105
#pragma HLS INTERFACE s_axilite port=return bundle=ctrl_reg
102106

actions/hls_helloworld_512/hw/action_uppercase.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ void hls_action(snap_membus_512_t *din_gmem,
9797
* #pragma HLS INTERFACE s_axilite port=d_ddrmem bundle=ctrl_reg offset=0x050
9898
*/
9999
// Host Memory AXI Lite Master Interface - NO CHANGE BELOW
100-
#pragma HLS DATA_PACK variable=act_reg
100+
#ifdef HLS_VITIS_USED
101+
#pragma HLS AGGREGATE variable=act_reg
102+
#else
103+
#pragma HLS DATA_PACK variable=act_reg
104+
#endif
101105
#pragma HLS INTERFACE s_axilite port=act_reg bundle=ctrl_reg offset=0x100
102106
#pragma HLS INTERFACE s_axilite port=return bundle=ctrl_reg
103107

actions/hls_helloworld_python/hw/action_uppercase.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ void hls_action(snap_membus_1024_t *din_gmem,
9595
* #pragma HLS INTERFACE s_axilite port=d_ddrmem bundle=ctrl_reg offset=0x050
9696
*/
9797
// Host Memory AXI Lite Master Interface - NO CHANGE BELOW
98-
#pragma HLS DATA_PACK variable=act_reg
98+
#ifdef HLS_VITIS_USED
99+
#pragma HLS AGGREGATE variable=act_reg
100+
#else
101+
#pragma HLS DATA_PACK variable=act_reg
102+
#endif
99103
#pragma HLS INTERFACE s_axilite port=act_reg bundle=ctrl_reg offset=0x100
100104
#pragma HLS INTERFACE s_axilite port=return bundle=ctrl_reg
101105

actions/hls_image_filter/hw/action_pixel_filter.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,11 @@ void hls_action(snap_membus_512_t *din_gmem,
225225
* #pragma HLS INTERFACE s_axilite port=d_ddrmem bundle=ctrl_reg offset=0x050
226226
*/
227227
// Host Memory AXI Lite Master Interface - NO CHANGE BELOW
228-
229-
#pragma HLS DATA_PACK variable=act_reg
228+
#ifdef HLS_VITIS_USED
229+
#pragma HLS AGGREGATE variable=act_reg
230+
#else
231+
#pragma HLS DATA_PACK variable=act_reg
232+
#endif
230233
#pragma HLS INTERFACE s_axilite port=act_reg bundle=ctrl_reg offset=0x100
231234

232235
#pragma HLS INTERFACE s_axilite port=return bundle=ctrl_reg

actions/hls_memcopy_1024/hw/hw_action_memcopy_1024.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,11 @@ void hls_action(snap_membus_1024_t *din_gmem,
257257

258258

259259
// Host Memory AXI Lite Master Interface
260-
#pragma HLS DATA_PACK variable=act_reg
260+
#ifdef HLS_VITIS_USED
261+
#pragma HLS AGGREGATE variable=act_reg
262+
#else
263+
#pragma HLS DATA_PACK variable=act_reg
264+
#endif
261265
#pragma HLS INTERFACE s_axilite port=act_reg bundle=ctrl_reg offset=0x100
262266
#pragma HLS INTERFACE s_axilite port=return bundle=ctrl_reg
263267

actions/hls_memcopy_512/hw/hw_action_memcopy_512.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,11 @@ void hls_action(snap_membus_512_t *din_gmem,
217217

218218

219219
// Host Memory AXI Lite Master Interface
220-
#pragma HLS DATA_PACK variable=act_reg
220+
#ifdef HLS_VITIS_USED
221+
#pragma HLS AGGREGATE variable=act_reg
222+
#else
223+
#pragma HLS DATA_PACK variable=act_reg
224+
#endif
221225
#pragma HLS INTERFACE s_axilite port=act_reg bundle=ctrl_reg offset=0x100
222226
#pragma HLS INTERFACE s_axilite port=return bundle=ctrl_reg
223227

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <stdio.h>
2-
#include <iostream>
3-
//#define NO_SYNTH
4-
#include "../hw/hls_udp.h"
2+
//#include <iostream>
3+
//#include "hls_udp.h"
54

65

76
#pragma pack(push)

0 commit comments

Comments
 (0)