读HLS Bluebook(二)

Pipeline Feedback

A design with feedback limits the initiation interval to be no less than the delay of the feedback path. There are three types of feedback:

  1. data dependent, 即inter-loop dependency。“If the only loop in the design is the main loop the variable must have been declared as static for there to be feedback.”指的是用static存住一个寄存器型变量,在每次调用时都能继承上次的结果。举例如下:
void accumulate(int a, int b, int &dout){
    
	static int acc=0;

	int tmp = acc*a;
	acc = tmp+b;
	dout = acc;
}

要想使得Pipeline II=1,则工作频率不会很高,时空关系如下所示:
Feedback_1
对应硬件电路如下:
Feedback_3

而要想二者兼得,即想得到如下的时空图:
Feedback_2
上图中Main iteration 1需要"acc"的时候,Main iteration 0还未准备好,因此时空关系并不成立。
实际综合出的电路会对应下图,II=2:
Feedback_4
若想同时达到高频率和II=1的目的,可以将代码改写成如下形式,出发点是为了平衡feedback和feedforward两条路径的延时,具体移位寄存器的数量=(feed-forward latency)/期望II。(Feed-forward latency如上图中含有两个Reg的路径延时)下述代码第一次调用时,acc_old1的值无法确定(为何不初始化为0),第一次调用是无效的考虑舍弃?b的路径不需要平衡吗,还是说b和a本来就不是一起到达的?

void accumulate(int a, int b, int &dout){
   
	static int acc=0;
	static int acc_old0;
	static int acc_old1;
	
	int tmp0 = acc_old1*a;
	acc = tmp0+b;
	acc_old1 = acc_old0;
	acc_old0 = acc;
	dout = acc;
}

进行如上更改后对应的电路如下所示:
Feedback_5

  1. control dependent, 嵌套的层数越多,控制逻辑便越复杂,一个bad example如下所示:
void control(int din[8][8],
			 int dout[8],
			 int x_size,
			 int y_size){
   
	int acc;
	X:for
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值