	.section .text.m0, "ax"
	.file	"freOffCompAsm1.m0.asm"
	// DO NOT MODIFY THE CONTENT ABOVE
	.global freOffCompAsm1
freOffCompAsm1:

	R1: M[0] -> BIU1.T0;
	NOP;
	NOP;
	NOP;
	NOP;
	BIU1: Load(T0)(A++) -> M[20];
	BIU1: Load(T0)(A++) -> M[1];                                     								// input signal
	BIU1: Load(T0)(A++) -> M[2];                                           							// fre_offfset_est
	BIU1: Load(T0)(A++) -> M[3];																	// outputAddr

	IMA0: V(512) -> IMA0.T0(Mode0);NOP;
	IMA0: VHigh(T0,0) -> IMA0.T0(Mode0);NOP;
	IMA0: SetShiftMode(T0)-> ShiftMode0(Mode0);NOP;

	R5: PreConfig(M[20]);
	R5: WriteConf(Mfetch) -> KI[0-15](Mode0);

	R4: M[1] -> BIU0.T0(Mode0);
	R5: M[2] -> BIU1.T1(Mode0);
	R3: M[3] -> BIU3.T3(Mode0);
	NOP;NOP;NOP;

	MFetch: REPEAT @(10);

	BIU0: Wait 0 || BIU1: Wait 0 || IMA0: Wait 10 || IMA1: Wait 14 || BIU3: Wait 17;

	MFetch: Lpto %ENDFRECOMP @(KI0);
		// BIU0: Load(T0)(A++) -> IMA0.T3(Mode0) || BIU1: Load(T1)(A++) -> IMA0.T2(Mode0) || IMA0: 0 + T2*T3(ShiftMode0)(C)(S)(SSS)(T) -> BIU3.T1(Mode0) || BIU3: Store(T1,T3)(A++)(Mode0);

		 BIU0: Load(T0)(A++) -> IMA0.T3(Mode0) || BIU1: Load(T1)(A++) -> IMA0.T2(Mode0) || IMA0: 0 + T2*T3(ShiftMode0)(C)(S)(SSS)(T) -> IMA1.T1(Mode0) ||
		 IMA1: T1 << 4(S) -> BIU3.T1(Mode0) || BIU3: Store(T1,T3)(A++)(Mode0);


	ENDFRECOMP:
		BIU0: Wait 0 || BIU1: Wait 0 || IMA0: Wait 0 || IMA1: Wait 0 || BIU3: Wait 0;
		MFetch: REPEAT @(20);
		MFetch:MPU.STOP;
