- 打开Vivado HLS(本次实验版本为2017.4)
- 点击
Create New Project
- 设置工程名与文件地址
- 设置顶层函数名,然后点击
Next
->Next
- 点击
...
选择对应器件型号,最后点击Finish
完成创建
- 点击
Source
->New File
,创建名为led_control.cpp
的文件
- 输入如下代码并保存
#include <ap_int.h>
void led_control(ap_int<1> &led)
{
#pragma HLS interface ap_none port=led
#pragma HLS interface ap_ctrl_none port=return
for(int i=0; i<50000000;i++ )
{
led = (i < 50000000/2) ?0 :1 ;
}
}
- 点击运行
- 点击导出IP,按默认配置继续即可
注**注:在编译过程中,可能会遇到如下问题:ERROR: [IMPL 213-28] Failed to generate IP. command ap_source returned error code
,只需将计算机时钟修改为2021.1.1后重新编译即可。