OpenCores
URL https://opencores.org/ocsvn/pipelined_fft_256/pipelined_fft_256/trunk

Subversion Repositories pipelined_fft_256

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 1 to Rev 2
    Reverse comparison

Rev 1 → Rev 2

/pipelined_fft_256/trunk/DOC/fft256_um.pdf Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
pipelined_fft_256/trunk/DOC/fft256_um.pdf Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: pipelined_fft_256/trunk/TB/Wave_ROM256.v =================================================================== --- pipelined_fft_256/trunk/TB/Wave_ROM256.v (nonexistent) +++ pipelined_fft_256/trunk/TB/Wave_ROM256.v (revision 2) @@ -0,0 +1,158 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// ROM with 256 samples of the sine waves at the frequencies = 1, 3,5 and 7 +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `timescale 1 ns / 1 ps +module Wave_ROM256 ( ADDR ,DATA_RE,DATA_IM,DATA_REF ); + output [15:0] DATA_RE,DATA_IM,DATA_REF ; + input [7:0] ADDR ; + reg [15:0] cosi[0:255]; + initial begin + cosi[0]=16'h5A7F; cosi[1]=16'h5111; cosi[2]=16'h46AD; cosi[3]=16'h3B84; cosi[4]=16'h2FCE; cosi[5]=16'h23C4; cosi[6]=16'h17A2; cosi[7]=16'h0BA3; cosi[8]=16'h0000; cosi[9]=16'hF4F0; cosi[10]=16'hEAA4; cosi[11]=16'hE14A; cosi[12]=16'hD908; cosi[13]=16'hD1FD; cosi[14]=16'hCC40; cosi[15]=16'hC7E0; + cosi[16]=16'hC4E2; cosi[17]=16'hC343; cosi[18]=16'hC2F9; cosi[19]=16'hC3F2; cosi[20]=16'hC611; cosi[21]=16'hC938; cosi[22]=16'hCD40; cosi[23]=16'hD1FE; cosi[24]=16'hD747; cosi[25]=16'hDCEC; cosi[26]=16'hE2BC; cosi[27]=16'hE88B; cosi[28]=16'hEE2C; cosi[29]=16'hF376; cosi[30]=16'hF846; cosi[31]=16'hFC7C; + cosi[32]=16'h0000; cosi[33]=16'h02BF; cosi[34]=16'h04AE; cosi[35]=16'h05C8; cosi[36]=16'h060F; cosi[37]=16'h058D; cosi[38]=16'h0451; cosi[39]=16'h026E; cosi[40]=16'h0000; cosi[41]=16'hFD22; cosi[42]=16'hF9F3; cosi[43]=16'hF696; cosi[44]=16'hF32D; cosi[45]=16'hEFD8; cosi[46]=16'hECB7; cosi[47]=16'hE9E8; + cosi[48]=16'hE783; cosi[49]=16'hE59F; cosi[50]=16'hE44A; cosi[51]=16'hE390; cosi[52]=16'hE376; cosi[53]=16'hE3FC; cosi[54]=16'hE51A; cosi[55]=16'hE6C6; cosi[56]=16'hE8EF; cosi[57]=16'hEB80; cosi[58]=16'hEE60; cosi[59]=16'hF176; cosi[60]=16'hF4A3; cosi[61]=16'hF7CA; cosi[62]=16'hFACE; cosi[63]=16'hFD94; + cosi[64]=16'h0000; cosi[65]=16'h01FD; cosi[66]=16'h0378; cosi[67]=16'h0463; cosi[68]=16'h04B5; cosi[69]=16'h0469; cosi[70]=16'h0381; cosi[71]=16'h0204; cosi[72]=16'h0000; cosi[73]=16'hFD84; cosi[74]=16'hFAA7; cosi[75]=16'hF781; cosi[76]=16'hF42E; cosi[77]=16'hF0CD; cosi[78]=16'hED7C; cosi[79]=16'hEA5A; + cosi[80]=16'hE783; cosi[81]=16'hE514; cosi[82]=16'hE323; cosi[83]=16'hE1C5; cosi[84]=16'hE109; cosi[85]=16'hE0F8; cosi[86]=16'hE195; cosi[87]=16'hE2DE; cosi[88]=16'hE4CB; cosi[89]=16'hE74B; cosi[90]=16'hEA4C; cosi[91]=16'hEDB2; cosi[92]=16'hF15E; cosi[93]=16'hF52F; cosi[94]=16'hF8FF; cosi[95]=16'hFCA8; + cosi[96]=16'h0000; cosi[97]=16'h02E2; cosi[98]=16'h0529; cosi[99]=16'h06B4; cosi[100]=16'h0762; cosi[101]=16'h071D; cosi[102]=16'h05D2; cosi[103]=16'h0374; cosi[104]=16'h0000; cosi[105]=16'hFB78; cosi[106]=16'hF5E8; cosi[107]=16'hEF62; cosi[108]=16'hE801; cosi[109]=16'hDFE6; cosi[110]=16'hD73A; cosi[111]=16'hCE27; + cosi[112]=16'hC4E2; cosi[113]=16'hBB9C; cosi[114]=16'hB28D; cosi[115]=16'hA9EB; cosi[116]=16'hA1EC; cosi[117]=16'h9AC2; cosi[118]=16'h949E; cosi[119]=16'h8FA9; cosi[120]=16'h8C08; cosi[121]=16'h89D8; cosi[122]=16'h892F; cosi[123]=16'h8A18; cosi[124]=16'h8C97; cosi[125]=16'h90A7; cosi[126]=16'h963A; cosi[127]=16'h9D38; + cosi[128]=16'hA581; cosi[129]=16'hAEEF; cosi[130]=16'hB953; cosi[131]=16'hC47C; cosi[132]=16'hD032; cosi[133]=16'hDC3C; cosi[134]=16'hE85E; cosi[135]=16'hF45D; cosi[136]=16'h0000; cosi[137]=16'h0B10; cosi[138]=16'h155C; cosi[139]=16'h1EB6; cosi[140]=16'h26F8; cosi[141]=16'h2E03; cosi[142]=16'h33C0; cosi[143]=16'h3820; + cosi[144]=16'h3B1E; cosi[145]=16'h3CBD; cosi[146]=16'h3D07; cosi[147]=16'h3C0E; cosi[148]=16'h39EF; cosi[149]=16'h36C8; cosi[150]=16'h32C0; cosi[151]=16'h2E02; cosi[152]=16'h28B9; cosi[153]=16'h2314; cosi[154]=16'h1D44; cosi[155]=16'h1775; cosi[156]=16'h11D4; cosi[157]=16'h0C8A; cosi[158]=16'h07BA; cosi[159]=16'h0384; + cosi[160]=16'h0000; cosi[161]=16'hFD41; cosi[162]=16'hFB52; cosi[163]=16'hFA38; cosi[164]=16'hF9F1; cosi[165]=16'hFA73; cosi[166]=16'hFBAF; cosi[167]=16'hFD92; cosi[168]=16'h0000; cosi[169]=16'h02DE; cosi[170]=16'h060D; cosi[171]=16'h096A; cosi[172]=16'h0CD3; cosi[173]=16'h1028; cosi[174]=16'h1349; cosi[175]=16'h1618; + cosi[176]=16'h187D; cosi[177]=16'h1A61; cosi[178]=16'h1BB6; cosi[179]=16'h1C70; cosi[180]=16'h1C8A; cosi[181]=16'h1C04; cosi[182]=16'h1AE6; cosi[183]=16'h193A; cosi[184]=16'h1711; cosi[185]=16'h1480; cosi[186]=16'h11A0; cosi[187]=16'h0E8A; cosi[188]=16'h0B5D; cosi[189]=16'h0836; cosi[190]=16'h0532; cosi[191]=16'h026C; + cosi[192]=16'h0000; cosi[193]=16'hFE03; cosi[194]=16'hFC88; cosi[195]=16'hFB9D; cosi[196]=16'hFB4B; cosi[197]=16'hFB97; cosi[198]=16'hFC7F; cosi[199]=16'hFDFC; cosi[200]=16'h0000; cosi[201]=16'h027C; cosi[202]=16'h0559; cosi[203]=16'h087F; cosi[204]=16'h0BD2; cosi[205]=16'h0F33; cosi[206]=16'h1284; cosi[207]=16'h15A6; + cosi[208]=16'h187D; cosi[209]=16'h1AEC; cosi[210]=16'h1CDD; cosi[211]=16'h1E3B; cosi[212]=16'h1EF7; cosi[213]=16'h1F08; cosi[214]=16'h1E6B; cosi[215]=16'h1D22; cosi[216]=16'h1B35; cosi[217]=16'h18B5; cosi[218]=16'h15B4; cosi[219]=16'h124E; cosi[220]=16'h0EA2; cosi[221]=16'h0AD1; cosi[222]=16'h0701; cosi[223]=16'h0358; + cosi[224]=16'h0000; cosi[225]=16'hFD1E; cosi[226]=16'hFAD7; cosi[227]=16'hF94C; cosi[228]=16'hF89E; cosi[229]=16'hF8E3; cosi[230]=16'hFA2E; cosi[231]=16'hFC8C; cosi[232]=16'h0000; cosi[233]=16'h0488; cosi[234]=16'h0A18; cosi[235]=16'h109E; cosi[236]=16'h17FF; cosi[237]=16'h201A; cosi[238]=16'h28C6; cosi[239]=16'h31D9; + cosi[240]=16'h3B1E; cosi[241]=16'h4464; cosi[242]=16'h4D73; cosi[243]=16'h5615; cosi[244]=16'h5E14; cosi[245]=16'h653E; cosi[246]=16'h6B62; cosi[247]=16'h7057; cosi[248]=16'h73F8; cosi[249]=16'h7628; cosi[250]=16'h76D1; cosi[251]=16'h75E8; cosi[252]=16'h7369; cosi[253]=16'h6F59; cosi[254]=16'h69C6; cosi[255]=16'h62C8; + end + + reg [15:0] sine[0:255]; + initial begin + sine[0]=16'h5A7F; sine[1]=16'h62C8; sine[2]=16'h69C6; sine[3]=16'h6F59; sine[4]=16'h7369; sine[5]=16'h75E8; sine[6]=16'h76D1; sine[7]=16'h7628; sine[8]=16'h73F8; sine[9]=16'h7057; sine[10]=16'h6B62; sine[11]=16'h653E; sine[12]=16'h5E14; sine[13]=16'h5615; sine[14]=16'h4D73; sine[15]=16'h4464; + sine[16]=16'h3B1E; sine[17]=16'h31D9; sine[18]=16'h28C6; sine[19]=16'h201A; sine[20]=16'h17FF; sine[21]=16'h109E; sine[22]=16'h0A18; sine[23]=16'h0488; sine[24]=16'h0000; sine[25]=16'hFC8C; sine[26]=16'hFA2E; sine[27]=16'hF8E3; sine[28]=16'hF89E; sine[29]=16'hF94C; sine[30]=16'hFAD7; sine[31]=16'hFD1E; + sine[32]=16'h0000; sine[33]=16'h0358; sine[34]=16'h0701; sine[35]=16'h0AD1; sine[36]=16'h0EA2; sine[37]=16'h124E; sine[38]=16'h15B4; sine[39]=16'h18B5; sine[40]=16'h1B35; sine[41]=16'h1D22; sine[42]=16'h1E6B; sine[43]=16'h1F08; sine[44]=16'h1EF7; sine[45]=16'h1E3B; sine[46]=16'h1CDD; sine[47]=16'h1AEC; + sine[48]=16'h187D; sine[49]=16'h15A6; sine[50]=16'h1284; sine[51]=16'h0F33; sine[52]=16'h0BD2; sine[53]=16'h087F; sine[54]=16'h0559; sine[55]=16'h027C; sine[56]=16'h0000; sine[57]=16'hFDFC; sine[58]=16'hFC7F; sine[59]=16'hFB97; sine[60]=16'hFB4B; sine[61]=16'hFB9D; sine[62]=16'hFC88; sine[63]=16'hFE03; + sine[64]=16'h0000; sine[65]=16'h026C; sine[66]=16'h0532; sine[67]=16'h0836; sine[68]=16'h0B5D; sine[69]=16'h0E8A; sine[70]=16'h11A0; sine[71]=16'h1480; sine[72]=16'h1711; sine[73]=16'h193A; sine[74]=16'h1AE6; sine[75]=16'h1C04; sine[76]=16'h1C8A; sine[77]=16'h1C70; sine[78]=16'h1BB6; sine[79]=16'h1A61; + sine[80]=16'h187D; sine[81]=16'h1618; sine[82]=16'h1349; sine[83]=16'h1028; sine[84]=16'h0CD3; sine[85]=16'h096A; sine[86]=16'h060D; sine[87]=16'h02DE; sine[88]=16'h0000; sine[89]=16'hFD92; sine[90]=16'hFBAF; sine[91]=16'hFA73; sine[92]=16'hF9F1; sine[93]=16'hFA38; sine[94]=16'hFB52; sine[95]=16'hFD41; + sine[96]=16'h0000; sine[97]=16'h0384; sine[98]=16'h07BA; sine[99]=16'h0C8A; sine[100]=16'h11D4; sine[101]=16'h1775; sine[102]=16'h1D44; sine[103]=16'h2314; sine[104]=16'h28B9; sine[105]=16'h2E02; sine[106]=16'h32C0; sine[107]=16'h36C8; sine[108]=16'h39EF; sine[109]=16'h3C0E; sine[110]=16'h3D07; sine[111]=16'h3CBD; + sine[112]=16'h3B1E; sine[113]=16'h3820; sine[114]=16'h33C0; sine[115]=16'h2E03; sine[116]=16'h26F8; sine[117]=16'h1EB6; sine[118]=16'h155C; sine[119]=16'h0B10; sine[120]=16'h0000; sine[121]=16'hF45D; sine[122]=16'hE85E; sine[123]=16'hDC3C; sine[124]=16'hD032; sine[125]=16'hC47C; sine[126]=16'hB953; sine[127]=16'hAEEF; + sine[128]=16'hA581; sine[129]=16'h9D38; sine[130]=16'h963A; sine[131]=16'h90A7; sine[132]=16'h8C97; sine[133]=16'h8A18; sine[134]=16'h892F; sine[135]=16'h89D8; sine[136]=16'h8C08; sine[137]=16'h8FA9; sine[138]=16'h949E; sine[139]=16'h9AC2; sine[140]=16'hA1EC; sine[141]=16'hA9EB; sine[142]=16'hB28D; sine[143]=16'hBB9C; + sine[144]=16'hC4E2; sine[145]=16'hCE27; sine[146]=16'hD73A; sine[147]=16'hDFE6; sine[148]=16'hE801; sine[149]=16'hEF62; sine[150]=16'hF5E8; sine[151]=16'hFB78; sine[152]=16'h0000; sine[153]=16'h0374; sine[154]=16'h05D2; sine[155]=16'h071D; sine[156]=16'h0762; sine[157]=16'h06B4; sine[158]=16'h0529; sine[159]=16'h02E2; + sine[160]=16'h0000; sine[161]=16'hFCA8; sine[162]=16'hF8FF; sine[163]=16'hF52F; sine[164]=16'hF15E; sine[165]=16'hEDB2; sine[166]=16'hEA4C; sine[167]=16'hE74B; sine[168]=16'hE4CB; sine[169]=16'hE2DE; sine[170]=16'hE195; sine[171]=16'hE0F8; sine[172]=16'hE109; sine[173]=16'hE1C5; sine[174]=16'hE323; sine[175]=16'hE514; + sine[176]=16'hE783; sine[177]=16'hEA5A; sine[178]=16'hED7C; sine[179]=16'hF0CD; sine[180]=16'hF42E; sine[181]=16'hF781; sine[182]=16'hFAA7; sine[183]=16'hFD84; sine[184]=16'h0000; sine[185]=16'h0204; sine[186]=16'h0381; sine[187]=16'h0469; sine[188]=16'h04B5; sine[189]=16'h0463; sine[190]=16'h0378; sine[191]=16'h01FD; + sine[192]=16'h0000; sine[193]=16'hFD94; sine[194]=16'hFACE; sine[195]=16'hF7CA; sine[196]=16'hF4A3; sine[197]=16'hF176; sine[198]=16'hEE60; sine[199]=16'hEB80; sine[200]=16'hE8EF; sine[201]=16'hE6C6; sine[202]=16'hE51A; sine[203]=16'hE3FC; sine[204]=16'hE376; sine[205]=16'hE390; sine[206]=16'hE44A; sine[207]=16'hE59F; + sine[208]=16'hE783; sine[209]=16'hE9E8; sine[210]=16'hECB7; sine[211]=16'hEFD8; sine[212]=16'hF32D; sine[213]=16'hF696; sine[214]=16'hF9F3; sine[215]=16'hFD22; sine[216]=16'h0000; sine[217]=16'h026E; sine[218]=16'h0451; sine[219]=16'h058D; sine[220]=16'h060F; sine[221]=16'h05C8; sine[222]=16'h04AE; sine[223]=16'h02BF; + sine[224]=16'h0000; sine[225]=16'hFC7C; sine[226]=16'hF846; sine[227]=16'hF376; sine[228]=16'hEE2C; sine[229]=16'hE88B; sine[230]=16'hE2BC; sine[231]=16'hDCEC; sine[232]=16'hD747; sine[233]=16'hD1FE; sine[234]=16'hCD40; sine[235]=16'hC938; sine[236]=16'hC611; sine[237]=16'hC3F2; sine[238]=16'hC2F9; sine[239]=16'hC343; + sine[240]=16'hC4E2; sine[241]=16'hC7E0; sine[242]=16'hCC40; sine[243]=16'hD1FD; sine[244]=16'hD908; sine[245]=16'hE14A; sine[246]=16'hEAA4; sine[247]=16'hF4F0; sine[248]=16'h0000; sine[249]=16'h0BA3; sine[250]=16'h17A2; sine[251]=16'h23C4; sine[252]=16'h2FCE; sine[253]=16'h3B84; sine[254]=16'h46AD; sine[255]=16'h5111; + end + + reg [15:0] deltas[0:255]; + initial begin + deltas[0]=16'h0000; deltas[1]=16'h0000; deltas[2]=16'h0000; deltas[3]=16'h0000; + deltas[4]=16'h0000; deltas[5]=16'h0000; deltas[6]=16'h0000; deltas[7]=16'h0000; + deltas[8]=16'h0000; deltas[9]=16'h0000; deltas[10]=16'h0000; deltas[11]=16'h0000; + deltas[12]=16'h0000; deltas[13]=16'h0000; deltas[14]=16'h0000; deltas[15]=16'h0000; + deltas[16]=16'h0000; deltas[17]=16'h0000; deltas[18]=16'h0000; deltas[19]=16'h0000; + deltas[20]=16'h0000; deltas[21]=16'h0000; deltas[22]=16'h0000; deltas[23]=16'h0000; + deltas[24]=16'h0000; deltas[25]=16'h0000; deltas[26]=16'h0000; deltas[27]=16'h0000; + deltas[28]=16'h0000; deltas[29]=16'h0000; deltas[30]=16'h0000; deltas[31]=16'h0000; + deltas[32]=16'h0000; deltas[33]=16'h0000; deltas[34]=16'h0000; deltas[35]=16'h0000; + deltas[36]=16'h0000; deltas[37]=16'h0000; deltas[38]=16'h0000; deltas[39]=16'h0000; + deltas[40]=16'h0000; deltas[41]=16'h0000; deltas[42]=16'h0000; deltas[43]=16'h0000; + deltas[44]=16'h0000; deltas[45]=16'h0000; deltas[46]=16'h0000; deltas[47]=16'h0000; + deltas[48]=16'h0000; deltas[49]=16'h0000; deltas[50]=16'h0000; deltas[51]=16'h0000; + deltas[52]=16'h0000; deltas[53]=16'h0000; deltas[54]=16'h0000; deltas[55]=16'h0000; + deltas[56]=16'h0000; deltas[57]=16'h0000; deltas[58]=16'h0000; deltas[59]=16'h0000; + deltas[60]=16'h0000; deltas[61]=16'h0000; deltas[62]=16'h0000; deltas[63]=16'h0000; + deltas[64]=16'h0000; deltas[65]=16'h0000; deltas[66]=16'h0000; deltas[67]=16'h0000; + deltas[68]=16'h0000; deltas[69]=16'h0000; deltas[70]=16'h0000; deltas[71]=16'h0000; + deltas[72]=16'h0000; deltas[73]=16'h0000; deltas[74]=16'h0000; deltas[75]=16'h0000; + deltas[76]=16'h0000; deltas[77]=16'h0000; deltas[78]=16'h0000; deltas[79]=16'h0000; + deltas[80]=16'h0000; deltas[81]=16'h0000; deltas[82]=16'h0000; deltas[83]=16'h0000; + deltas[84]=16'h0000; deltas[85]=16'h0000; deltas[86]=16'h0000; deltas[87]=16'h0000; + deltas[88]=16'h0000; deltas[89]=16'h0000; deltas[90]=16'h0000; deltas[91]=16'h0000; + deltas[92]=16'h0000; deltas[93]=16'h0000; deltas[94]=16'h0000; deltas[95]=16'h0000; + deltas[96]=16'h0000; deltas[97]=16'h0000; deltas[98]=16'h0000; deltas[99]=16'h0000; + deltas[100]=16'h0000; deltas[101]=16'h0000; deltas[102]=16'h0000; deltas[103]=16'h0000; + deltas[104]=16'h0000; deltas[105]=16'h0000; deltas[106]=16'h0000; deltas[107]=16'h0000; + deltas[108]=16'h0000; deltas[109]=16'h0000; deltas[110]=16'h0000; deltas[111]=16'h0000; + deltas[112]=16'h0000; deltas[113]=16'h0000; deltas[114]=16'h0000; deltas[115]=16'h0000; + deltas[116]=16'h0000; deltas[117]=16'h0000; deltas[118]=16'h0000; deltas[119]=16'h0000; + deltas[120]=16'h0000; deltas[121]=16'h0000; deltas[122]=16'h0000; deltas[123]=16'h0000; + deltas[124]=16'h0000; deltas[125]=16'h0000; deltas[126]=16'h0000; deltas[127]=16'h0000; + deltas[128]=16'h0000; deltas[129]=16'h0000; deltas[130]=16'h0000; deltas[131]=16'h0000; + deltas[132]=16'h0000; deltas[133]=16'h0000; deltas[134]=16'h0000; deltas[135]=16'h0000; + deltas[136]=16'h0000; deltas[137]=16'h0000; deltas[138]=16'h0000; deltas[139]=16'h0000; + deltas[140]=16'h0000; deltas[141]=16'h0000; deltas[142]=16'h0000; deltas[143]=16'h0000; + deltas[144]=16'h0000; deltas[145]=16'h0000; deltas[146]=16'h0000; deltas[147]=16'h0000; + deltas[148]=16'h0000; deltas[149]=16'h0000; deltas[150]=16'h0000; deltas[151]=16'h0000; + deltas[152]=16'h0000; deltas[153]=16'h0000; deltas[154]=16'h0000; deltas[155]=16'h0000; + deltas[156]=16'h0000; deltas[157]=16'h0000; deltas[158]=16'h0000; deltas[159]=16'h0000; + deltas[160]=16'h0000; deltas[161]=16'h0000; deltas[162]=16'h0000; deltas[163]=16'h0000; + deltas[164]=16'h0000; deltas[165]=16'h0000; deltas[166]=16'h0000; deltas[167]=16'h0000; + deltas[168]=16'h0000; deltas[169]=16'h0000; deltas[170]=16'h0000; deltas[171]=16'h0000; + deltas[172]=16'h0000; deltas[173]=16'h0000; deltas[174]=16'h0000; deltas[175]=16'h0000; + deltas[176]=16'h0000; deltas[177]=16'h0000; deltas[178]=16'h0000; deltas[179]=16'h0000; + deltas[180]=16'h0000; deltas[181]=16'h0000; deltas[182]=16'h0000; deltas[183]=16'h0000; + deltas[184]=16'h0000; deltas[185]=16'h0000; deltas[186]=16'h0000; deltas[187]=16'h0000; + deltas[188]=16'h0000; deltas[189]=16'h0000; deltas[190]=16'h0000; deltas[191]=16'h0000; + deltas[192]=16'h0000; deltas[193]=16'h0000; deltas[194]=16'h0000; deltas[195]=16'h0000; + deltas[196]=16'h0000; deltas[197]=16'h0000; deltas[198]=16'h0000; deltas[199]=16'h0000; + deltas[200]=16'h0000; deltas[201]=16'h0000; deltas[202]=16'h0000; deltas[203]=16'h0000; + deltas[204]=16'h0000; deltas[205]=16'h0000; deltas[206]=16'h0000; deltas[207]=16'h0000; + deltas[208]=16'h0000; deltas[209]=16'h0000; deltas[210]=16'h0000; deltas[211]=16'h0000; + deltas[212]=16'h0000; deltas[213]=16'h0000; deltas[214]=16'h0000; deltas[215]=16'h0000; + deltas[216]=16'h0000; deltas[217]=16'h0000; deltas[218]=16'h0000; deltas[219]=16'h0000; + deltas[220]=16'h0000; deltas[221]=16'h0000; deltas[222]=16'h0000; deltas[223]=16'h0000; + deltas[224]=16'h0000; deltas[225]=16'h0000; deltas[226]=16'h0000; deltas[227]=16'h0000; + deltas[228]=16'h0000; deltas[229]=16'h0000; deltas[230]=16'h0000; deltas[231]=16'h0000; + deltas[232]=16'h0000; deltas[233]=16'h0000; deltas[234]=16'h0000; deltas[235]=16'h0000; + deltas[236]=16'h0000; deltas[237]=16'h0000; deltas[238]=16'h0000; deltas[239]=16'h0000; + deltas[240]=16'h0000; deltas[241]=16'h0000; deltas[242]=16'h0000; deltas[243]=16'h0000; + deltas[244]=16'h0000; deltas[245]=16'h0000; deltas[246]=16'h0000; deltas[247]=16'h0000; + deltas[248]=16'h0000; deltas[249]=16'h0000; deltas[250]=16'h0000; deltas[251]=16'h0000; + deltas[252]=16'h0000; deltas[253]=16'h0000; deltas[254]=16'h0000; deltas[255]=16'h0000; + deltas[1]=16'h5A7F; deltas[3]=16'h5A7F; deltas[5]=16'h5A7F; deltas[7]=16'h5A7F; + end + + assign DATA_RE=cosi[ADDR]; + assign DATA_IM=sine[ADDR]; + assign DATA_REF=deltas[ADDR]; +endmodule Index: pipelined_fft_256/trunk/TB/FFT256_TB.v =================================================================== --- pipelined_fft_256/trunk/TB/FFT256_TB.v (nonexistent) +++ pipelined_fft_256/trunk/TB/FFT256_TB.v (revision 2) @@ -0,0 +1,169 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// DESCRIPTION : Testbench for the FFT256_core - FFT 256 processor +// FUNCTION: a set of 4 sine waves is inputted to the FFT processor, +// the results are compared with the expected waves, +// the square root mean error is calculated (without a root) +// FILES: FFT256_TB.v - this file, contains +// FFT256.v - unit under test +// Wave_ROM256.v - rom with the test waveform, generating by +// sinerom256_gen.pl script +// PROPERTIES: 1) the calculated error after ca. 12us modeling +// is outputted to the console as the note: +// rms error is 1 lsb +// 2)if the error is 0,1,2 then the test is OK +// 3) the customer can exchange the test selecting the +// different frequencies and generating the wave ROM by +// the script sinerom256_gen.pl +// 4) the proper operation can be checked by investigation +// of the core output waveforms +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`include "FFT256_CONFIG.inc" + +`timescale 1ns / 1 ps +module FFT256_tb; + //Parameters declaration: + `FFT256paramnb + + //Internal signals declarations: + reg CLK; + reg RST; + reg ED; + reg START; + reg [3:0]SHIFT; + wire [nb-1:0]DR; + wire [nb-1:0]DI; + wire RDY; + wire OVF1; + wire OVF2; + wire [7:0]ADDR; + wire signed [nb+3:0]DOR; + wire signed [nb+3:0]DOI; + + initial + begin + CLK = 1'b0; + forever #5 CLK = ~CLK; + end + + initial + begin + SHIFT = 4'b0000; + ED = 1'b1; + RST = 1'b0; + START = 1'b0; + #13 RST =1'b1; + #43 RST =1'b0; + #53 START =1'b1; + #12 START =1'b0; + end + + //initial //ED testing +// begin +// #1 ED = 1'b0; +// forever #10 ED = ~ED; +// end + + reg [7:0] ct256; + always @(posedge CLK or posedge START) + if (ED) begin + if (START) ct256 = 8'b0000_0000; + else ct256 = ct256+ 'd1; + end + + wire [15:0] D_R,D_I,DATA_0; + Wave_ROM256 UG( .ADDR(ct256) , + .DATA_RE(D_R), .DATA_IM(D_I), .DATA_REF(DATA_0) );// + + assign DR=(D_R[15]&&(nb!=16))? (D_R[15:15-nb+1]+1) : D_R[15:15-nb+1]; + assign DI=(D_I[15]&&(nb!=16))? (D_I[15:15-nb+1]+1) : D_I[15:15-nb+1]; + + // Unit Under Test + FFT256 UUT ( + .CLK(CLK), + .RST(RST), + .ED(ED), + .START(START), + .SHIFT(SHIFT), + .DR(DR), + .DI(DI), + .RDY(RDY), + .OVF1(OVF1), + .OVF2(OVF2), + .ADDR(ADDR), + .DOR(DOR), + .DOI(DOI)); + + wire [7:0] addrr; + `ifdef FFT256paramifft + assign addrr= (256-ADDR); //the result order if IFFT + `else + assign addrr= ADDR; + `endif + + + wire signed [15:0] DATA_R0,DATA_I0,DATA_REF; + Wave_ROM256 UR( .ADDR(addrr) , + .DATA_RE(DATA_R0), .DATA_IM(DATA_I0), .DATA_REF(DATA_REF) );// + + wire signed [18:15-nb+1] DREF=2*DATA_REF[15:15-nb+1]; + + integer sqra; + integer ctres; + reg f; + initial f=0; + always@(posedge CLK) begin //SQR calculator + if(ED) begin + if (f) + ctres=ctres+1; + if (RST || RDY) begin + if (RDY) f=1; + sqra=0; + ctres=0; end + else if (ctres<256) begin + //considered that input phase is 45 deg. ie. DOI=DOR + #2 sqra = sqra +(DREF-DOR)*(DREF-DOR); + #2 sqra = sqra +(DREF-DOI)*(DREF-DOI); end + else if (ctres==256) + $display("rms error is ", (sqra/512), " lsb"); + end end + + +endmodule Index: pipelined_fft_256/trunk/TB/sinerom256_gen.pl =================================================================== --- pipelined_fft_256/trunk/TB/sinerom256_gen.pl (nonexistent) +++ pipelined_fft_256/trunk/TB/sinerom256_gen.pl (revision 2) @@ -0,0 +1,145 @@ + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright(c) 2007 by Unicore Systems. All rights reserved +# +# DESIGN : UNFFT64_core +# FILENAME : sinerom64_gen.pl +# CREATED : 1.11:2007 +# MODIFIED : +# VERSION : 1.0 +# +# AUTHORS: Anatolij Sergiyenko. +# HISTORY : +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# DESCRIPTION : Test generating PERL file1 +# FUNCTION: Generating sine wave ROM +# with $n samples which consists of 4 sine wave sum +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +$aw=8; ## - address bit width +$n = 256; ### - period length +$n0 = 0; ### - init address +$f1 = 1; ## - first frequency +$f2 = 3; ## -second frequency +$f3 = 5; ## - 3-d frequency +$f4 = 7; ## -4-th frequency +$Pi = 3.14159265358 ; +$ph =$Pi/4; ## initial phase => 45 degree + open OutFile, ">Wave_ROM256.v" || die "Cannot open file .V"; # file is open to write + + + print OutFile "//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"; + print OutFile "// ROM with ".$n." samples of the sine waves at the frequencies = ".$f1.", ". $f2.",". $f3." and ".$f4 ."\n"; + print OutFile "//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"; + print OutFile " `timescale 1 ns / 1 ps \n"; + print OutFile "module Wave_ROM256 ( ADDR ,DATA_RE,DATA_IM,DATA_REF ); \n"; + print OutFile " output [15:0] DATA_RE,DATA_IM,DATA_REF ; \n"; + print OutFile " input [".($aw-1).":0] ADDR ; \n"; + + +# # Cosine table generation + print OutFile " reg [15:0] cosi[0:".($n-1)."]; \n"; + print OutFile " initial begin \n"; + for $j(0..$n/16-1){ + $cos_row=0; + for $i(0..15){ +# $CosArr=(32767*cos(2*$Pi*$f1*(($n0+$i+16*$j)/$n))); #23170 +# $CosArr=(16384*cos(2*$Pi*$f1*(($n0+$i+$j*16)/$n))); +# +16383*cos(2*$Pi*$f2*(($n0+$i+$j*16)/$n))); + $CosArr=(8191*cos($ph+2*$Pi*$f1*(($n0+$i+$j*16)/$n)) + +8191*cos($ph+2*$Pi*$f2*(($n0+$i+$j*16)/$n)) + +8191*cos($ph+2*$Pi*$f3*(($n0+$i+$j*16)/$n)) + +8191*cos($ph+2*$Pi*$f4*(($n0+$i+$j*16)/$n))); + $sinv= To_Hex4(int ($CosArr)); + + print OutFile " cosi[".($n0+$i+$j*16)."]=16'h".$sinv.";"; +} +print OutFile "\n"; +} +print OutFile " end \n\n"; + print "\n"; +# # Sine table generation + print OutFile " reg [15:0] sine[0:".($n-1)."]; \n"; + print OutFile " initial begin \n"; + for $j(0..$n/16-1){ + $sin_row=0; + for $i(0..15){ +# $SinArr=(32767*sin(2*$Pi*$f1*(($n0+$i+16*$j)/$n))); #16384 23170 +# $SinArr=(16384*sin(2*$Pi*$f1*(($n0+$i+$j*16)/$n))); # +# +16383*sin(2*$Pi*$f2*(($n0+$i+$j*16)/$n))); + $SinArr=(8191*sin($ph+2*$Pi*$f1*(($n0+$i+$j*16)/$n)) + +8191*sin($ph+2*$Pi*$f2*(($n0+$i+$j*16)/$n)) + +8191*sin($ph+2*$Pi*$f3*(($n0+$i+$j*16)/$n)) + +8191*sin($ph+2*$Pi*$f4*(($n0+$i+$j*16)/$n))); + + + $sinv= To_Hex4(int ($SinArr)); + + print OutFile " sine[".($n0+$i+$j*16)."]=16'h".$sinv.";"; +} +print OutFile "\n"; +} + print "\n"; +print OutFile " end \n\n"; + +##Reference table generation + print OutFile " reg [15:0] deltas[0:".($n-1)."]; \n"; + print OutFile " initial begin \n"; + for $j(0..$n/4-1){ + for $i(0..3){ + print OutFile " deltas[".($n0+$i+$j*4)."]=16'h0000;"; +} +print OutFile "\n"; +} +##print OutFile " deltas[".$f1."]=16'h3fff; deltas[".$f2."]=16'h3fff;\n"; +$SinMag=To_Hex4(int (8191*4*sin($ph))); + +print OutFile " deltas[".$f1."]=16'h".$SinMag."; deltas[".$f2."]=16'h".$SinMag."; deltas[".$f3."]=16'h".$SinMag."; deltas[".$f4."]=16'h".$SinMag.";\n"; +print OutFile " end \n\n"; + +print OutFile " assign DATA_RE=cosi[ADDR]; \n"; +print OutFile " assign DATA_IM=sine[ADDR]; \n"; +print OutFile " assign DATA_REF=deltas[ADDR]; \n"; +print OutFile "endmodule \n"; + + close(OutFile); + + + sub To_Hex2{ + my(%Hexnumbers)= (0,0,1,1,2,2,3,3, + 4,4,5,5,6,6,7,7, + 8,8,9,9,10,'A',11,'B', + 12,'C',13,'D',14,'E',15,'F'); + + $_[0]=($_[0]>=0) ? $_[0] : 256+$_[0]; + my($h21)=$_[0] % 16; + my($h22)=int($_[0] / 16); + return $Hexnumbers{$h22}.$Hexnumbers{$h21}; + }; + + sub To_Hex4{ + my(%Hexnumbers)= (0,0,1,1,2,2,3,3, + 4,4,5,5,6,6,7,7, + 8,8,9,9,10,'A',11,'B', + 12,'C',13,'D',14,'E',15,'F'); + + $_[0]=($_[0]>=0) ? $_[0] : 65536+$_[0]; + my($h21)=$_[0] % 16; + my($r21)=int($_[0] / 16); + my($h22)=$r21 % 16; + my($r22)=int($r21 / 16); + my($h23)=$r22 % 16; + my($h24)=int($r22 / 16); + return $Hexnumbers{$h24}.$Hexnumbers{$h23}.$Hexnumbers{$h22}.$Hexnumbers{$h21}; + ##return $_[0]; + }; + + open (File, "Wave_ROM256.v") || die "Cannot open r"; + while ($line = ) + { + print $line; # Ready file output to the screen + } + + + close(File); Index: pipelined_fft_256/trunk/SRC/bufram256c.v =================================================================== --- pipelined_fft_256/trunk/SRC/bufram256c.v (nonexistent) +++ pipelined_fft_256/trunk/SRC/bufram256c.v (revision 2) @@ -0,0 +1,112 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// DESCRIPTION : Store buffer +// FUNCTION: FIFO - buffer with direct input order and 8-th inverse output order +// FILES: BUFRAM@56C.v - 1-st,2-nd,3-d data buffer, contains: +// RAM2x256C.v - dual ported synchronous RAM, contains: +// RAM256.v -single ported synchronous RAM +// PROPERTIES: 1) Has the volume of 2x256 complex data +// 2) Contains 2- port RAM and address counter +// 3)Has 256-clock cycle period starting with the START impulse +// and continuing forever +// 4) Signal RDY precedes the 1-st correct datum outputted from the buffer +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`timescale 1 ns / 1 ps +`include "FFT256_CONFIG.inc" + +module BUFRAM256C ( CLK ,RST ,ED ,START ,DR ,DI ,RDY ,DOR ,DOI ); + `FFT256paramnb + output RDY ; + reg RDY ; + output [nb-1:0] DOR ; + wire [nb-1:0] DOR ; + output [nb-1:0] DOI ; + wire [nb-1:0] DOI ; + + input CLK ; + wire CLK ; + input RST ; + wire RST ; + input ED ; + wire ED ; + input START ; + wire START ; + input [nb-1:0] DR ; + wire [nb-1:0] DR ; + input [nb-1:0] DI ; + wire [nb-1:0] DI ; + + wire odd, we; + wire [7:0] addrw,addrr; + reg [8:0] addr; + reg [9:0] ct2; //counter for the RDY signal + + always @(posedge CLK) // CTADDR + begin + if (RST) begin + addr<=8'b0000_0000; + ct2<= 9'b10000_0001; + RDY<=1'b0; end + else if (START) begin + addr<=8'b0000_0000; + ct2<= 8'b0000_0000; + RDY<=1'b0;end + else if (ED) begin + RDY<=1'b0; + addr<=addr+1; + if (ct2!=257) + ct2<=ct2+1; + if (ct2==256) + RDY<=1'b1; + end + end + + +assign addrw= addr[7:0]; +assign odd=addr[8]; // signal which switches the 2 parts of the buffer +assign addrr={addr[3 : 0], addr[7 : 4]}; // 16-th inverse output address +assign we = ED; + + RAM2x256C #(nb) URAM(.CLK(CLK),.ED(ED),.WE(we),.ODD(odd), + .ADDRW(addrw), .ADDRR(addrr), + .DR(DR),.DI(DI), + .DOR(DOR), .DOI(DOI)); + +endmodule Index: pipelined_fft_256/trunk/SRC/fft256.v =================================================================== --- pipelined_fft_256/trunk/SRC/fft256.v (nonexistent) +++ pipelined_fft_256/trunk/SRC/fft256.v (revision 2) @@ -0,0 +1,187 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// DESCRIPTION : Top level of the high speed FFT core +// FUNCTION: Structural model of the high speed 256-complex point FFT +// core intended for synthesizing +// for any type FPGAs and ASIC. +// FILES: FFT256.v - root unit, this file, +// FFT256_CONFIG.inc - core configuration file +// BUFRAM256C.v - 1-st,2-nd,3-d data buffer, contains: +// RAM2x256C.v - dual ported synchronous RAM, contains: +// RAM256.v -single ported synchronous RAM +// FFT16.v- 1-st,2-nd stages implementing 16-point FFTs, contains +// MPU707.v, MPU707_2.v - multiplier to the factor 0.707. +// ROTATOR256.v - unit for rotating complex vectors, contains +// WROM256.v - ROM of twiddle factors. +// CNORM.v - normalization stages +// UNFFT256_TB.v - testbench file, includes: +// Wave_ROM256.v - ROM with input data and result reference data +// SineROM256_gen.pl - PERL script to generate the Wave_ROM256.v file +// +// PROPERTIES: 1. Fully pipelined, 1 complex data in, 1 complex result out each clock cycle +// 2. Input data, output data, coefficient widths are adjustable in range 8..16 +// 3. Normalization stages trigger the data overflow and shift data right +// to prevent the overflow +// 4. Core can contain 2 or 3 data buffers. In the configuration of 2 buffers +// the results are in the shuffled order but provided with the proper address. +// 5. The core operation can be slowed down by the control of the ED input +// 6. The reset RST is synchronous one +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`timescale 1 ns / 1 ps +`include "FFT256_CONFIG.inc" + +module FFT256 ( CLK ,RST ,ED ,START ,SHIFT ,DR ,DI ,RDY ,OVF1 ,OVF2 ,ADDR ,DOR ,DOI ); + `FFT256paramnb //nb is the data bit width + + output RDY ; // in the next cycle after RDY=1 the 0-th result is present + wire RDY ; + output OVF1 ; // 1 signals that an overflow occured in the 1-st stage + wire OVF1 ; + output OVF2 ; // 1 signals that an overflow occured in the 2-nd stage + wire OVF2 ; + output [7:0] ADDR ; //result data address/number + wire [7:0] ADDR ; + output [nb+3:0] DOR ;//Real part of the output data, + wire [nb+3:0] DOR ; // the bit width is nb+4, can be decreased when instantiating the core + output [nb+3:0] DOI ;//Imaginary part of the output data + wire [nb+3:0] DOI ; + + input CLK ; //Clock signal is less than 300 MHz for the Xilinx Virtex5 FPGA + wire CLK ; + input RST ; //Reset signal, is the synchronous one with respect to CLK + wire RST ; + input ED ; //=1 enables the operation (eneabling CLK) + wire ED ; + input START ; // its falling edge starts the transform or the serie of transforms + wire START ; // and resets the overflow detectors + input [3:0] SHIFT ; // bits 1,0 -shift left code in the 1-st stage + wire [3:0] SHIFT ; // bits 3,2 -shift left code in the 2-nd stage + input [nb-1:0] DR ; // Real part of the input data, 0-th data goes just after + wire [nb-1:0] DR ; // the START signal or after 255-th data of the previous transform + input [nb-1:0] DI ; //Imaginary part of the input data + wire [nb-1:0] DI ; + + wire [nb-1:0] dr1,di1; + wire [nb+1:0] dr3,di3,dr4,di4, dr5,di5 ; + wire [nb+3:0] dr2,di2; + wire [nb+5:0] dr6,di6; + wire [nb+3:0] dr7,di7,dr8,di8; + wire rdy1,rdy2,rdy3,rdy4,rdy5,rdy6,rdy7,rdy8; + reg [7:0] addri ; + // input buffer =8-bit inversion ordering + BUFRAM256C #(nb) U_BUF1(.CLK(CLK), .RST(RST), .ED(ED), .START(START), + .DR(DR), .DI(DI), .RDY(rdy1), .DOR(dr1), .DOI(di1)); + + //1-st stage of FFT + FFT16 #(nb) U_FFT1(.CLK(CLK), .RST(RST), .ED(ED), + .START(rdy1),.DIR(dr1),.DII(di1), + .RDY(rdy2), .DOR(dr2),. DOI(di2)); + + wire [1:0] shiftl= SHIFT[1:0]; + CNORM #(nb) U_NORM1( .CLK(CLK), .ED(ED), //1-st normalization unit + .START(rdy2), // overflow detector reset + .DR(dr2), .DI(di2), + .SHIFT(shiftl), //shift left bit number + .OVF(OVF1), + .RDY(rdy3), + .DOR(dr3),.DOI(di3)); + + // rotator to the angles proportional to PI/32 + ROTATOR64 #(nb+2) U_MPU (.CLK(CLK),.RST(RST),.ED(ED), + .START(rdy3),. DR(dr3),.DI(di3), + .RDY(rdy4), .DOR(dr4), .DOI(di4)); + + BUFRAM256C #(nb+2) U_BUF2(.CLK(CLK),.RST(RST),.ED(ED), // intermediate buffer =8-bit inversion ordering + .START(rdy4),. DR(dr4),.DI(di4), + .RDY(rdy5), .DOR(dr5), .DOI(di5)); + + //2-nd stage of FFT + FFT16 #(nb+2) U_FFT2(.CLK(CLK), .RST(RST), .ED(ED), + .START(rdy5),. DIR(dr5),.DII(di5), + .RDY(rdy6), .DOR(dr6), .DOI(di6)); + + wire [1:0] shifth= SHIFT[3:2]; + //2-nd normalization unit + CNORM #(nb+2) U_NORM2 ( .CLK(CLK), .ED(ED), + .START(rdy6), // overflow detector reset + .DR(dr6), .DI(di6), + .SHIFT(shifth), //shift left bit number + .OVF(OVF2), + .RDY(rdy7), + .DOR(dr7), .DOI(di7)); + + + BUFRAM256C #(nb+4) Ubuf3(.CLK(CLK),.RST(RST),.ED(ED), // intermediate buffer =8-bit inversion ordering + .START(rdy7),. DR(dr7),.DI(di7), + .RDY(rdy8), .DOR(dr8), .DOI(di8)); + + + + + `ifdef FFT256parambuffers3 // 3-data buffer configuratiion + always @(posedge CLK) begin //POINTER to the result samples + if (RST) + addri<=8'b0000_0000; + else if (rdy8==1 ) + addri<=8'b0000_0000; + else if (ED) + addri<=addri+1; + end + + assign ADDR= addri ; + assign DOR=dr8; + assign DOI=di8; + assign RDY=rdy8; + + `else + always @(posedge CLK) begin //POINTER to the result samples + if (RST) + addri<=8'b0000_0000; + else if (rdy7) + addri<=8'b0000_0000; + else if (ED) + addri<=addri+1; + end + assign #1 ADDR= {addri[3:0] , addri[7:4]} ; + assign #2 DOR= dr7; + assign #2 DOI= di7; + assign RDY= rdy7; + `endif +endmodule Index: pipelined_fft_256/trunk/SRC/ram256.v =================================================================== --- pipelined_fft_256/trunk/SRC/ram256.v (nonexistent) +++ pipelined_fft_256/trunk/SRC/ram256.v (revision 2) @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// DESCRIPTION : 1-port synchronous RAM +// FUNCTION: 1-port synchronous RAM +// FILES: RAM256.v -single ported synchronous RAM +// PROPERTIES: 1) Has the volume of 256 data +// 2) RAM is synchronous one, the read datum is outputted in 2 cycles after the address setting +// 3) Can be substituted to any 2-port synchronous RAM +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`timescale 1 ns / 1 ps +`include "FFT256_CONFIG.inc" + +module RAM256 ( CLK, ED,WE ,ADDR ,DI ,DO ); + `FFT256paramnb + + output [nb-1:0] DO ; + reg [nb-1:0] DO ; + input CLK ; + wire CLK ; + input ED; + input WE ; + wire WE ; + input [7:0] ADDR ; + wire [7:0] ADDR ; + input [nb-1:0] DI ; + wire [nb-1:0] DI ; + reg [nb-1:0] mem [255:0]; + reg [7:0] addrrd; + + always @(posedge CLK) begin + if (ED) begin + if (WE) mem[ADDR] <= DI; + addrrd <= ADDR; //storing the address + DO <= mem[addrrd]; // registering the read datum + end + end + + +endmodule Index: pipelined_fft_256/trunk/SRC/rotator256_v.v =================================================================== --- pipelined_fft_256/trunk/SRC/rotator256_v.v (nonexistent) +++ pipelined_fft_256/trunk/SRC/rotator256_v.v (revision 2) @@ -0,0 +1,132 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// DESCRIPTION : rotating unit, stays between 2 stages of FFT pipeline +// FUNCTION: complex multiplication to the twiddle factors proper to the 64 point FFT +// for any type FPGAs and ASIC. +// FILES: ROTATOR256_v.v - this file, +// WROM256.v - ROM of twiddle factors. +// PROPERTIES: 1) Has 256-clock cycle period starting with the START impulse +// and continuing forever +// 2) rounding is not used +// 3)intended for synthesizing +// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`timescale 1ns / 1ps +`include "FFT256_CONFIG.inc" + +module ROTATOR64 (CLK ,RST,ED,START, DR,DI, DOR, DOI,RDY ); + `FFT256paramnb + `FFT256paramnw + + input RST ; + wire RST ; + input CLK ; + wire CLK ; + input ED ; //operation enable + input [nb-1:0] DI; //Imaginary part of data + wire [nb-1:0] DI ; + input [nb-1:0] DR ; //Real part of data + input START ; //1-st Data is entered after this impulse + wire START ; + + output [nb-1:0] DOI ; //Imaginary part of data + wire [nb-1:0] DOI ; + output [nb-1:0] DOR ; //Real part of data + wire [nb-1:0] DOR ; + output RDY ; //repeats START impulse following the output data + reg RDY ; + + + reg [7:0] addrw; + reg sd1,sd2; + always @( posedge CLK) //address counter for twiddle factors + begin + if (RST) begin + addrw<=0; + sd1<=0; + sd2<=0; + end + else if (START && ED) begin + addrw[7:0]<=0; + sd1<=START; + sd2<=0; + end + else if (ED) begin + addrw<=addrw+1; + sd1<=START; + sd2<=sd1; + RDY<=sd2; + end + end + + wire signed [nw-1:0] wr,wi; //twiddle factor coefficients + //twiddle factor ROM + WROM256 UROM( .ADDR(addrw), .WR(wr),.WI(wi) ); + + + reg signed [nb-1 : 0] drd,did; + reg signed [nw-1 : 0] wrd,wid; + wire signed [nw+nb-1 : 0] drri,drii,diri,diii; + reg signed [nb:0] drr,dri,dir,dii,dwr,dwi; + + assign drri=drd*wrd; + assign diri=did*wrd; + assign drii=drd*wid; + assign diii=did*wid; + + always @(posedge CLK) //complex multiplier + begin + if (ED) begin + drd<=DR; + did<=DI; + wrd<=wr; + wid<=wi; + drr<=drri[nw+nb-1 :nw-1]; //msbs of multiplications are stored + dri<=drii[nw+nb-1 : nw-1]; + dir<=diri[nw+nb-1 : nw-1]; + dii<=diii[nw+nb-1 : nw-1]; + dwr<=drr - dii; + dwi<=dri + dir; + end + end + assign DOR=dwr[nb:1]; + assign DOI=dwi[nb:1]; + +endmodule Index: pipelined_fft_256/trunk/SRC/cnorm.v =================================================================== --- pipelined_fft_256/trunk/SRC/cnorm.v (nonexistent) +++ pipelined_fft_256/trunk/SRC/cnorm.v (revision 2) @@ -0,0 +1,131 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// DESCRIPTION : Normalization unit +// FUNCTION: shifting left up to 3 bits +// FILES: CNORM.v +// PROPERTIES: 1) shifting left up to 3 bits controlled by the 2-bit code SHIFT +// 2) Is registered +// 3) Overflow detector detects the overflow event +// by the given shift condition. The detector is zeroed by the START signal +// 4) RDY is the START signal delayed to a single clock cycle +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// File : +// Generated : +// +// Description : +// +//----------------------------------------------------------------------------- +`timescale 1 ns / 1 ps +`include "FFT256_CONFIG.inc" + +module CNORM ( CLK ,ED ,START ,DR ,DI ,SHIFT ,OVF ,RDY ,DOR ,DOI ); + `FFT256paramnb + + output OVF ; + reg OVF ; + output RDY ; + reg RDY ; + output [nb+1:0] DOR ; + wire [nb+1:0] DOR ; + output [nb+1:0] DOI ; + wire [nb+1:0] DOI ; + + input CLK ; + wire CLK ; + input ED ; + wire ED ; + input START ; + wire START ; + input [nb+3:0] DR ; + wire [nb+3:0] DR ; + input [nb+3:0] DI ; + wire [nb+3:0] DI ; + input [1:0] SHIFT ; //shift left code to 0,1,2,3 bits + wire [1:0] SHIFT ; + +wire signed [nb+3:0] diri,diii; +assign diri = DR << SHIFT; +assign diii = DI << SHIFT; + +reg [nb+3:0] dir,dii; + +`ifdef FFT256round //rounding + always @( posedge CLK ) begin + if (ED) begin + dir<=diri; + dii<=diii; + end + end + +`else //truncation + always @( posedge CLK ) begin + if (ED) begin + if (diri[nb+3] && ~diri[0]) // <0 with LSB=00 + dir<=diri; + else dir<=diri+2; + if (diii[nb+3] && ~diii[0]) + dii<=diii; + else dii<=diii+2; + end + end + + `endif + + always @( posedge CLK ) begin + if (ED) begin + RDY<=START; + if (START) + OVF<=0; + else + case (SHIFT) + 2'b01 : OVF<= (DR[nb+3] != DR[nb+2]) || (DI[nb+3] != DI[nb+2]); + 2'b10 : OVF<= (DR[nb+3] != DR[nb+2]) || (DI[nb+3] != DI[nb+2]) || + (DR[nb+3] != DR[nb+1]) || (DI[nb+3] != DI[nb+1]); + 2'b11 : OVF<= (DR[nb+3] != DR[nb+2]) || (DI[nb+3] != DI[nb+2])|| + (DR[nb+3] != DR[nb]) || (DI[nb+3] != DI[nb]) || + (DR[nb+3] != DR[nb+1]) || (DI[nb+3] != DI[nb+1]); + endcase + end + end + + assign DOR= dir[nb+3:2]; + assign DOI= dii[nb+3:2]; + +endmodule Index: pipelined_fft_256/trunk/SRC/mpuc541.v =================================================================== --- pipelined_fft_256/trunk/SRC/mpuc541.v (nonexistent) +++ pipelined_fft_256/trunk/SRC/mpuc541.v (revision 2) @@ -0,0 +1,126 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// DESCRIPTION : Complex Multiplier by 0.5411 +// FUNCTION: Constant multiplier to cos(PI/8)-cos(3*PI/8) =0.5411 +// FILES: MPUС541.v +// PROPERTIES: 1) Is based on shifts right and add +// 2) for short input bit width 0.541 is approximated as 0_1000_1010_1 +// 3) for medium bit width 1.3066 is approximated as 0_1000_1010_1001 +// 4) for long bit width 1.30656 is approximated as 0_1000_1010_1000_11 +// 5) hardware is 3,or4, or 5 adders +1 +// 6) MPYJ switches multiply by j +// 6) A complex data is multiplied for 2 cycles, latent delay=4 +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`include "FFT256_CONFIG.inc" + +module MPUC541 ( CLK,EI ,ED, MPYJ,DR,DI ,DOR ,DOI, ); + `FFT256paramnb + + input CLK ; + wire CLK ; + input EI ; + wire EI ; + input ED; //data strobe + input MPYJ ; //the result is multiplied by -j + wire MPYJ ; + input [nb-1:0] DR ; + wire signed [nb-1:0] DR ; + input [nb-1:0] DI ; + wire signed [nb-1:0] DI ; + + output [nb-1:0] DOR ; + reg [nb-1:0] DOR ; + output [nb-1:0] DOI ; + reg [nb-1:0] DOI ; + + reg signed [nb :0] dx5; + reg signed [nb :0] dx3; + reg signed [nb-1 :0] dii; + reg signed [nb-1 : 0] dt; + wire signed [nb+1 : 0] dx5p; + wire signed [nb+1 : 0] dot; + reg edd,edd2, edd3; //delayed data enable impulse + reg mpyjd,mpyjd2,mpyjd3; + reg [nb-1:0] doo ; + reg [nb-1:0] droo ; + + always @(posedge CLK) + begin + if (EI) begin + edd<=ED; + edd2<=edd; + edd3<=edd2; + mpyjd<=MPYJ; + mpyjd2<=mpyjd; + mpyjd3<=mpyjd2; + if (ED) begin // 0_1000_1010_1000_11 + dx5<=DR+(DR >>>2); //multiply by 5 + dx3<=DR+(DR >>>1); //multiply by 3, + dt<=DR; + dii<=DI; + end + else begin + dx5<=dii+(dii >>>2); //multiply by 5 + dx3<=dii +(dii >>>1); //multiply by 3 + dt<=dii; + end + doo<=dot >>>2; + droo<=doo; + if (edd3) + if (mpyjd3) begin + DOR<=doo; + DOI<= - droo; end + else begin + DOR<=droo; + DOI<= doo; end + end + end + + assign dx5p=(dt<<1)+(dx5>>>3); // multiply by 0_1000_101 + + `ifdef FFT256bitwidth_coef_high + assign dot= (dx5p+(dt>>>7) +(dx3>>>11));// multiply by // 0_1000_1010_1000_11 + `else + assign dot= dx5p+(dt>>>7); + `endif + + + +endmodule Index: pipelined_fft_256/trunk/SRC/mpuc1307.v =================================================================== --- pipelined_fft_256/trunk/SRC/mpuc1307.v (nonexistent) +++ pipelined_fft_256/trunk/SRC/mpuc1307.v (revision 2) @@ -0,0 +1,126 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// DESCRIPTION : Complex Multiplier by 0.7071 +// FUNCTION: Constant multiplier to cos(PI/8)+cos(3*PI/8) =1.307 +// FILES: MPUС1307.v +// PROPERTIES: 1) Is based on shifts right and add +// 2) for short input bit width 1.307 is approximated as 1_0100_111 = 1_0101_00T +// 3) for medium bit width 1.3066 is approximated as 1_0100_1110_0111_11= 1_0101_00T0_1000_0T +// 4) for long bit width 1.30656 is approximated as 1_0100_1110_0111_1011=1_0101_00T0_1000_0T0T +// 5) hardware is 3 or 5, or 6 adders +1 +// 6) MPYJ switches multiply by j +// 6) A complex data is multiplied for 2 cycles, latent delay=4 +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`include "FFT256_CONFIG.inc" + +module MPUC1307 ( CLK,EI ,ED, MPYJ,DR,DI ,DOR ,DOI, ); + `FFT256paramnb + + input CLK ; + wire CLK ; + input EI ; + wire EI ; + input ED; //data strobe + input MPYJ ; //the result is multiplied by -j + wire MPYJ ; + input [nb-1:0] DR ; + wire signed [nb-1:0] DR ; + input [nb-1:0] DI ; + wire signed [nb-1:0] DI ; + + output [nb:0] DOR ; + reg [nb:0] DOR ; + output [nb:0] DOI ; + reg [nb:0] DOI ; + + reg signed [nb+2 :0] dx5; + reg signed [nb-1 :0] dx7; + reg signed [nb-1 :0] dii; + reg signed [nb : 0] dt; + wire signed [nb+3 : 0] dx5p; + wire signed [nb+3 : 0] dot; + reg edd,edd2, edd3; //delayed data enable impulse + reg mpyjd,mpyjd2,mpyjd3; + reg [nb:0] doo ; + reg [nb:0] droo ; + + always @(posedge CLK) + begin + if (EI) begin + edd<=ED; + edd2<=edd; + edd3<=edd2; + mpyjd<=MPYJ; + mpyjd2<=mpyjd; + mpyjd3<=mpyjd2; //1_0100_1110_0111_1011 + if (ED) begin // 1_0101_00T0_1000_0T0T + dx5<=DR+(DR <<2); //multiply by 5 + dx7<=DR-(DR>>>3); //multiply by 7, shifted right to 2 + dt<=DR; + dii<=DI; + end + else begin + dx5<=dii+(dii <<2); //multiply by 5 + dx7<=dii-(dii>>>3); //multiply by 7, shifted right to 3 + dt<=dii; + end + doo<=dot >>>3; + droo<=doo; + if (edd3) + if (mpyjd3) begin + DOR<=doo; + DOI<= - droo; end + else begin + DOR<=droo; + DOI<= doo; end + end + end + + assign dx5p=(dx5<<1)+(dx7>>>1); // multiply by 1_0101_00T + + `ifdef FFT256bitwidth_coef_high + assign dot= (dx5p+(dt>>>6) -(dx5>>>13));// multiply by 1_0101_00T0_1000_0T0T + `else + assign dot= dx5p+(dt>>>6); + `endif + + + +endmodule Index: pipelined_fft_256/trunk/SRC/mpuc924_383.v =================================================================== --- pipelined_fft_256/trunk/SRC/mpuc924_383.v (nonexistent) +++ pipelined_fft_256/trunk/SRC/mpuc924_383.v (revision 2) @@ -0,0 +1,136 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// DESCRIPTION : Complex Multiplier by 0.924 +// FUNCTION: Constant multiplier to cos(PI/8)-cos(3*PI/8) =0.9239 +// FILES: MPUС924.v +// PROPERTIES: 1) Is based on shifts right and add +// 2) for short input bit width 0.924 is approximated as 0.1110_1100_1 =1_00T0_1100_1 +// 3) for long bit width 0.9239 is appr. as 0.1110_1100_1000_0011 =1_00T0_1100_1000_0011 +// 4) for short input bit width 0.383 is approximated as 0_0110_001 +// 5) for long bit width 0.3827 is approximated as 0_0110_0001_1111_1 = 0_0110_0010_0000_T// 4) hardware is 4, or 5 adders +1 +// 6) MPYJ switches multiply by j , C383=1 selects the coefficient 0.383 +// 7) A complex data is multiplied for 2 cycles, latent delay=4 +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`include "FFT256_CONFIG.inc" + +module MPUC924_383 ( CLK,EI ,ED, MPYJ,C383,DR,DI ,DOR ,DOI, ); + `FFT256paramnb + + input CLK ; + wire CLK ; + input EI ; + wire EI ; + input ED; //data strobe + input MPYJ ; //the result is multiplied by -j + wire MPYJ ; + input C383 ; //the coefficient is 0.383 + wire C383 ; + input [nb-1:0] DR ; + wire signed [nb-1:0] DR ; + input [nb-1:0] DI ; + wire signed [nb-1:0] DI ; + + output [nb-1:0] DOR ; + reg [nb-1:0] DOR ; + output [nb-1:0] DOI ; + reg [nb-1:0] DOI ; + + reg signed [nb+1 :0] dx7; + reg signed [nb :0] dx3; + reg signed [nb-1 :0] dii; + reg signed [nb-1 : 0] dt; + wire signed [nb+1 : 0] dx5p; + wire signed [nb+1 : 0] dot; + reg edd,edd2, edd3; //delayed data enable impulse + reg mpyjd,mpyjd2,mpyjd3,c3d,c3d2,c3d3; + reg [nb-1:0] doo ; + reg [nb-1:0] droo ; + + always @(posedge CLK) + begin + if (EI) begin + edd<=ED; + edd2<=edd; + edd3<=edd2; + mpyjd<=MPYJ; + mpyjd2<=mpyjd; + mpyjd3<=mpyjd2; + c3d<=C383; + c3d2<=c3d; + c3d3<=c3d2; + if (ED) begin // 1_00T0_1100_1000_0011 + dx7<=(DR<<2) - (DR >>>1); //multiply by 7 + dx3<=DR+(DR >>>1); //multiply by 3, + dt<=DR; + dii<=DI; + end + else begin + dx7<=(dii<<2) - (dii >>>1); //multiply by 7 + dx3<=dii +(dii >>>1); //multiply by 3 + dt<=dii; + end + if (c3d || c3d2) doo<=dot >>>2; + else doo<=dot >>>2; + + droo<=doo; + if (edd3) + if (mpyjd3) begin + DOR<=doo; + DOI<= - droo; end + else begin + DOR<=droo; + DOI<= doo; end + end + end + + assign dx5p= (c3d || c3d2)? ((dt>>>5)+dx3) : ( dx7+(dx3>>>3)); // multiply by 0_0110_001 + //or multiply by 1_00T0_11 + + `ifdef FFT256bitwidth_coef_high + assign dot= (c3d || c3d2)? dx5p-(dt>>>11) :(dx5p+((dt>>>7) +(dx3>>>13)));// by 0_0110_0010_0000_T + //or multiply by 1_00T0_1100_1000_0011 + `else + assign dot= (c3d || c3d2)? dx5p : (dx5p+(dt>>>7)); + //or multiply by 1_00T0_1100_1 + `endif + + + +endmodule Index: pipelined_fft_256/trunk/SRC/WROM256.v =================================================================== --- pipelined_fft_256/trunk/SRC/WROM256.v (nonexistent) +++ pipelined_fft_256/trunk/SRC/WROM256.v (revision 2) @@ -0,0 +1,163 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// DESCRIPTION : Twiddle factor ROM for 256-point FFT +// FUNCTION: +// FILES: WROM64.v - ROM of twiddle factors. +// PROPERTIES: 1) Has 64 complex coefficients which form a table 8x8, +// and stay in the needed order, as they are addressed +// by the simple counter +// 2) 16-bit values are stored. When shorter bit width is set +// then rounding is not used +// 3) for FFT and IFFT depending on paramifft +// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`include "FFT256_CONFIG.inc" +`timescale 1 ns / 1 ps +module WROM256 ( WI ,WR ,ADDR ); + `FFT256paramnw + + input [7:0] ADDR ; + wire [7:0] ADDR ; + + output [nw-1:0] WI ; + wire [nw-1:0] WI ; + output [nw-1:0] WR ; + wire [nw-1:0] WR ; + + wire [15:0] cosw[0:255]; + assign cosw[0]=16'h7FFF; assign cosw[1]=16'h7FFF; assign cosw[2]=16'h7FFF; assign cosw[3]=16'h7FFF; assign cosw[4]=16'h7FFF; assign cosw[5]=16'h7FFF; assign cosw[6]=16'h7FFF; assign cosw[7]=16'h7FFF; assign cosw[8]=16'h7FFF; assign cosw[9]=16'h7FFF; assign cosw[10]=16'h7FFF; assign cosw[11]=16'h7FFF; assign cosw[12]=16'h7FFF; assign cosw[13]=16'h7FFF; assign cosw[14]=16'h7FFF; assign cosw[15]=16'h7FFF; + assign cosw[16]=16'h7FFF; assign cosw[17]=16'h7FF5; assign cosw[18]=16'h7FD7; assign cosw[19]=16'h7FA6; assign cosw[20]=16'h7F61; assign cosw[21]=16'h7F08; assign cosw[22]=16'h7E9C; assign cosw[23]=16'h7E1C; assign cosw[24]=16'h7D89; assign cosw[25]=16'h7CE2; assign cosw[26]=16'h7C29; assign cosw[27]=16'h7B5C; assign cosw[28]=16'h7A7C; assign cosw[29]=16'h7989; assign cosw[30]=16'h7883; assign cosw[31]=16'h776B; + assign cosw[32]=16'h7FFF; assign cosw[33]=16'h7FD7; assign cosw[34]=16'h7F61; assign cosw[35]=16'h7E9C; assign cosw[36]=16'h7D89; assign cosw[37]=16'h7C29; assign cosw[38]=16'h7A7C; assign cosw[39]=16'h7883; assign cosw[40]=16'h7640; assign cosw[41]=16'h73B5; assign cosw[42]=16'h70E1; assign cosw[43]=16'h6DC9; assign cosw[44]=16'h6A6C; assign cosw[45]=16'h66CE; assign cosw[46]=16'h62F1; assign cosw[47]=16'h5ED6; + assign cosw[48]=16'h7FFF; assign cosw[49]=16'h7FA6; assign cosw[50]=16'h7E9C; assign cosw[51]=16'h7CE2; assign cosw[52]=16'h7A7C; assign cosw[53]=16'h776B; assign cosw[54]=16'h73B5; assign cosw[55]=16'h6F5E; assign cosw[56]=16'h6A6C; assign cosw[57]=16'h64E7; assign cosw[58]=16'h5ED6; assign cosw[59]=16'h5842; assign cosw[60]=16'h5133; assign cosw[61]=16'h49B3; assign cosw[62]=16'h41CD; assign cosw[63]=16'h398C; + assign cosw[64]=16'h7FFF; assign cosw[65]=16'h7F61; assign cosw[66]=16'h7D89; assign cosw[67]=16'h7A7C; assign cosw[68]=16'h7640; assign cosw[69]=16'h70E1; assign cosw[70]=16'h6A6C; assign cosw[71]=16'h62F1; assign cosw[72]=16'h5A81; assign cosw[73]=16'h5133; assign cosw[74]=16'h471C; assign cosw[75]=16'h3C56; assign cosw[76]=16'h30FB; assign cosw[77]=16'h2527; assign cosw[78]=16'h18F8; assign cosw[79]=16'h0C8B; + assign cosw[80]=16'h7FFF; assign cosw[81]=16'h7F08; assign cosw[82]=16'h7C29; assign cosw[83]=16'h776B; assign cosw[84]=16'h70E1; assign cosw[85]=16'h68A5; assign cosw[86]=16'h5ED6; assign cosw[87]=16'h539A; assign cosw[88]=16'h471C; assign cosw[89]=16'h398C; assign cosw[90]=16'h2B1E; assign cosw[91]=16'h1C0B; assign cosw[92]=16'h0C8B; assign cosw[93]=16'hFCDC; assign cosw[94]=16'hED39; assign cosw[95]=16'hDDDD; + assign cosw[96]=16'h7FFF; assign cosw[97]=16'h7E9C; assign cosw[98]=16'h7A7C; assign cosw[99]=16'h73B5; assign cosw[100]=16'h6A6C; assign cosw[101]=16'h5ED6; assign cosw[102]=16'h5133; assign cosw[103]=16'h41CD; assign cosw[104]=16'h30FB; assign cosw[105]=16'h1F19; assign cosw[106]=16'h0C8B; assign cosw[107]=16'hF9B9; assign cosw[108]=16'hE708; assign cosw[109]=16'hD4E2; assign cosw[110]=16'hC3AA; assign cosw[111]=16'hB3C1; + assign cosw[112]=16'h7FFF; assign cosw[113]=16'h7E1C; assign cosw[114]=16'h7883; assign cosw[115]=16'h6F5E; assign cosw[116]=16'h62F1; assign cosw[117]=16'h539A; assign cosw[118]=16'h41CD; assign cosw[119]=16'h2E10; assign cosw[120]=16'h18F8; assign cosw[121]=16'h0324; assign cosw[122]=16'hED39; assign cosw[123]=16'hD7DA; assign cosw[124]=16'hC3AA; assign cosw[125]=16'hB141; assign cosw[126]=16'hA12A; assign cosw[127]=16'h93DD; + assign cosw[128]=16'h7FFF; assign cosw[129]=16'h7D89; assign cosw[130]=16'h7640; assign cosw[131]=16'h6A6C; assign cosw[132]=16'h5A81; assign cosw[133]=16'h471C; assign cosw[134]=16'h30FB; assign cosw[135]=16'h18F8; assign cosw[136]=16'h0000; assign cosw[137]=16'hE708; assign cosw[138]=16'hCF05; assign cosw[139]=16'hB8E4; assign cosw[140]=16'hA57F; assign cosw[141]=16'h9594; assign cosw[142]=16'h89C0; assign cosw[143]=16'h8277; + assign cosw[144]=16'h7FFF; assign cosw[145]=16'h7CE2; assign cosw[146]=16'h73B5; assign cosw[147]=16'h64E7; assign cosw[148]=16'h5133; assign cosw[149]=16'h398C; assign cosw[150]=16'h1F19; assign cosw[151]=16'h0324; assign cosw[152]=16'hE708; assign cosw[153]=16'hCC22; assign cosw[154]=16'hB3C1; assign cosw[155]=16'h9F15; assign cosw[156]=16'h8F1F; assign cosw[157]=16'h84A4; assign cosw[158]=16'h8029; assign cosw[159]=16'h81E4; + assign cosw[160]=16'h7FFF; assign cosw[161]=16'h7C29; assign cosw[162]=16'h70E1; assign cosw[163]=16'h5ED6; assign cosw[164]=16'h471C; assign cosw[165]=16'h2B1E; assign cosw[166]=16'h0C8B; assign cosw[167]=16'hED39; assign cosw[168]=16'hCF05; assign cosw[169]=16'hB3C1; assign cosw[170]=16'h9D0F; assign cosw[171]=16'h8C4B; assign cosw[172]=16'h8277; assign cosw[173]=16'h8029; assign cosw[174]=16'h8584; assign cosw[175]=16'h9237; + assign cosw[176]=16'h7FFF; assign cosw[177]=16'h7B5C; assign cosw[178]=16'h6DC9; assign cosw[179]=16'h5842; assign cosw[180]=16'h3C56; assign cosw[181]=16'h1C0B; assign cosw[182]=16'hF9B9; assign cosw[183]=16'hD7DA; assign cosw[184]=16'hB8E4; assign cosw[185]=16'h9F15; assign cosw[186]=16'h8C4B; assign cosw[187]=16'h81E4; assign cosw[188]=16'h809F; assign cosw[189]=16'h8895; assign cosw[190]=16'h9932; assign cosw[191]=16'hB141; + assign cosw[192]=16'h7FFF; assign cosw[193]=16'h7A7C; assign cosw[194]=16'h6A6C; assign cosw[195]=16'h5133; assign cosw[196]=16'h30FB; assign cosw[197]=16'h0C8B; assign cosw[198]=16'hE708; assign cosw[199]=16'hC3AA; assign cosw[200]=16'hA57F; assign cosw[201]=16'h8F1F; assign cosw[202]=16'h8277; assign cosw[203]=16'h809F; assign cosw[204]=16'h89C0; assign cosw[205]=16'h9D0F; assign cosw[206]=16'hB8E4; assign cosw[207]=16'hDAD9; + assign cosw[208]=16'h7FFF; assign cosw[209]=16'h7989; assign cosw[210]=16'h66CE; assign cosw[211]=16'h49B3; assign cosw[212]=16'h2527; assign cosw[213]=16'hFCDC; assign cosw[214]=16'hD4E2; assign cosw[215]=16'hB141; assign cosw[216]=16'h9594; assign cosw[217]=16'h84A4; assign cosw[218]=16'h8029; assign cosw[219]=16'h8895; assign cosw[220]=16'h9D0F; assign cosw[221]=16'hBB86; assign cosw[222]=16'hE0E7; assign cosw[223]=16'h096A; + assign cosw[224]=16'h7FFF; assign cosw[225]=16'h7883; assign cosw[226]=16'h62F1; assign cosw[227]=16'h41CD; assign cosw[228]=16'h18F8; assign cosw[229]=16'hED39; assign cosw[230]=16'hC3AA; assign cosw[231]=16'hA12A; assign cosw[232]=16'h89C0; assign cosw[233]=16'h8029; assign cosw[234]=16'h8584; assign cosw[235]=16'h9932; assign cosw[236]=16'hB8E4; assign cosw[237]=16'hE0E7; assign cosw[238]=16'h0C8B; assign cosw[239]=16'h36B9; + assign cosw[240]=16'h7FFF; assign cosw[241]=16'h776B; assign cosw[242]=16'h5ED6; assign cosw[243]=16'h398C; assign cosw[244]=16'h0C8B; assign cosw[245]=16'hDDDD; assign cosw[246]=16'hB3C1; assign cosw[247]=16'h93DD; assign cosw[248]=16'h8277; assign cosw[249]=16'h81E4; assign cosw[250]=16'h9237; assign cosw[251]=16'hB141; assign cosw[252]=16'hDAD9; assign cosw[253]=16'h096A; assign cosw[254]=16'h36B9; assign cosw[255]=16'h5CB3; + + wire [15:0] sinw[0:255]; + + `ifdef FFT256paramifft //Inverse FFT + assign sinw[0]=16'h0000; assign sinw[1]=16'h0000; assign sinw[2]=16'h0000; assign sinw[3]=16'h0000; assign sinw[4]=16'h0000; assign sinw[5]=16'h0000; assign sinw[6]=16'h0000; assign sinw[7]=16'h0000; assign sinw[8]=16'h0000; assign sinw[9]=16'h0000; assign sinw[10]=16'h0000; assign sinw[11]=16'h0000; assign sinw[12]=16'h0000; assign sinw[13]=16'h0000; assign sinw[14]=16'h0000; assign sinw[15]=16'h0000; + assign sinw[16]=16'h0000; assign sinw[17]=16'h0324; assign sinw[18]=16'h0647; assign sinw[19]=16'h096A; assign sinw[20]=16'h0C8B; assign sinw[21]=16'h0FAB; assign sinw[22]=16'h12C7; assign sinw[23]=16'h15E1; assign sinw[24]=16'h18F8; assign sinw[25]=16'h1C0B; assign sinw[26]=16'h1F19; assign sinw[27]=16'h2223; assign sinw[28]=16'h2527; assign sinw[29]=16'h2826; assign sinw[30]=16'h2B1E; assign sinw[31]=16'h2E10; + assign sinw[32]=16'h0000; assign sinw[33]=16'h0647; assign sinw[34]=16'h0C8B; assign sinw[35]=16'h12C7; assign sinw[36]=16'h18F8; assign sinw[37]=16'h1F19; assign sinw[38]=16'h2527; assign sinw[39]=16'h2B1E; assign sinw[40]=16'h30FB; assign sinw[41]=16'h36B9; assign sinw[42]=16'h3C56; assign sinw[43]=16'h41CD; assign sinw[44]=16'h471C; assign sinw[45]=16'h4C3F; assign sinw[46]=16'h5133; assign sinw[47]=16'h55F4; + assign sinw[48]=16'h0000; assign sinw[49]=16'h096A; assign sinw[50]=16'h12C7; assign sinw[51]=16'h1C0B; assign sinw[52]=16'h2527; assign sinw[53]=16'h2E10; assign sinw[54]=16'h36B9; assign sinw[55]=16'h3F16; assign sinw[56]=16'h471C; assign sinw[57]=16'h4EBF; assign sinw[58]=16'h55F4; assign sinw[59]=16'h5CB3; assign sinw[60]=16'h62F1; assign sinw[61]=16'h68A5; assign sinw[62]=16'h6DC9; assign sinw[63]=16'h7254; + assign sinw[64]=16'h0000; assign sinw[65]=16'h0C8B; assign sinw[66]=16'h18F8; assign sinw[67]=16'h2527; assign sinw[68]=16'h30FB; assign sinw[69]=16'h3C56; assign sinw[70]=16'h471C; assign sinw[71]=16'h5133; assign sinw[72]=16'h5A81; assign sinw[73]=16'h62F1; assign sinw[74]=16'h6A6C; assign sinw[75]=16'h70E1; assign sinw[76]=16'h7640; assign sinw[77]=16'h7A7C; assign sinw[78]=16'h7D89; assign sinw[79]=16'h7F61; + assign sinw[80]=16'h0000; assign sinw[81]=16'h0FAB; assign sinw[82]=16'h1F19; assign sinw[83]=16'h2E10; assign sinw[84]=16'h3C56; assign sinw[85]=16'h49B3; assign sinw[86]=16'h55F4; assign sinw[87]=16'h60EB; assign sinw[88]=16'h6A6C; assign sinw[89]=16'h7254; assign sinw[90]=16'h7883; assign sinw[91]=16'h7CE2; assign sinw[92]=16'h7F61; assign sinw[93]=16'h7FF5; assign sinw[94]=16'h7E9C; assign sinw[95]=16'h7B5C; + assign sinw[96]=16'h0000; assign sinw[97]=16'h12C7; assign sinw[98]=16'h2527; assign sinw[99]=16'h36B9; assign sinw[100]=16'h471C; assign sinw[101]=16'h55F4; assign sinw[102]=16'h62F1; assign sinw[103]=16'h6DC9; assign sinw[104]=16'h7640; assign sinw[105]=16'h7C29; assign sinw[106]=16'h7F61; assign sinw[107]=16'h7FD7; assign sinw[108]=16'h7D89; assign sinw[109]=16'h7883; assign sinw[110]=16'h70E1; assign sinw[111]=16'h66CE; + assign sinw[112]=16'h0000; assign sinw[113]=16'h15E1; assign sinw[114]=16'h2B1E; assign sinw[115]=16'h3F16; assign sinw[116]=16'h5133; assign sinw[117]=16'h60EB; assign sinw[118]=16'h6DC9; assign sinw[119]=16'h776B; assign sinw[120]=16'h7D89; assign sinw[121]=16'h7FF5; assign sinw[122]=16'h7E9C; assign sinw[123]=16'h7989; assign sinw[124]=16'h70E1; assign sinw[125]=16'h64E7; assign sinw[126]=16'h55F4; assign sinw[127]=16'h447A; + assign sinw[128]=16'h0000; assign sinw[129]=16'h18F8; assign sinw[130]=16'h30FB; assign sinw[131]=16'h471C; assign sinw[132]=16'h5A81; assign sinw[133]=16'h6A6C; assign sinw[134]=16'h7640; assign sinw[135]=16'h7D89; assign sinw[136]=16'h7FFF; assign sinw[137]=16'h7D89; assign sinw[138]=16'h7640; assign sinw[139]=16'h6A6C; assign sinw[140]=16'h5A81; assign sinw[141]=16'h471C; assign sinw[142]=16'h30FB; assign sinw[143]=16'h18F8; + assign sinw[144]=16'h0000; assign sinw[145]=16'h1C0B; assign sinw[146]=16'h36B9; assign sinw[147]=16'h4EBF; assign sinw[148]=16'h62F1; assign sinw[149]=16'h7254; assign sinw[150]=16'h7C29; assign sinw[151]=16'h7FF5; assign sinw[152]=16'h7D89; assign sinw[153]=16'h7503; assign sinw[154]=16'h66CE; assign sinw[155]=16'h539A; assign sinw[156]=16'h3C56; assign sinw[157]=16'h2223; assign sinw[158]=16'h0647; assign sinw[159]=16'hEA1F; + assign sinw[160]=16'h0000; assign sinw[161]=16'h1F19; assign sinw[162]=16'h3C56; assign sinw[163]=16'h55F4; assign sinw[164]=16'h6A6C; assign sinw[165]=16'h7883; assign sinw[166]=16'h7F61; assign sinw[167]=16'h7E9C; assign sinw[168]=16'h7640; assign sinw[169]=16'h66CE; assign sinw[170]=16'h5133; assign sinw[171]=16'h36B9; assign sinw[172]=16'h18F8; assign sinw[173]=16'hF9B9; assign sinw[174]=16'hDAD9; assign sinw[175]=16'hBE33; + assign sinw[176]=16'h0000; assign sinw[177]=16'h2223; assign sinw[178]=16'h41CD; assign sinw[179]=16'h5CB3; assign sinw[180]=16'h70E1; assign sinw[181]=16'h7CE2; assign sinw[182]=16'h7FD7; assign sinw[183]=16'h7989; assign sinw[184]=16'h6A6C; assign sinw[185]=16'h539A; assign sinw[186]=16'h36B9; assign sinw[187]=16'h15E1; assign sinw[188]=16'hF375; assign sinw[189]=16'hD1F0; assign sinw[190]=16'hB3C1; assign sinw[191]=16'h9B19; + assign sinw[192]=16'h0000; assign sinw[193]=16'h2527; assign sinw[194]=16'h471C; assign sinw[195]=16'h62F1; assign sinw[196]=16'h7640; assign sinw[197]=16'h7F61; assign sinw[198]=16'h7D89; assign sinw[199]=16'h70E1; assign sinw[200]=16'h5A81; assign sinw[201]=16'h3C56; assign sinw[202]=16'h18F8; assign sinw[203]=16'hF375; assign sinw[204]=16'hCF05; assign sinw[205]=16'hAECD; assign sinw[206]=16'h9594; assign sinw[207]=16'h8584; + assign sinw[208]=16'h0000; assign sinw[209]=16'h2826; assign sinw[210]=16'h4C3F; assign sinw[211]=16'h68A5; assign sinw[212]=16'h7A7C; assign sinw[213]=16'h7FF5; assign sinw[214]=16'h7883; assign sinw[215]=16'h64E7; assign sinw[216]=16'h471C; assign sinw[217]=16'h2223; assign sinw[218]=16'hF9B9; assign sinw[219]=16'hD1F0; assign sinw[220]=16'hAECD; assign sinw[221]=16'h93DD; assign sinw[222]=16'h83D7; assign sinw[223]=16'h805A; + assign sinw[224]=16'h0000; assign sinw[225]=16'h2B1E; assign sinw[226]=16'h5133; assign sinw[227]=16'h6DC9; assign sinw[228]=16'h7D89; assign sinw[229]=16'h7E9C; assign sinw[230]=16'h70E1; assign sinw[231]=16'h55F4; assign sinw[232]=16'h30FB; assign sinw[233]=16'h0647; assign sinw[234]=16'hDAD9; assign sinw[235]=16'hB3C1; assign sinw[236]=16'h9594; assign sinw[237]=16'h83D7; assign sinw[238]=16'h809F; assign sinw[239]=16'h8C4B; + assign sinw[240]=16'h0000; assign sinw[241]=16'h2E10; assign sinw[242]=16'h55F4; assign sinw[243]=16'h7254; assign sinw[244]=16'h7F61; assign sinw[245]=16'h7B5C; assign sinw[246]=16'h66CE; assign sinw[247]=16'h447A; assign sinw[248]=16'h18F8; assign sinw[249]=16'hEA1F; assign sinw[250]=16'hBE33; assign sinw[251]=16'h9B19; assign sinw[252]=16'h8584; assign sinw[253]=16'h805A; assign sinw[254]=16'h8C4B; assign sinw[255]=16'hA7BE; + + `else //Forward FFT + +assign sinw[0]=16'h0000; assign sinw[1]=16'h0000; assign sinw[2]=16'h0000; assign sinw[3]=16'h0000; assign sinw[4]=16'h0000; assign sinw[5]=16'h0000; assign sinw[6]=16'h0000; assign sinw[7]=16'h0000; assign sinw[8]=16'h0000; assign sinw[9]=16'h0000; assign sinw[10]=16'h0000; assign sinw[11]=16'h0000; assign sinw[12]=16'h0000; assign sinw[13]=16'h0000; assign sinw[14]=16'h0000; assign sinw[15]=16'h0000; + assign sinw[16]=16'h0000; assign sinw[17]=16'hFCDC; assign sinw[18]=16'hF9B9; assign sinw[19]=16'hF696; assign sinw[20]=16'hF375; assign sinw[21]=16'hF055; assign sinw[22]=16'hED39; assign sinw[23]=16'hEA1F; assign sinw[24]=16'hE708; assign sinw[25]=16'hE3F5; assign sinw[26]=16'hE0E7; assign sinw[27]=16'hDDDD; assign sinw[28]=16'hDAD9; assign sinw[29]=16'hD7DA; assign sinw[30]=16'hD4E2; assign sinw[31]=16'hD1F0; + assign sinw[32]=16'h0000; assign sinw[33]=16'hF9B9; assign sinw[34]=16'hF375; assign sinw[35]=16'hED39; assign sinw[36]=16'hE708; assign sinw[37]=16'hE0E7; assign sinw[38]=16'hDAD9; assign sinw[39]=16'hD4E2; assign sinw[40]=16'hCF05; assign sinw[41]=16'hC947; assign sinw[42]=16'hC3AA; assign sinw[43]=16'hBE33; assign sinw[44]=16'hB8E4; assign sinw[45]=16'hB3C1; assign sinw[46]=16'hAECD; assign sinw[47]=16'hAA0C; + assign sinw[48]=16'h0000; assign sinw[49]=16'hF696; assign sinw[50]=16'hED39; assign sinw[51]=16'hE3F5; assign sinw[52]=16'hDAD9; assign sinw[53]=16'hD1F0; assign sinw[54]=16'hC947; assign sinw[55]=16'hC0EA; assign sinw[56]=16'hB8E4; assign sinw[57]=16'hB141; assign sinw[58]=16'hAA0C; assign sinw[59]=16'hA34D; assign sinw[60]=16'h9D0F; assign sinw[61]=16'h975B; assign sinw[62]=16'h9237; assign sinw[63]=16'h8DAC; + assign sinw[64]=16'h0000; assign sinw[65]=16'hF375; assign sinw[66]=16'hE708; assign sinw[67]=16'hDAD9; assign sinw[68]=16'hCF05; assign sinw[69]=16'hC3AA; assign sinw[70]=16'hB8E4; assign sinw[71]=16'hAECD; assign sinw[72]=16'hA57F; assign sinw[73]=16'h9D0F; assign sinw[74]=16'h9594; assign sinw[75]=16'h8F1F; assign sinw[76]=16'h89C0; assign sinw[77]=16'h8584; assign sinw[78]=16'h8277; assign sinw[79]=16'h809F; + assign sinw[80]=16'h0000; assign sinw[81]=16'hF055; assign sinw[82]=16'hE0E7; assign sinw[83]=16'hD1F0; assign sinw[84]=16'hC3AA; assign sinw[85]=16'hB64D; assign sinw[86]=16'hAA0C; assign sinw[87]=16'h9F15; assign sinw[88]=16'h9594; assign sinw[89]=16'h8DAC; assign sinw[90]=16'h877D; assign sinw[91]=16'h831E; assign sinw[92]=16'h809F; assign sinw[93]=16'h800B; assign sinw[94]=16'h8164; assign sinw[95]=16'h84A4; + assign sinw[96]=16'h0000; assign sinw[97]=16'hED39; assign sinw[98]=16'hDAD9; assign sinw[99]=16'hC947; assign sinw[100]=16'hB8E4; assign sinw[101]=16'hAA0C; assign sinw[102]=16'h9D0F; assign sinw[103]=16'h9237; assign sinw[104]=16'h89C0; assign sinw[105]=16'h83D7; assign sinw[106]=16'h809F; assign sinw[107]=16'h8029; assign sinw[108]=16'h8277; assign sinw[109]=16'h877D; assign sinw[110]=16'h8F1F; assign sinw[111]=16'h9932; + assign sinw[112]=16'h0000; assign sinw[113]=16'hEA1F; assign sinw[114]=16'hD4E2; assign sinw[115]=16'hC0EA; assign sinw[116]=16'hAECD; assign sinw[117]=16'h9F15; assign sinw[118]=16'h9237; assign sinw[119]=16'h8895; assign sinw[120]=16'h8277; assign sinw[121]=16'h800B; assign sinw[122]=16'h8164; assign sinw[123]=16'h8677; assign sinw[124]=16'h8F1F; assign sinw[125]=16'h9B19; assign sinw[126]=16'hAA0C; assign sinw[127]=16'hBB86; + assign sinw[128]=16'h0000; assign sinw[129]=16'hE708; assign sinw[130]=16'hCF05; assign sinw[131]=16'hB8E4; assign sinw[132]=16'hA57F; assign sinw[133]=16'h9594; assign sinw[134]=16'h89C0; assign sinw[135]=16'h8277; assign sinw[136]=16'h8001; assign sinw[137]=16'h8277; assign sinw[138]=16'h89C0; assign sinw[139]=16'h9594; assign sinw[140]=16'hA57F; assign sinw[141]=16'hB8E4; assign sinw[142]=16'hCF05; assign sinw[143]=16'hE708; + assign sinw[144]=16'h0000; assign sinw[145]=16'hE3F5; assign sinw[146]=16'hC947; assign sinw[147]=16'hB141; assign sinw[148]=16'h9D0F; assign sinw[149]=16'h8DAC; assign sinw[150]=16'h83D7; assign sinw[151]=16'h800B; assign sinw[152]=16'h8277; assign sinw[153]=16'h8AFD; assign sinw[154]=16'h9932; assign sinw[155]=16'hAC66; assign sinw[156]=16'hC3AA; assign sinw[157]=16'hDDDD; assign sinw[158]=16'hF9B9; assign sinw[159]=16'h15E1; + assign sinw[160]=16'h0000; assign sinw[161]=16'hE0E7; assign sinw[162]=16'hC3AA; assign sinw[163]=16'hAA0C; assign sinw[164]=16'h9594; assign sinw[165]=16'h877D; assign sinw[166]=16'h809F; assign sinw[167]=16'h8164; assign sinw[168]=16'h89C0; assign sinw[169]=16'h9932; assign sinw[170]=16'hAECD; assign sinw[171]=16'hC947; assign sinw[172]=16'hE708; assign sinw[173]=16'h0647; assign sinw[174]=16'h2527; assign sinw[175]=16'h41CD; + assign sinw[176]=16'h0000; assign sinw[177]=16'hDDDD; assign sinw[178]=16'hBE33; assign sinw[179]=16'hA34D; assign sinw[180]=16'h8F1F; assign sinw[181]=16'h831E; assign sinw[182]=16'h8029; assign sinw[183]=16'h8677; assign sinw[184]=16'h9594; assign sinw[185]=16'hAC66; assign sinw[186]=16'hC947; assign sinw[187]=16'hEA1F; assign sinw[188]=16'h0C8B; assign sinw[189]=16'h2E10; assign sinw[190]=16'h4C3F; assign sinw[191]=16'h64E7; + assign sinw[192]=16'h0000; assign sinw[193]=16'hDAD9; assign sinw[194]=16'hB8E4; assign sinw[195]=16'h9D0F; assign sinw[196]=16'h89C0; assign sinw[197]=16'h809F; assign sinw[198]=16'h8277; assign sinw[199]=16'h8F1F; assign sinw[200]=16'hA57F; assign sinw[201]=16'hC3AA; assign sinw[202]=16'hE708; assign sinw[203]=16'h0C8B; assign sinw[204]=16'h30FB; assign sinw[205]=16'h5133; assign sinw[206]=16'h6A6C; assign sinw[207]=16'h7A7C; + assign sinw[208]=16'h0000; assign sinw[209]=16'hD7DA; assign sinw[210]=16'hB3C1; assign sinw[211]=16'h975B; assign sinw[212]=16'h8584; assign sinw[213]=16'h800B; assign sinw[214]=16'h877D; assign sinw[215]=16'h9B19; assign sinw[216]=16'hB8E4; assign sinw[217]=16'hDDDD; assign sinw[218]=16'h0647; assign sinw[219]=16'h2E10; assign sinw[220]=16'h5133; assign sinw[221]=16'h6C23; assign sinw[222]=16'h7C29; assign sinw[223]=16'h7FA6; + assign sinw[224]=16'h0000; assign sinw[225]=16'hD4E2; assign sinw[226]=16'hAECD; assign sinw[227]=16'h9237; assign sinw[228]=16'h8277; assign sinw[229]=16'h8164; assign sinw[230]=16'h8F1F; assign sinw[231]=16'hAA0C; assign sinw[232]=16'hCF05; assign sinw[233]=16'hF9B9; assign sinw[234]=16'h2527; assign sinw[235]=16'h4C3F; assign sinw[236]=16'h6A6C; assign sinw[237]=16'h7C29; assign sinw[238]=16'h7F61; assign sinw[239]=16'h73B5; + assign sinw[240]=16'h0000; assign sinw[241]=16'hD1F0; assign sinw[242]=16'hAA0C; assign sinw[243]=16'h8DAC; assign sinw[244]=16'h809F; assign sinw[245]=16'h84A4; assign sinw[246]=16'h9932; assign sinw[247]=16'hBB86; assign sinw[248]=16'hE708; assign sinw[249]=16'h15E1; assign sinw[250]=16'h41CD; assign sinw[251]=16'h64E7; assign sinw[252]=16'h7A7C; assign sinw[253]=16'h7FA6; assign sinw[254]=16'h73B5; assign sinw[255]=16'h5842; + `endif + + + wire [15:0] wri,wii ; + assign wri=cosw[ADDR]; + assign wii=sinw[ADDR]; + + wire [nw:0] wrt,wit; + +// // precise rounding , must be minimized by the synthesizer but not done at least by SYNPLIFY +// reg signed [nw:0] wrt,wit; +// always@(wri or wii or wrt or wit) begin +// if (nw==16) begin +// WR<=wri; WI<= - wii; end +// else if (nw==15) begin //rounding only for positive and those that are not 111..1 +// wrt = wri +(~wri[15] &&(~&wri[14:16-nw])); +// wit = wii +(~wii[15] &&(~&wii[14:16-nw])); +// WR<=wrt[15:1] ; +// WI<= - wit[15:16-nw] ; +// end +// else begin +// if ((~wri[15] && (&wri[14:16-nw])) || //in positive MSBS are 1111 +// (wri[15] && wri[15-nw] && (~|wri[14-nw:0]))) //in negative const truncated bits not 1000 +// +// WR<=wri[15:16-nw] ; +// else begin +// wrt = wri[15:15-nw]+1; +// WR<= wrt[nw:1]; end +// +// if ((~wii[15] && (&wii[14:16-nw])) || //in positive MSBS are 1111 +// (wii[15] && wii[15-nw] && (~|wii[14-nw:0]))) //in negative const truncated bits not 1000 +// WI<=wii[15:16-nw] ; +// else begin +// wit = wii[15:15-nw]+1; +// WI<= - wit[nw:1]; end +// end +// end +// + assign wrt = wri[15:16-nw]; + assign wit = wii[15:16-nw]; + assign WR= wrt[nw-1:0]; + assign WI= wit[nw-1:0]; + +endmodule Index: pipelined_fft_256/trunk/SRC/mpuc707.v =================================================================== --- pipelined_fft_256/trunk/SRC/mpuc707.v (nonexistent) +++ pipelined_fft_256/trunk/SRC/mpuc707.v (revision 2) @@ -0,0 +1,122 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// DESCRIPTION : Complex Multiplier by 0.7071 +// FUNCTION: Constant multiplier +// FILES: MPU707.v +// PROPERTIES: 1) Is based on shifts right and add +// 2) for short input bit width 0.7071 is approximated as 10110101 then rounding is not used +// 3) for long input bit width 0.7071 is approximated as 10110101000000101 +// 4) hardware is 4 or 5 adders +// 5) MPYJ switches multiply by j +// 6) A complex data is multiplied for 2 cycles +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`include "FFT256_CONFIG.inc" + +module MPUC707 ( CLK,EI ,ED, MPYJ,DR,DI ,DOR ,DOI, ); + `FFT256paramnb + + input CLK ; + wire CLK ; + input EI ; //slowdown + wire EI ; + input ED; //data strobe + input MPYJ ; //the result is multiplied by -j + wire MPYJ ; + input [nb-1:0] DR ; + wire signed [nb-1:0] DR ; + input [nb-1:0] DI ; + wire signed [nb-1:0] DI ; + + output [nb-1:0] DOR ; + reg [nb-1:0] DOR ; + output [nb-1:0] DOI ; + reg [nb-1:0] DOI ; + + reg signed [nb+1 :0] dx5; + reg signed [nb : 0] dt; + reg signed [nb-1 : 0] dii; + wire signed [nb+2 : 0] dx5p; + wire signed [nb+3 : 0] dot; + reg edd,edd2, edd3; //delayed data enable impulse + reg mpyjd,mpyjd2,mpyjd3; + reg [nb-1:0] doo ; + reg [nb-1:0] droo ; + + always @(posedge CLK) + begin + if (EI) begin + edd<=ED; + edd2<=edd; + edd3<=edd2; + mpyjd<=MPYJ; + mpyjd2<=mpyjd; + mpyjd3<=mpyjd2; + if (ED) begin + dx5<=DR+(DR <<2); //multiply by 5 + dt<=DR; + dii<=DI; + end + else begin + dx5<=dii+(dii <<2); //multiply by 5 + dt<=dii; + end + doo<=(dot >>>4) ; + droo<=doo; + if (edd3) + if (mpyjd3) begin + DOR<=doo; + DOI<= - droo; end + else begin + DOR<=droo; + DOI<= doo; end + end + end + + assign dx5p=(dx5<<1)+(dx5>>>2); // multiply by 101101 + + `ifdef FFT256bitwidth_coef_high + assign dot= dx5p+(dt>>>4)+(dx5>>>13); // multiply by 10110101000000101 + `else + assign dot= dx5p+(dt>>>4) ; // multiply by 10110101 + `endif + + + +endmodule Index: pipelined_fft_256/trunk/SRC/fft256_config.INC =================================================================== --- pipelined_fft_256/trunk/SRC/fft256_config.INC (nonexistent) +++ pipelined_fft_256/trunk/SRC/fft256_config.INC (revision 2) @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// DESCRIPTION : Parameter file +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`timescale 10 ps / 1ps + +//input data bit width +`define FFT256paramnb parameter nb=10; + +//twiddle factor bit width +`define FFT256paramnw parameter nw=10; + +//when is absent then FFT, when is present then IFFT +//`define FFT256paramifft ; + +//buffer number 2 or 3 +`define FFT256parambuffers3 + +// buffer type: 1 ports in RAMS else -2 ports RAMS +//`define FFT256bufferports1 + +//Coeficient bit width is increased to high +//`define FFT256bitwidth_coef_high + + +//Rounding butterfly results +//`define FFT256round \ No newline at end of file Index: pipelined_fft_256/trunk/SRC/fft16.v =================================================================== --- pipelined_fft_256/trunk/SRC/fft16.v (nonexistent) +++ pipelined_fft_256/trunk/SRC/fft16.v (revision 2) @@ -0,0 +1,605 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// DESCRIPTION : Stage of FFT 256 processor +// FUNCTION: 16-point FFT +// FILES: FFT16.v - stage, contains +// MPUC707.v - multiplier to the factor 0.707. +// PROPERTIES: 1) Fully pipelined +// 2) Each clock cycle complex datum is entered +// and complex result is outputted +// 3) Has 16-clock cycle period starting with the START impulse +// and continuing forever +// 4) rounding is not used +// 5)Algorithm is from the book "H.J.Nussbaumer FFT and convolution algorithms". +// 6)IFFT is performed by substituting the output result order to the reversed one +// (by exchanging - to + and + to -) +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +//Algorithm: +///procedure FFT16( +// X: in MEMOC; -- входной массив данных +// y:out MEMOC) -- выходной массив спектров +// is +// variable t1,t2,t3,t4,t5,t6,t7,t8,t9,t10: complex; +// variable t11,t12,t13,t14,t15,t16,t17,t18,t19,t20: complex; +// variable t21,t22,t23,t24,t25,t26: complex; +// variable m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10: complex; +// variable m11,m12,m13,m14,m15,m16,m17: complex; +// variable s1,s2,s3,s4,s5,s6,s7,s8,s9,s10: complex; +// variable s11,s12,s13,s14,s15,s16,s17,s18,s19,s20: complex; +// begin +// t1:=x(0) + x(8); m4:=x(0) - x(8); +// t2:=x(4) + x(12); m12:=-CBASE_j*(x(4)-x(12)); +// t3:=x(2) + x(10); t4:=x(2) - x(10); +// t5:=x(6) + x(14); t6:=x(6) - x(14); +// t7:=x(1) + x(9); t8:=x(1) - x(9); +// t9:=x(3) + x(11); t10:=x(3) - x(11); +// t11:=x(5) + x(13); t12:=x(5) - x(13); +// t13:=x(7) + x(15); t14:=x(7) - x(15); +// t15:=t1 + t2; m3:= t1 - t2; +// t16:=t3 + t5; m11:= -CBASE_j*(t3 - t5); +// t17:=t15 + t16; m2:= t15 - t16; +// t18:=t7 + t11; t19:= t7 - t11; +// t20:=t9 + t13; t21:= t9 - t13; +// t22:=t18 + t20; m10:= -CBASE_j*(t18 - t20); +// t23:=t8 + t14; t24:= t8 - t14; +// t25:=t12 + t10; t26:= t12 - t10; +// +// m0:=t17 + t22; m1:=t17 - t22; +// m13:=-CBASE_j*c707*(t19 + t21); m5:=c707*(t19 - t21); +// m6:=c707*(t4 - t6); m14:=-CBASE_j*c707*(t4 + t6); +// +// m7:=c3*(t24+t26); +// m8:=c13*(t24); +// m9:=-s1_3*(t26); +// s7:= m8 - m7; +// s8:= m9 - m7; +// +// m15:=-CBASE_j*c1*(t23 + t25); +// m16:= -CBASE_j*s1_3*(t23); +// m17:=-CBASE_j*c13*(t25); +// s15:= m15 - m16; +// s16:= m15 - m17; +// +// s1:=m3 + m5; s2:=m3 - m5; +// s3:=m13 + m11; s4:=m13 - m11; +// s5:=m4 + m6; s6:=m4 - m6; +// s9:=s5 + s7; s10:=s5 - s7; +// s11:=s6 + s8; s12:=s6 - s8; +// s13:=m12 + m14; s14:=m12 - m14; +// s17:=s13 + s15; s18:=s13 - s15; +// s19:=s14 + s16; s20:=s14 - s16; +// +// y(0):=m0; y(8):=m1; +// y(1):=s9 + s17; y(15):=s9 - s17; +// y(2):=s1 + s3; y(14):=s1 - s3; +// y(3):=s12 - s20; y(13):=s12 + s20; +// y(4):=m2 + m10; y(12):=m2 - m10; +// y(5):=s11 + s19; y(11):=s11 - s19; +// y(6):=s2 + s4; y(10):=s2 - s4; +// y(7):=s10 - s18; y(9):=s10 + s18; +// end procedure; +// + +`timescale 1ns / 1ps +`include "FFT256_CONFIG.inc" + +module FFT16 ( DOR ,DII ,RST ,ED ,CLK ,DOI ,START ,DIR ,RDY ); + `FFT256paramnb + + input ED ; //slowdown impulse + wire ED ; + input RST ; + wire RST ; + input CLK ; + wire CLK ; + input [nb-1:0] DII ; + wire [nb-1:0] DII ; + input START ; + wire START ; + input [nb-1:0] DIR ; + wire [nb-1:0] DIR ; + + output [nb+3:0] DOI ; + wire [nb+3:0] DOI ; + output [nb+3:0] DOR ; + wire [nb+3:0] DOR ; + output RDY ; + reg RDY ; + + reg [3:0] ct; //main phase counter + reg [5:0] ctd; //delay counter + + always @( posedge CLK) begin //Control counter + // + if (RST) begin + ct<=0; + ctd<=63; + RDY<=0; end + else if (START) begin + ct<=0; + ctd<=0; + RDY<=0; end + else if (ED) begin + RDY<=0; + ct<=ct+1; + if (ctd !=6'b111111) + ctd<=ctd+1; + if (ctd==44-16 ) + RDY<=1; + end + + end + + reg signed [nb-1: 0] dr,d1r,d2r,d3r,d4r,d5r,d6r,d7r,d8r,di,d1i,d2i,d3i,d4i,d5i,d6i,d7i,d8i; + always @(posedge CLK) // input register file + begin + if (ED) begin + dr<=DIR; + d1r<=dr; d2r<=d1r; d3r<=d2r;d4r<=d3r; + d5r<=d4r;d6r<=d5r; d7r<=d6r; d8r<=d7r; + di<=DII; + d1i<=di; d2i<=d1i; d3i<=d2i; d4i<=d3i; + d5i<=d4i; d6i<=d5i;d7i<=d6i; d8i<=d7i; + end + end + + reg signed [nb:0] s1r,s1d1r,s1d2r,s1d3r,s1d4r,s1d5r,s1d6r,s1d7r,s1d8r; //even result sums + reg signed [nb:0] s1i,s1d1i,s1d2i,s1d3i,s1d4i,s1d5i,s1d6i,s1d7i,s1d8i; //even result sums + reg signed [nb:0] s2r,s2d1r,s2d2r,s2d3r,s2d4r,s2d5r,s2d6r,s2d7r,s2d8r,m4_12r; //odd result sums + reg signed [nb:0] s2i,s2d1i,s2d2i,s2d3i,s2d4i,s2d5i,s2d6i,s2d7i,s2d8i,m4_12i; //odd result sums + always @(posedge CLK) begin // S1,S2 =t1-t14,m4,m12' and delayed + if (ED && ((ct==9) || (ct==10) || (ct==11) ||(ct==12) || + (ct==13) || (ct==14) ||(ct==15) || (ct==0))) begin + s1r<=d8r + dr ; + s1i<=d8i + di ; + s2r<=d8r - dr ; + s2i<= d8i - di; + end + if (ED) begin //delayed results + s1d1r<=s1r; s1d2r<=s1d1r; s1d1i<=s1i; s1d2i<=s1d1i; + s1d3r<=s1d2r; s1d3i<=s1d2i; s1d4r<=s1d3r; s1d4i<=s1d3i; + s1d5r<=s1d4r; s1d5i<=s1d4i; s1d6r<=s1d5r; s1d6i<=s1d5i; + s1d7r<=s1d6r; s1d7i<=s1d6i; s1d8r<=s1d7r; s1d8i<=s1d7i; + + s2d1r<=s2r; s2d2r<=s2d1r; s2d1i<=s2i; s2d2i<=s2d1i; + s2d3r<=s2d2r; s2d3i<=s2d2i; s2d4r<=s2d3r; s2d4i<=s2d3i; + s2d5r<=s2d4r; s2d5i<=s2d4i; s2d6r<=s2d5r; s2d6i<=s2d5i; + s2d7r<=s2d6r; s2d7i<=s2d6i; s2d8r<=s2d7r; s2d8i<=s2d7i; + if (ct==2) begin + m4_12r<=s2d8r; m4_12i<=s2d8i; end + else if (ct==6) begin + m4_12r<=s2d8i; m4_12i<= 0 - s2d8r; + end + end + end + /////////////////////////////////////////// + //arm of even result calculations + //////////////////////////////////////////// + reg signed [nb+1:0] s3r,s3d1r,s3d2r,s3d3r,s3d4r,s3d5r,s3d6r; + reg signed [nb+1:0] s3i,s3d1i,s3d2i,s3d3i,s3d4i,s3d5i,s3d6i; + always @(posedge CLK) begin //ALU S3: + if (ED) begin + case (ct) + 14 ,15 : begin s3r<= s1d4r+s1r; //t15 //t18 + s3i<= s1d4i+ s1i ;end + 0 ,1 : begin s3r<= s1d6r - s1d2r; //m3, t19 + s3i<= s1d6i - s1d2i ;end + 2 ,3 : begin s3r<= s1d6r +s1d2r; //t16 ,t20 + s3i<= s1d6i+ s1d2i ; end + 4 ,5 : begin s3r<= s1d8r - s1d4r; // m11',t21 + s3i<= s1d8i - s1d4i ; end + endcase + s3d1r<=s3r; s3d1i<=s3i; s3d2r<=s3d1r; s3d2i<=s3d1i; + s3d3r<=s3d2r; s3d3i<=s3d2i; s3d4r<=s3d3r; s3d4i<=s3d3i; + s3d5r<=s3d4r; s3d5i<=s3d4i; s3d6r<=s3d5r; s3d6i<=s3d5i; + end + end + + reg signed [nb+2:0] s4r,s4d1r,s4d2r,s4d3r,s4d4r,s4d5r,s4d6r,s4d7r,m3r; + reg signed [nb+2:0] s4i,s4d1i,s4d2i,s4d3i,s4d4i,s4d5i,s4d6i,s4d7i,m3i; + + always @ (posedge CLK) begin // S4 + if (ED) begin + if ((ct==3) | (ct==4)) begin + s4r<= s3d4r + s3r; //t17 ,t22 + s4i<= s3d4i + s3i; end + else if ((ct==5) | (ct==6) | (ct==8) ) begin + s4r<=s3d6r - s3d2r; //m2,m10', m5' + s4i<= s3d6i - s3d2i; end + else if (ct==7) begin + s4r<=s3d1r + s3d5r; //m13 + s4i<= s3d1i + s3d5i; + end + s4d1r<=s4r; s4d1i<=s4i; s4d2r<=s4d1r; s4d2i<=s4d1i; + s4d3r<=s4d2r; s4d3i<=s4d2i; s4d4r<=s4d3r; s4d4i<=s4d3i; + s4d5r<=s4d4r; s4d5i<=s4d4i; s4d6r<=s4d5r; s4d6i<=s4d5i; + s4d7r<=s4d6r; s4d7i<=s4d6i; + if (ct==7) begin + m3r<=s3d6r; //m3 + m3i<=s3d6i; end + end + end + + wire em707,mpyj7; + assign em707 = ((ct==8) || (ct==10 )||(ct==1) || (ct==5)); //control signals for the multiplier + assign mpyj7 = ((ct==8) || (ct==5)); + + reg signed [nb+2:0] s7r,s7d1r; + reg signed [nb+2:0] s7i,s7d1i; + wire signed [nb+2:0] m707r,m707i,m70r,m70i; + assign m70r = ((ct==1) || (ct==5))? s7r :s4r; //multiplexor at the multiplier input + assign m70i = ((ct==1) || (ct==5))? s7i :s4i; + + MPUC707 #(nb+3) UM707( .CLK(CLK),.EI(ED),.ED(em707), .MPYJ(mpyj7), //multiplier by 0.707 + .DR(m70r),.DI(m70i) ,.DOR(m707r) ,.DOI(m707i)); + + + reg signed [nb+2:0] s3jr,s3ji, m10r,m10i; + always @ (posedge CLK) begin //multiply by J + if (ED) begin + case (ct) + 11: begin s3jr<= s3d6i; //m11 + s3ji<=0 - s3d6r; end + 14: begin s3jr<= s4d7i; //m10 + s3ji<=0 - s4d7r; end + endcase + if (ct==1) begin + m10r<=s3jr; //m10 + m10i<=s3ji; + end + end + end + + reg signed [nb+3:0] s5r,s5d1r,s5d2r,s5d3r,s5d4r,s5d5r,s5d6r,s5d7r,s5d8r,s5d9r, s5d10r,m2r,m2dr; + reg signed [nb+3:0] s5i,s5d1i,s5d2i,s5d3i,s5d4i,s5d5i,s5d6i,s5d7i,s5d8i,s5d9i,s5d10i,m2i,m2di; + always @ (posedge CLK) // S5: + if (ED) begin + case (ct) + 10: begin s5r<=s4d5r + s4d6r; //m0 + s5i<=s4d5i + s4d6i; end + 11: begin s5r<=s4d7r - s4d6r; //m1 + s5i<=s4d7i - s4d6i; end + 12: begin s5r<=m707r + s3jr; //S3 + s5i<= m707i+s3ji;end + 13: begin s5r<=m707r - s3jr; //S4 + s5i<= m707i - s3ji;end + 14: begin s5r<= m3r+m707r; //S1 + s5i<= m3i+m707i ;end + 15: begin s5r<=m3r-m707r ; //S2 + s5i<= m3i -m707i ;end + 6: begin //S2 + s5d10r<=s5d9r ; //S2 + s5d10i<=s5d9i ;end + + endcase + if ((ct==4)||(ct==5)||(ct==6)||(ct==7)) begin + s5d9r<=s5d8r ; s5d9i<=s5d8i ; end + + s5d1r<=s5r; s5d1i<=s5i; s5d2r<=s5d1r; s5d2i<=s5d1i; + s5d3r<=s5d2r; s5d3i<=s5d2i; s5d4r<=s5d3r; s5d4i<=s5d3i; + s5d5r<=s5d4r; s5d5i<=s5d4i; s5d6r<=s5d5r; s5d6i<=s5d5i; + s5d7r<=s5d6r; s5d7i<=s5d6i; s5d8r<=s5d7r; s5d8i<=s5d7i; + + if (ct==13) begin + m2r<=s4d7r; m2i<=s4d7i; end + if (ct==1) begin + m2dr<=m2r; m2di<=m2i; end + + end + + + + reg signed [nb+3:0] s6r,s6i ; + + `ifdef FFT256paramifft // For IFFT + always @ (posedge CLK) begin // S6-- result adder + if (ED) + case (ct) + 13: begin s6r<=s5d2r; // -- Y0 + s6i<=(s5d2i);end //-- Y0 + 15: begin + s6r<=s5d2r - s5r ; //Y2 + s6i<=s5d2i - s5i ; end + 1: begin + s6r<=m2r - s3jr ; //Y4 + s6i<=m2i - s3ji ; end + 3: begin + s6r<=s5d3r - s5d5r ; //Y6 + s6i<= s5d3i -s5d5i ; end + 5:begin s6r<=(s5d9r) ; //-- Y8 + s6i<=(s5d9i) ; end + 7: begin + s6r<= s5d7r + s5d9r ; // Y10 + s6i<= s5d7i + s5d9i ; end + 9: begin // Y12 + s6r<=m2dr +m10r ; + s6i<=m2di + m10i ; + end + 11: begin // Y14 + s6r<= s5d9r + s5d10r ; + s6i<= s5d9i + s5d10i ; + end + endcase + end + + `else + always @ (posedge CLK) begin // S6-- result adder + if (ED) + case (ct) + 13: begin s6r<=s5d2r; // -- Y0 + s6i<=s5d2i;end //-- Y0 + 15: begin + s6r<=s5d2r + s5r ; //Y2 + s6i<=s5d2i + s5i ; end + 1: begin + s6r<=m2r + s3jr ; //Y4 + s6i<=m2i + s3ji ; end + 3: begin + s6r<=s5d3r + s5d5r ; //Y6 + s6i<= s5d3i +s5d5i ; end + 5:begin s6r<=s5d9r; //-- Y8 + s6i<=s5d9i; end + 7: begin + s6r<= s5d7r - s5d9r ; // Y10 + s6i<= s5d7i - s5d9i ; end + 9: begin // Y12 + s6r<=m2dr -m10r ; + s6i<=m2di - m10i ; + end + 11: begin // Y14 + s6r<= s5d9r - s5d10r ; + s6i<= s5d9i - s5d10i ; + end + endcase + end + `endif + + /////////////////////////////////////////////////////////// + //arm of odd result calculations + ////////////////////////////////////////////////////////// + + always @(posedge CLK) begin //ALU S7: + if (ED) + case (ct) + 15:begin s7r<= s2d2r-s2r; //t26 + s7i<= s2d2i- s2i ;end + 0: begin s7r<= s2d4r-s2r; //m6' + s7i<= s2d4i- s2i ; + s7d1r<=s7r; + s7d1i<=s7i;end + 1: begin s7r<= s2d6r - s2r; //t24 + s7i<= s2d6i - s2i; end + 2: begin s7r<= s7r -s7d1r; //m7' + s7i<= s7i- s7d1i ; end + 3: begin s7r<= s2d8r + s2d2r; // t23 + s7i<= s2d8i + s2d2i ; end + 4: begin s7r<= s2d8r + s2d4r; // m14' + s7i<= s2d8i + s2d4i ; + s7d1r<=s7r; + s7d1i<=s7i;end + 5: begin s7r<= s2d8r + s2d6r; // t25 + s7i<= s2d8i + s2d6i ; end + 6: begin s7r<= s7r + s7d1r; //m15' + s7i<= s7i + s7d1i ; end + endcase + end + + wire em541,mpyj541; + wire signed [nb+2:0] m541r,m541i; + assign em541 = ((ct==0) || (ct==4)); //control signals for the multiplier + assign mpyj541 = ((ct==4)); + MPUC541 #(nb+3) UM541( .CLK(CLK),.EI(ED),.ED(em541), .MPYJ(mpyj541), //multiplier by 0.383 + .DR(s7r),.DI(s7i) ,.DOR(m541r) ,.DOI(m541i)); + + + wire em1307,mpyj1307; + wire signed [nb+2:0] m1307r,m1307i; + assign em1307 = ((ct==2) || (ct==6)); //control signals for the multiplier + assign mpyj1307 = ((ct==6)); + MPUC1307 #(nb+3) UM1307( .CLK(CLK),.EI(ED),.ED(em1307), .MPYJ(mpyj1307), //multiplier by 1.306 + .DR(s7r),.DI(s7i) ,.DOR(m1307r) ,.DOI(m1307i)); + + wire em383,mpyj383,c383; + wire signed [nb+2:0] m383r,m383i; + assign em383 = ((ct==3) || (ct==7)); //control signals for the multiplier + assign mpyj383 = ((ct==7)); + assign c383 = (ct==3); + MPUC924_383 #(nb+3) UM383(.CLK(CLK),.EI(ED),.ED(em383),.MPYJ(mpyj383),.C383(c383), //multiplier by 0.383 + .DR(s7r),.DI(s7i) ,.DOR(m383r) ,.DOI(m383i)); + + reg signed [nb+2:0] m8_17r,m8_17i,m9_16r,m9_16i; + always @(posedge CLK) begin //Reg-s + if (ED) begin + if (ct==4 || ct==8) begin + m9_16r<=m541r; //M9_ M16 + m9_16i<=m541i; + end + if ( ct==6 || ct==10) begin + m8_17r<=m1307r; //M8_ M17 + m8_17i<=m1307i; + end + end + end + + + + + reg signed [nb+2:0] s8r,s8i,s8d1r,s8d2r,s8d3r,s8d4r,s8d1i,s8d2i,s8d3i,s8d4i ; + always @ (posedge CLK) begin // S8-- adder + if (ED) + case (ct) + 5,9: begin s8r<=m4_12r +m707r ; // -- S5 S13 + s8i<=m4_12i +m707i ;end //-- + 6,10: begin + s8r<=m4_12r - m707r ; // -- S6 , S14 + s8i<=m4_12i - m707i ; end + 7: begin + s8r<=m8_17r - m383r ; // -- S7 ,S15 + s8i<=m8_17i -m383i ; end + 8: begin + s8r<=m9_16r - m383r ; // -- S8 , S16 + s8i<=m9_16i -m383i ; end + 11: begin + s8r<=m383r - m9_16r ; // -- S7 ,S15 + s8i<=m383i - m9_16i; end + 12: begin + s8r<=m383r - m8_17r; // -- S8 , S16 + s8i<=m383i - m8_17i; end + endcase + s8d1r<=s8r; s8d1i<=s8i; s8d2r<=s8d1r; s8d2i<=s8d1i; + s8d3r<=s8d2r; s8d3i<=s8d2i; s8d4r<=s8d3r; s8d4i<=s8d3i; + end + + reg signed [nb+3:0] s9r,s9d1r,s9d2r,s9d3r,s9d4r,s9d5r,s9d6r,s9d7r,s9d8r,s9d9r, s9d10r,s9d11r,s9d12r,s9d13r; + reg signed [nb+3:0] s9i,s9d1i,s9d2i,s9d3i,s9d4i,s9d5i,s9d6i,s9d7i,s9d8i,s9d9i,s9d10i,s9d11i,s9d12i,s9d13i; + always @ (posedge CLK) // ALU s9: + if (ED) begin + case (ct) + 8,9,12: begin s9r<= s8r + s8d2r; // S9,S11 , S17 + s9i<=s8i + s8d2i ; end + 13: begin s9r<= s8d2r - s8r; // S20 + s9i<=s8d2i - s8i ; end + 10,11,14: begin s9r<=s8d4r - s8d2r; //S10, S12,S18 + s9i<=s8d4i - s8d2i; end + 15: begin s9r<=s8d4r + s8d2r; //S19 + s9i<=s8d4i + s8d2i; end + endcase + + s9d1r<=s9r; s9d1i<=s9i; s9d2r<=s9d1r; s9d2i<=s9d1i; + s9d3r<=s9d2r; s9d3i<=s9d2i; s9d4r<=s9d3r; s9d4i<=s9d3i; + s9d5r<=s9d4r; s9d5i<=s9d4i; s9d6r<=s9d5r; s9d6i<=s9d5i; + s9d7r<=s9d6r; s9d7i<=s9d6i; s9d8r<=s9d7r; s9d8i<=s9d7i; + + s9d9r<=s9d8r ; s9d9i<=s9d8i ; + if ((ct!=8)) begin + s9d10r<=s9d9r ; s9d10i<=s9d9i ; + s9d11r<=s9d10r ; s9d11i<=s9d10i ; end + if ((ct==4) ||(ct==5) ||(ct==7) ||(ct==9) ) begin + s9d12r<=s9d11r ; s9d12i<=s9d11i ; end + if ((ct==5))begin + s9d13r<=s9d12r ; s9d13i<=s9d12i ; end + + end + + + reg signed [nb+3:0] s10r,s10i; + reg signed [nb+3:0] s10dr,s10di; + + `ifdef FFT256paramifft //For IFFT + always @ (posedge CLK) begin // S10-- result adder + if (ED) + case (ct) + 13: begin s10r<=s9d4r -s9r ; // -- Y1 + s10i<=s9d4i -s9i ;end // + 15: begin + s10r<=s9d3r + s9d1r ; //-- Y3 + s10i<=s9d3i + s9d1i ; end + 1: begin + s10r<=s9d7r - s9d1r ; //-- Y5 + s10i<=s9d7i - s9d1i ; end + 3: begin + s10r<=s9d8r + s9d4r ; // -- Y7 + s10i<= s9d8i + s9d4i ;end + + 5:begin s10r<=s9d10r - s9d6r ; //-- Y9 + s10i<=s9d10i - s9d6i ; end + 7: begin + s10r<=s9d12r + s9d7r ; //-- Y11 + s10i<=s9d12i + s9d7i ; end + + 9: begin + s10r<= s9d12r - s9d10r ; // Y13 + s10i<=s9d12i - s9d10i ; end + + 11: begin + s10r<= s9d13r + s9d12r ; // Y15 + s10i<= s9d13i + s9d12i ; end + + endcase + s10dr<=s10r; s10di<=s10i; + end + `else + +// reg signed [nb+3:0] s10r,s10i,s10dr,s10di; + always @ (posedge CLK) begin // S10-- result adder + if (ED) + case (ct) + 13: begin s10r<=s9d4r +s9r ; // -- Y0 + s10i<=s9d4i +s9i ;end // + 15: begin + s10r<=s9d3r - s9d1r ; //-- Y3 + s10i<=s9d3i - s9d1i ; end + 1: begin + s10r<=s9d7r +s9d1r ; //-- Y5 + s10i<=s9d7i +s9d1i ; end + 3: begin + s10r<=s9d8r - s9d4r ; // -- Y7 + s10i<= s9d8i - s9d4i ;end + + 5:begin s10r<=s9d10r + s9d6r ; //-- Y9 + s10i<=s9d10i + s9d6i ; end + 7: begin + s10r<=s9d12r - s9d7r ; //-- Y11 + s10i<=s9d12i - s9d7i ; end + + 9: begin + s10r<= s9d12r + s9d10r ; // Y13 + s10i<=s9d12i + s9d10i ; end + + 11: begin + s10r<= s9d13r - s9d12r ; // Y15 + s10i<= s9d13i - s9d12i ; end + + endcase + s10dr<=s10r; s10di<=s10i; + end + `endif + +//wire signed [nb+3:0] s6sr,s6si; //saturation of results +// assign s6sr = (~s6r[nb+4]&&s6r[nb+3])? ((1'b1 <<(nb+3))-1) : s6r[nb+3:0]; +// assign s6si = (~s6i[nb+4]&&s6i[nb+3])? ((1'b1<<(nb+3))-1) : s6i[nb+3:0]; +// + + wire selo; + assign selo = ct-(ct/2)*2; + assign #1 DOR=selo? s10dr:s6r; + assign #1 DOI= selo? s10di:s6i; + +endmodule Index: pipelined_fft_256/trunk/SRC/ram2x256.v =================================================================== --- pipelined_fft_256/trunk/SRC/ram2x256.v (nonexistent) +++ pipelined_fft_256/trunk/SRC/ram2x256.v (revision 2) @@ -0,0 +1,139 @@ +///////////////////////////////////////////////////////////////////// +//// //// +//// FFT/IFFT 256 points transform //// +//// //// +//// Authors: Anatoliy Sergienko, Volodya Lepeha //// +//// Company: Unicore Systems http://unicore.co.ua //// +//// //// +//// Downloaded from: http://www.opencores.org //// +//// //// +///////////////////////////////////////////////////////////////////// +//// //// +//// Copyright (C) 2006-2010 Unicore Systems LTD //// +//// www.unicore.co.ua //// +//// o.uzenkov@unicore.co.ua //// +//// //// +//// This source file may be used and distributed without //// +//// restriction provided that this copyright statement is not //// +//// removed from the file and that any derivative work contains //// +//// the original copyright notice and the associated disclaimer.//// +//// //// +//// THIS SOFTWARE IS PROVIDED "AS IS" //// +//// AND ANY EXPRESSED OR IMPLIED WARRANTIES, //// +//// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //// +//// WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT //// +//// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. //// +//// IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS //// +//// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //// +//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL //// +//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT //// +//// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, //// +//// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) //// +//// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //// +//// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //// +//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING //// +//// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, //// +//// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //// +//// //// +///////////////////////////////////////////////////////////////////// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// DESCRIPTION : 2-port RAM +// FUNCTION: 2-port RAM with 1 port to write and 1 port to read +// FILES: RAM2x256C.v - dual ported synchronous RAM, contains: +// RAM256.v -single ported synchronous RAM +// PROPERTIES: 1) Has the volume of 2x256 complex data +// 2) Contains 4 single port RAMs for real and imaginary parts of data in the 2-fold volume +// Two halves of RAM are switched on and off in the write mode by the signal ODD +// 3) RAM is synchronous one, the read datum is outputted in 2 cycles after the address setting +// 4) Can be substituted to any 2-port synchronous RAM for example, +// to one RAMB16_S36_S36 in Xilinx FPGAs +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`timescale 1 ns / 1 ps +`include "FFT256_CONFIG.inc" + + + +module RAM2x256C ( CLK ,ED ,WE ,ODD ,ADDRW ,ADDRR ,DR ,DI ,DOR ,DOI ); + `FFT256paramnb + + + output [nb-1:0] DOR ; + wire [nb-1:0] DOR ; + output [nb-1:0] DOI ; + wire [nb-1:0] DOI ; + input CLK ; + wire CLK ; + input ED ; + wire ED ; + input WE ; //write enable + wire WE ; + input ODD ; // RAM part switshing + wire ODD ; + input [7:0] ADDRW ; + wire [7:0] ADDRW ; + input [7:0] ADDRR ; + wire [7:0] ADDRR ; + input [nb-1:0] DR ; + wire [nb-1:0] DR ; + input [nb-1:0] DI ; + wire [nb-1:0] DI ; + + reg oddd,odd2; + always @( posedge CLK) begin //switch which reswiches the RAM parts + if (ED) begin + oddd<=ODD; + odd2<=oddd; + end + end + `ifdef FFT256bufferports1 + //One-port RAMs are used + wire we0,we1; + wire [nb-1:0] dor0,dor1,doi0,doi1; + wire [7:0] addr0,addr1; + + + + assign addr0 =ODD? ADDRW: ADDRR; //MUXA0 + assign addr1 = ~ODD? ADDRW:ADDRR; // MUXA1 + assign we0 =ODD? WE: 0; // MUXW0: + assign we1 =~ODD? WE: 0; // MUXW1: + + //1-st half - write when odd=1 read when odd=0 + RAM256 #(nb) URAM0(.CLK(CLK),.ED(ED),.WE(we0), .ADDR(addr0),.DI(DR),.DO(dor0)); // + RAM256 #(nb) URAM1(.CLK(CLK),.ED(ED),.WE(we0), .ADDR(addr0),.DI(DI),.DO(doi0)); + + //2-d half + RAM256 #(nb) URAM2(.CLK(CLK),.ED(ED),.WE(we1), .ADDR(addr1),.DI(DR),.DO(dor1));// + RAM256 #(nb) URAM3(.CLK(CLK),.ED(ED),.WE(we1), .ADDR(addr1),.DI(DI),.DO(doi1)); + + assign DOR=~odd2? dor0 : dor1; // MUXDR: + assign DOI=~odd2? doi0 : doi1; // MUXDI: + + `else + //Two-port RAM is used + wire [8:0] addrr2 = {ODD,ADDRR}; + wire [8:0] addrw2 = {~ODD,ADDRW}; + wire [2*nb-1:0] di= {DR,DI} ; + + //wire [2*nb-1:0] doi; + reg [2*nb-1:0] doi; + + reg [2*nb-1:0] ram [511:0]; + reg [8:0] read_addra; + always @(posedge CLK) begin + if (ED) + begin + if (WE) + ram[addrw2] <= di; + read_addra <= addrr2; + doi = ram[read_addra]; + end + end + //assign + + assign DOR=doi[2*nb-1:nb]; // Real read data + assign DOI=doi[nb-1:0]; // Imaginary read data + + + `endif +endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.