Exemple #1
0
void CALLA(SymTabESP r, SymTabESP s, SymTabESP d)
{
	if (d == NULL) {
		call_asm(r);
	} else {
		call_asm(r);
		movMR_asm(d, "eax");
	}
}
Exemple #2
0
// Main function *******************************************************************************************
int main() {
	
	kalman_t kalmanState_asm, kalmanState_c;
	dsp_t out_c, out_arm;
	
	int i;
	
	float measurements[] =
{
-0.665365,
-0.329988,
0.164465,
0.043962,
0.295885};
//-0.643138,
//0.615203,
//-0.254512,
//0.261842,
//0.014163,
//0.045181,
//0.554502,
//0.198915,
//0.120703,
//-0.547104,
//0.103219,
//-0.204776,
//0.107782,
//-0.105263,
//0.356157};
//0.172390,
//-0.154121,
//0.134996,
//0.392204,
//0.204622,
//0.006685,
//0.493516,
//0.462641,
//0.103078,
//0.309435,
//0.213690,
//0.092270,
//0.135294,
//-0.227323,
//0.546517,
//1.342128,
//0.548172,
//0.687299,
//0.932445,
//0.115749,
//0.306152,
//-0.110230,
//0.761805,
//0.345018,
//0.529871,
//-0.127723,
//1.029281,
//0.831176,
//0.442460,
//1.515545,
//0.188082,
//0.218138,
//0.885141,
//0.940009,
//0.495364,
//0.577697,
//0.553857,
//0.522537,
//0.607049,
//0.659359,
//0.963857,
//1.054525,
//0.843292,
//0.810490,
//0.570706,
//0.357432,
//0.758009,
//0.536896,
//0.387944,
//1.257416,
//0.993856,
//1.457375,
//1.261647,
//0.659197,
//0.485025,
//0.559893,
//0.695033,
//0.450578,
//0.977574,
//0.619640,
//0.549591,
//1.091964,
//1.141594,
//1.063596,
//1.339442,
//1.154712,
//1.113118,
//0.699106,
//0.675865,
//0.950326,
//1.278943,
//1.152681,
//1.261983,
//1.131821,
//1.522107,
//0.714389,
//2.134284,
//1.210318,
//0.908917,
//1.036300
//};
	
	//float testArray[ARRAY_LENGTH] = {0.1, 0.1, 0.2, 0.3, 0.4};
	float outputArray_c[ARRAY_LENGTH];
	float outputArray_asm[ARRAY_LENGTH];
	float *inputArray = measurements;
	
	// PART II Call ASM function 
	if (call_asm(inputArray, outputArray_asm, ARRAY_LENGTH, &kalmanState_asm) != 0) { 
		printf("Error in ASM function");
		return -1;
	}
		
	// PART II Outputs - ASM code implementation
	for (i=0; i < ARRAY_LENGTH; i++) printf("outputArray_asm[%i] = %0.6f\n", i, outputArray_asm[i]);
	
	
	// PART II Call C function to update kalman state and print output
	if (Kalmannfilter_C(inputArray, outputArray_c, &kalmanState_c, ARRAY_LENGTH) != 0) { 
		printf("Error in C function");
		return -1;
	}
	
	// PART II Outputs - C code implementation
	for (i=0; i < ARRAY_LENGTH; i++) printf("outputArray_c[%i] = %0.6f\n", i, outputArray_c[i]);
	
	
	// PART III Outputs - Our own implementation
	printf("Part 3: Our C DSP implementation\n");
	dsp_c(inputArray, outputArray_c, &out_c);
	
	for (i=0; i < ARRAY_LENGTH; i++) printf("diffArray_c[%i] = %0.9f\n", i, out_c.diffArr[i]);
	printf("mean: %.6f\n", out_c.meanDiff);
	printf("standard deviation: %.9f\n", out_c.standDevDiff);
	for (i=0; i < ARRAY_LENGTH; i++) printf("correlationArr[%i] = %0.9f\n", i, out_c.corrArr[i]);
	for (i=0; i < ARRAY_LENGTH; i++) printf("convolutionArr[%i] = %0.9f\n", i, out_c.convolArr[i]);

	
	// PART III Outputs - CMSIS-DSP implementation (TODO : MOVE PRINT STATEMENTS OUTSIDE OF THIS FUNCTION)
	printf("Part 3: CMSIS-DSP implementation\n");
	dsp_arm(inputArray, outputArray_c, &out_arm);
	
	for (i=0; i < ARRAY_LENGTH; i++) printf("diffArr[%i] = %0.9f\n", i, out_arm.diffArr[i]);
	printf("diffMean: %.9f\n", out_arm.meanDiff);
	printf("standardDev: %.9f\n", out_arm.standDevDiff);
	for (i=0; i < ARRAY_LENGTH; i++) printf("corrArr[%i] = %0.9f\n", i, out_arm.corrArr[i]);
	for (i=0; i < ARRAY_LENGTH; i++) printf("convolArr[%i] = %0.9f\n", i, out_arm.convolArr[i]);
	
	
	return 0;
}