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


	.global	Transform4Asm


Transform4Asm:
	R1: M[0] -> BIU1.T0;
	NOP;
	NOP;
	NOP;
	BIU1:Load(T0)(A++) -> M[0](Mode0);	//KI
	BIU1:Load(T0)(A++) -> M[1](Mode0);	//ShiftMode
	BIU1:Load(T0)(A++) -> M[2](Mode0);	//Input
	BIU1:Load(T0)(A++) -> M[3](Mode0);	//Output
	BIU1:Load(T0)(A++) -> M[10](Mode0);	//factor1
	BIU1:Load(T0)(A++) -> M[11](Mode0);	//factor2
	BIU1:Load(T0)(A++) -> M[12](Mode0);	//factor3
	BIU1:Load(T0)(A++) -> M[13](Mode0);	//factor4
	NOP;
	NOP;
	R5:PreConfig(M[0])(Mode0);
	R0:M[1] -> IMA0.T0(Mode0) || R5:WriteConf(Mfetch)->KI[0-3](Mode0);
	R0:M[1] -> IMA1.T0(Mode0) || R2:M[2] -> BIU2.T0(Mode0);
	R2:M[1] -> IMA2.T0(Mode0) || R3:M[3] -> BIU3.T1(Mode0);
	R0:M[10] -> IMA0.T1(Mode0) ||R2:M[1] -> IMA3.T0(Mode0) ;
	R0:M[11] -> IMA0.T2(Mode0) || R1: M[10] -> IMA1.T2(Mode0) || R2: M[10] -> IMA2.T3(Mode0) || R3: M[10] -> IMA3.T4(Mode0) || IMA0:SetShiftMode(T0) -> SHIFTMODE0(Mode0);//load factor to IMA
	R0:M[12] -> IMA0.T3(Mode0) || R1: M[11] -> IMA1.T3(Mode0) || R2: M[11] -> IMA2.T4(Mode0) || R3: M[11] -> IMA3.T1(Mode0) || IMA1:SetShiftMode(T0) -> SHIFTMODE0(Mode0);
	R0:M[13] -> IMA0.T4(Mode0) || R1: M[12] -> IMA1.T4(Mode0) || R2: M[12] -> IMA2.T1(Mode0) || R3: M[12] -> IMA3.T2(Mode0) || IMA2:SetShiftMode(T0) -> SHIFTMODE0(Mode0);
	R1: M[13] -> IMA1.T1(Mode0) || R2: M[13] -> IMA2.T2(Mode0) || R3: M[13] -> IMA3.T3(Mode0) ||IMA3:SetShiftMode(T0) -> SHIFTMODE0(Mode0);

	BIU2:wait 0 || IMA0: wait 10 ||IMA1: wait 10 || IMA2: wait 10 || IMA3: wait 10 || SHU0: wait 14 || SHU1: wait 14  || SHU2: wait 14  || SHU3: wait 14  ||BIU3: wait 17;
	MFetch:LPTO %BLOCK @(KI0 - 0);
	BIU2:Load(T0) -> IMA0.T0(Mode0) || IMA0: 0 + T1*T0(ShiftMode0)(C)(S)(SSS)(T) -> SHU0.T0(Mode0);
	BIU2:Load(T0) -> IMA1.T0(Mode0) || IMA1: 0 + T1*T0(ShiftMode0)(C)(S)(SSS)(T) -> SHU1.T0(Mode0);
	BIU2:Load(T0) -> IMA2.T0(Mode0) || IMA2: 0 + T1*T0(ShiftMode0)(C)(S)(SSS)(T) -> SHU2.T0(Mode0);
	BIU2:Load(T0)(A++) -> IMA3.T0(Mode0) || IMA3: 0 + T1*T0(ShiftMode0)(C)(S)(SSS)(T) -> SHU3.T0(Mode0);
	BIU2:Load(T0) -> IMA0.T0(Mode0) || IMA0: 0 + T2*T0(ShiftMode0)(C)(S)(SSS)(T) -> SHU0.T1(Mode0) || SHU0: T0+T1(S) -> SHU0.T2(Mode0);
	BIU2:Load(T0) -> IMA1.T0(Mode0) || IMA1: 0 + T2*T0(ShiftMode0)(C)(S)(SSS)(T) -> SHU1.T1(Mode0) || SHU1: T0+T1(S) -> SHU1.T2(Mode0);
	BIU2:Load(T0) -> IMA2.T0(Mode0) || IMA2: 0 + T2*T0(ShiftMode0)(C)(S)(SSS)(T) -> SHU2.T1(Mode0) || SHU2: T0+T1(S) -> SHU2.T2(Mode0);
	BIU2:Load(T0)(A++) -> IMA3.T0(Mode0) || IMA3: 0 + T2*T0(ShiftMode0)(C)(S)(SSS)(T) -> SHU3.T1(Mode0) || SHU3: T0+T1(S) -> SHU3.T2(Mode0);
	BIU2:Load(T0) -> IMA0.T0(Mode0) ||IMA0:0 + T3*T0(ShiftMode0)(C)(S)(SSS)(T) ->SHU0.T0(Mode0) || SHU0: T2+T0(S) -> SHU0.T2(Mode0);
	BIU2:Load(T0) -> IMA1.T0(Mode0)  ||IMA1:0 + T3*T0(ShiftMode0)(C)(S)(SSS)(T) ->SHU1.T0(Mode0) || SHU1: T2+T0(S) -> SHU1.T2(Mode0);
	BIU2:Load(T0) -> IMA2.T0(Mode0)  ||IMA2:0 + T3*T0(ShiftMode0)(C)(S)(SSS)(T) ->SHU2.T0(Mode0) || SHU2: T2+T0(S) -> SHU2.T2(Mode0);
	BIU2:Load(T0)(A++) -> IMA3.T0(Mode0)  ||IMA3:0 + T3*T0(ShiftMode0)(C)(S)(SSS)(T) ->SHU3.T0(Mode0) || SHU3: T2+T0(S) -> SHU3.T2(Mode0);
	BIU2:Load(T0) -> IMA0.T0(Mode0)  ||IMA0: 0 + T4*T0(ShiftMode0)(C)(S)(SSS)(T) -> SHU0.T0(Mode0) || SHU0: T2+T0(S) -> BIU3.T0(Mode0) || BIU3:Store(T0,T1)(A++)(Mode0);
	BIU2:Load(T0) -> IMA1.T0(Mode0)  ||IMA1: 0 + T4*T0(ShiftMode0)(C)(S)(SSS)(T) -> SHU1.T0(Mode0) || SHU1: T2+T0(S) -> BIU3.T0(Mode0) || BIU3:Store(T0,T1)(A++)(Mode0);
	BIU2:Load(T0) -> IMA2.T0(Mode0)  ||IMA2: 0 + T4*T0(ShiftMode0)(C)(S)(SSS)(T) -> SHU2.T0(Mode0) || SHU2: T2+T0(S) -> BIU3.T0(Mode0) || BIU3:Store(T0,T1)(A++)(Mode0);
	BIU2:Load(T0)(A++) -> IMA3.T0(Mode0)  ||IMA3: 0 + T4*T0(ShiftMode0)(C)(S)(SSS)(T) -> SHU3.T0(Mode0) || SHU3: T2+T0(S) -> BIU3.T0(Mode0) || BIU3:Store(T0,T1)(A++)(Mode0);
	BLOCK:
	BIU2:wait 0 || IMA0: wait 0 ||IMA1: wait 0 || IMA2: wait 0 || IMA3: wait 0 || SHU0: wait 0 || SHU1: wait 0  || SHU2: wait 0  || SHU3: wait 0  || BIU3: wait 0;

	MFetch:REPEAT @(35);
	MFetch:MPU.STOP;
