来源:UG902 第一章 第五节 Managing Interfaces
接口不仅涉及到数据的输入输出效率,还涉及到生成IP之后,如何进行和PS的连接等问题,所以这个地方还是要仔细做个笔记。
#include "sum_io.h"
dout_t sum_io(din_t in1, din_t in2, dio_t *sum) {
dout_t temp;
*sum = in1 + in2 + *sum;
temp = in1 + in2;
return temp;
}
该代码主要包括:
两个传值参数
一个Read-write指针参数 sum
一个函数 return
综合之后的结果:
按照三种颜色对应三种不同类型的端口:
黄色 时钟和复位
红色 Block-Level interface protocol ,默认为ap-ctrl;该协议的作用:These ports control when the block can start processing data (ap_start), indicate when it is ready to accept new inputs (ap_ready) and indicate if the design is idle (ap_idle) or has completed operation (ap_done).
绿色 Port Level interface pro