DSP 中的零开销循环

Zero-overhead loop in DSP

Blackfin 在循环中进行零开销循环buffer.How它是否意识到迭代次数已经完成而无需计数器的比较或递减?

来自 blackfin 文档:

The sequencer supports a mechanism of zero-overhead looping. The sequencer contains two loop units, each containing three registers. Each loop unit has a Loop Top register ( LT0 , LT1 ), a Loop Bottom register (LB0 , LB1), and a Loop Count register (LC0, LC1).
Two sets of zero-overhead loop registers implement loops, using hardware counters instead of software instructions to evaluate loop conditions. After evaluation, processing branches to a new target address. Both sets of regis- ters include the Loop Counter ( LC), Loop Top (LT ), and Loop Bottom (LB ) registers.

如果每次进入循环时循环计数器都递减,则此方法有效。
然后当程序计数器到达Loop Bottom时,测试这个计数器的值是否足以分支

  • 如果循环计数器 == 0,则执行下一条指令并离开循环
  • 如果 Loop Counter != 0,到 Loop Top 继续迭代。还需要同时递减 Loop Counter。

这确保 zero-overhead 循环。