Altera_Forum
Honored Contributor
21 years agoNios readdata problem
Hi, I have a strange problem about reading the readdata.
I designed a user logic and wrote a C code corresponding to it. I hope use this circuit to do caculations twice. And I get right result at the fisrt time reading the readdata signal. However, when I want to get the second result, the result is still the value which is gotten at the first time. Therefore, I use the Modelsim to check the corresponding signal. I find that the chipselect signal just arise once. That means the chipselect signal does not arise at the second time when I want to retrieve the second result. Does anyone have the same experience ?? Following is my C code : # include<stdio.h># include "excalibur.h" float x,y,z,result; float a,b,c,result_1; float cmp = 4.0; int main(void) { float *p; printf("========startCompute======== \n"); x = 1.5; // I have three float-point operands y = 2.0; z = 0.5; printf("x is %f, y is %f, z is %f\n", x,y,z); p = 0x920800; // the starting address of the user logic *p = x; // write the first operand to the first register address *(p+1) = y; // write the second operand to the first register address *(p+2) = z; // write the third operand to the first register address *(p+3) = 2.0; // use to control the start signal. that means when write *(p+3), the circuit starts calculation while(((*(p+3))&& cmp)== 0) { printf("inwhile \n"); } result = *(p+4); // get the first result from the *(p+4) address. It is right. printf("result is = %f\n" ,result); //========================================================== *p = 0.0; // Clear all operands *(p+1) = 0.0; *(p+2) = 0.0; *(p+3) = 0.0; //========================================================== printf("===start second computation!!\n"); a = 1.2; // the three new operands b = 2.1; c = 3.4; printf("a is %f, b is %f, c is %f\n", a,b,c); *p = a; *(p+1) = b; *(p+2) = c; *(p+3) = 2.0; while(((*(p+3))&& cmp)== 0) { printf("inwhile \n"); } result_1 = *(p+4); // get the result from *(p+4) address. But the result is still the same with the fisrt one. Why???????????? printf("result_1 is = %f\n" ,result_1); return 0; } Does anybody can solve this problem ?? Thanks a lot.