#include <IFFT4096.h>

void IFFT4096(int ConfigBaseAddr,int Nsymbol,int Temp0,int Temp1,int InOutAddr0,int InOutAddr1,int CalAddr0,int CalAddr1,int CalAddr2){


    int addr_move1 = (int)ConfigBaseAddr;
	int *addr_move = (int *)addr_move1;
	int a=Nsymbol;
        addr_move[2] = a;
        addr_move[4] = a;

        //reset BIU0 1
		addr_move[0+16*1] = InOutAddr0;
		addr_move[0+16*2] = InOutAddr1;

        //BIU0.T2 1
		addr_move[0+16*3] = InOutAddr0;
		addr_move[1+16*3] = InOutAddr0;
		addr_move[2+16*3] = InOutAddr0;
		//BIU1.T2 2
		addr_move[0+16*4] = InOutAddr1;
		addr_move[1+16*4] = InOutAddr1;
        addr_move[2+16*4] = InOutAddr1;
        //BIU2.T1 3
        addr_move[0+16*5] = Temp0;
        addr_move[1+16*5] = Temp0;
        addr_move[2+16*5] = Temp0;
        //BIU2.T2 4
        addr_move[0+16*6] = Temp0+0x2000;
        addr_move[1+16*6] = Temp0+0x2000;
        addr_move[2+16*6] = Temp0+0x2000;
        //BIU3.T1 5
        addr_move[0+16*7] = Temp1+0x400;
        addr_move[1+16*7] = Temp1+0x400;
        addr_move[2+16*7] = Temp1+0x400;
        //BIU3.T2 6
        addr_move[0+16*8] = Temp1+0x2400;
        addr_move[1+16*8] = Temp1+0x2400;
        addr_move[2+16*8] = Temp1+0x2400;

        //shiftmode 1-6
		addr_move[0+16*9] = CalAddr2;
		addr_move[1+16*9] = CalAddr2;
		addr_move[2+16*9] = CalAddr2;
		addr_move[3+16*9] = CalAddr2;
        //shiftmode 1-6
		addr_move[0+16*10] = CalAddr2;
		addr_move[1+16*10] = CalAddr2;
		addr_move[2+16*10] = CalAddr2;
		addr_move[3+16*10] = CalAddr2;

	//prog 6-12 
    unsigned int addr_biu_base2 = (int)ConfigBaseAddr+0x680;
	unsigned int *addr_biu2 = (unsigned int *)addr_biu_base2;
	//BIU2.T1
        addr_biu2[0] = InOutAddr0;
        addr_biu2[1] = InOutAddr0;
        addr_biu2[2] = InOutAddr0;
        addr_biu2[3] = InOutAddr0;
 
	//BIU2.T2
        addr_biu2[0+16] = InOutAddr0+0x2000;
        addr_biu2[1+16] = InOutAddr0+0x2000;
        addr_biu2[2+16] = InOutAddr0+0x2000;
        addr_biu2[3+16] = InOutAddr0+0x2000;
	//BIU3.T1
        addr_biu2[0+16*2] = InOutAddr1;
        addr_biu2[1+16*2] = InOutAddr1;
        addr_biu2[2+16*2] = InOutAddr1;
        addr_biu2[3+16*2] = InOutAddr1;
	//BIU3.T2
        addr_biu2[0+16*3] = InOutAddr1+0x2000;
        addr_biu2[1+16*3] = InOutAddr1+0x2000;
        addr_biu2[2+16*3] = InOutAddr1+0x2000;
        addr_biu2[3+16*3] = InOutAddr1+0x2000;
	//BIU0.T2
        addr_biu2[0+16*4] = Temp0;
        addr_biu2[1+16*4] = Temp0;
        addr_biu2[2+16*4] = Temp0;
        addr_biu2[3+16*4] = Temp0;
	//BIU1.T2
        addr_biu2[0+16*5] = Temp1+0x400;
        addr_biu2[1+16*5] = Temp1+0x400;
        addr_biu2[2+16*5] = Temp1+0x400;
        addr_biu2[3+16*5] = Temp1+0x400;
	//biu0.T0
        addr_biu2[0+16*6] = Temp0;
	//biu1.T0
        addr_biu2[0+16*7] = Temp1+0x400;
	//butterfly1
        addr_biu2[0+16*8] = CalAddr0;
        addr_biu2[1+16*8] = CalAddr0;
	//butterfly2
        addr_biu2[0+16*9] = CalAddr1;
        addr_biu2[1+16*9] = CalAddr1;

        //shiftmode 7-12
		addr_biu2[0+16*10] = CalAddr2+0x18;
		addr_biu2[1+16*10] = CalAddr2+0x18;
        //shiftmode 7-12
		addr_biu2[0+16*11] = CalAddr2+0x18;
		addr_biu2[1+16*11] = CalAddr2+0x18;



}
