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:
parent
baea1069cb
commit
d046210740
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
26
example_projects/vitis_hls_test_prj_template_v1/run_hls.tcl
Normal file
26
example_projects/vitis_hls_test_prj_template_v1/run_hls.tcl
Normal 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
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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'
|
||||||
|
|
@ -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'
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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'
|
||||||
|
|
@ -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'
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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'
|
||||||
|
|
26
scripts_for_xilinx_hls/run_hls.tcl
Normal file
26
scripts_for_xilinx_hls/run_hls.tcl
Normal 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
|
||||||
|
|
13
scripts_for_xilinx_hls/vitis_hls_clean.sh
Normal file
13
scripts_for_xilinx_hls/vitis_hls_clean.sh
Normal 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
|
||||||
|
|
16
scripts_for_xilinx_hls/vitis_hls_cosim.sh
Normal file
16
scripts_for_xilinx_hls/vitis_hls_cosim.sh
Normal 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'
|
||||||
|
|
16
scripts_for_xilinx_hls/vitis_hls_csim.sh
Normal file
16
scripts_for_xilinx_hls/vitis_hls_csim.sh
Normal 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'
|
||||||
|
|
11
scripts_for_xilinx_hls/vitis_hls_csynth.sh
Normal file
11
scripts_for_xilinx_hls/vitis_hls_csynth.sh
Normal 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
|
||||||
|
|
16
scripts_for_xilinx_hls/vitis_hls_export.sh
Normal file
16
scripts_for_xilinx_hls/vitis_hls_export.sh
Normal 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'
|
||||||
|
|
16
scripts_for_xilinx_hls/vitis_hls_impl.sh
Normal file
16
scripts_for_xilinx_hls/vitis_hls_impl.sh
Normal 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'
|
||||||
|
|
16
scripts_for_xilinx_hls/vitis_hls_open_gui.sh
Normal file
16
scripts_for_xilinx_hls/vitis_hls_open_gui.sh
Normal 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
|
||||||
|
|
16
scripts_for_xilinx_hls/vitis_hls_syn.sh
Normal file
16
scripts_for_xilinx_hls/vitis_hls_syn.sh
Normal 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'
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user