1
0
mirror of https://github.com/pConst/basic_verilog.git synced 2025-01-14 06:42:54 +08:00

Added Vitis HLS scripts and example

This commit is contained in:
Konstantin Pavlov 2023-02-24 06:01:53 +03:00
parent baea1069cb
commit d046210740
21 changed files with 348 additions and 0 deletions

View File

@ -0,0 +1,19 @@
//------------------------------------------------------------------------------
// published as part of https://github.com/pConst/basic_verilog
// Konstantin Pavlov, pavlovconst@gmail.com
//------------------------------------------------------------------------------
#include "hls_operator.h"
int hls_operator( int a, int b ) {
#pragma HLS DATAFLOW
static int delta = 1;
int result = a + b + delta;
delta++;
return result;
}

View File

@ -0,0 +1,9 @@
//------------------------------------------------------------------------------
// published as part of https://github.com/pConst/basic_verilog
// Konstantin Pavlov, pavlovconst@gmail.com
//------------------------------------------------------------------------------
#include "ap_int.h"
int hls_operator(int a, int b);

View File

@ -0,0 +1,28 @@
//------------------------------------------------------------------------------
// published as part of https://github.com/pConst/basic_verilog
// Konstantin Pavlov, pavlovconst@gmail.com
//------------------------------------------------------------------------------
#include "ap_int.h"
#include "hls_operator.h"
using namespace std;
int main() {
const int Ni = 3;
const int Nj = 5;
for (int i = 0; i < Ni; ++i) {
for (int j = 1; j < Nj; j=j*2) {
int result;
result = hls_operator( i, j );
cout << i << " @ " << j << " = " << result << endl;
}
}
return 0;
}

View File

@ -0,0 +1,26 @@
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Create a project
open_project proj -reset
add_files hls_operator.cpp
add_files -tb hls_operator_tb.cpp
set_top hls_operator
# Create a solution
open_solution -reset sol1 -flow_target vitis
set_part {xcvu9p-flga2104-2-i}
create_clock -period 5 -name default
#csim_design
csynth_design
#cosim_design
#export_design -rtl verilog -format ip_catalog -output /home/kp/tmp
#export_design -flow syn -rtl verilog -format ip_catalog
#export_design -flow impl -rtl verilog -format ip_catalog
exit

View File

@ -0,0 +1,13 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to clean Vitis HLS project
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
rm -rf proj
rm vitis_hls.log

View File

@ -0,0 +1,16 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to perform HLS component co-simulation
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
if [ ! -d "./proj" ]; then
source vitis_hls_csynth.sh
fi
vitis_hls -eval 'cosim_design'

View File

@ -0,0 +1,16 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to perform HLS component simulation
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
if [ ! -d "./proj" ]; then
source vitis_hls_csynth.sh
fi
vitis_hls -eval 'csim_design'

View File

@ -0,0 +1,11 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to initialize HLS project solution and make CSYNTH compilation step
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
vitis_hls -f run_hls.tcl

View File

@ -0,0 +1,16 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to export HLS component to Vivado IP catalog
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
if [ ! -d "./proj" ]; then
source vitis_hls_csynth.sh
fi
vitis_hls -eval 'export_design -rtl verilog -format ip_catalog'

View File

@ -0,0 +1,16 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to perform HLS IP synthesis and implementation
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
if [ ! -d "./proj" ]; then
source vitis_hls_csynth.sh
fi
vitis_hls -eval 'export_design -flow impl -rtl verilog -format ip_catalog'

View File

@ -0,0 +1,16 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to open Vitis HLS GUI
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
if [ ! -d "./proj" ]; then
source vitis_hls_csynth.sh
fi
vitis_hls -p proj

View File

@ -0,0 +1,16 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to perform HLS IP synthesis
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
if [ ! -d "./proj" ]; then
source vitis_hls_csynth.sh
fi
vitis_hls -eval 'export_design -flow syn -rtl verilog -format ip_catalog'

View File

@ -0,0 +1,26 @@
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Create a project
open_project proj -reset
add_files hls_operator.cpp
add_files -tb hls_operator_tb.cpp
set_top hls_operator
# Create a solution
open_solution -reset sol1 -flow_target vitis
set_part {xcvu9p-flga2104-2-i}
create_clock -period 5 -name default
#csim_design
csynth_design
#cosim_design
#export_design -rtl verilog -format ip_catalog -output /home/kp/tmp
#export_design -flow syn -rtl verilog -format ip_catalog
#export_design -flow impl -rtl verilog -format ip_catalog
exit

View File

@ -0,0 +1,13 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to clean Vitis HLS project
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
rm -rf proj
rm vitis_hls.log

View File

@ -0,0 +1,16 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to perform HLS component co-simulation
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
if [ ! -d "./proj" ]; then
source vitis_hls_csynth.sh
fi
vitis_hls -eval 'cosim_design'

View File

@ -0,0 +1,16 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to perform HLS component simulation
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
if [ ! -d "./proj" ]; then
source vitis_hls_csynth.sh
fi
vitis_hls -eval 'csim_design'

View File

@ -0,0 +1,11 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to initialize HLS project solution and make CSYNTH compilation step
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
vitis_hls -f run_hls.tcl

View File

@ -0,0 +1,16 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to export HLS component to Vivado IP catalog
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
if [ ! -d "./proj" ]; then
source vitis_hls_csynth.sh
fi
vitis_hls -eval 'export_design -rtl verilog -format ip_catalog'

View File

@ -0,0 +1,16 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to perform HLS IP synthesis and implementation
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
if [ ! -d "./proj" ]; then
source vitis_hls_csynth.sh
fi
vitis_hls -eval 'export_design -flow impl -rtl verilog -format ip_catalog'

View File

@ -0,0 +1,16 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to open Vitis HLS GUI
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
if [ ! -d "./proj" ]; then
source vitis_hls_csynth.sh
fi
vitis_hls -p proj

View File

@ -0,0 +1,16 @@
#! /usr/bin/env bash
#------------------------------------------------------------------------------
# published as part of https://github.com/pConst/basic_verilog
# Konstantin Pavlov, pavlovconst@gmail.com
#------------------------------------------------------------------------------
# Script to perform HLS IP synthesis
# see ../example_projects/vitis_hls_prj_template_v1/ for complete example
if [ ! -d "./proj" ]; then
source vitis_hls_csynth.sh
fi
vitis_hls -eval 'export_design -flow syn -rtl verilog -format ip_catalog'