基于DSP的电力线载波OFDM调制解调器
为使代码达到最大效率,程序将尽可能将指令安排为并行执行。为使指令并行操作,程序确定指令间的相关性,即一条指令必须发生在另一条指令之后。根据TMS320C6201的数据通路和流水线工作方式,在此给出一种高效实现16点Radix4FFT的方法。其基本思想是分解传统的FFT蝶型算法循环体,将其分别展开在A、B通路内计算两个FFT蝶型算法。每个蝶型算法分别只分配自己这一侧的寄存器组和功能单元。这样在循环体内两个蝶型算法是完全不相关的,能够并行执行。下面给出基于C.S.Burrus和T.W.Parks的Radix4FFT算法?3?的优化算法的代码实现。
void radix4?int n? short x??? short w???
?
int n1? n2? ie? wa1? wa2? wa3? wb1? wb2? wb3? ia0? ia1? ia2? ia3? ib0? ib1? ib2?
ib3? j? k?
short ta? tb? ra1? ra2? rb1? rb2? sa1? sa2? sb1? sb2? coa1? coa2? coa3? cob1?
cob2? cob3? sia1? sia2? sia3? sib1? sib2? sib3?
n2=n?
ie=1?
for?k=n?k>1?k>>=2?
? //number of stage
n1=n2?
n2>>=2? // distance between input datas
wa1=0?
for?j=0?j<n2?j+=2?? //number of butterfies perstage
wb1=wa1+ie?
wa2=wa1+wa1?
wb2=wb1+wb1? //since here?most of the folow-
ering two instructions are parallel
wa3=wa2+wa1?
wb3=wb2+wb1?
coa1=w?wa1?2+1??
cob1=w?wb1?2+1??
sia1=w?wa1?2??
sib1=w?wb1?2??
coa2=w?wa2?2+1??
cob2=w?wb2?2+1??
sia2=w?wa2?2??
sib2=w?wb2?2?
《基于DSP的电力线载波OFDM调制解调器(第3页)》