Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers

c2h problem!

Altera_Forum
Honored Contributor II
924 Views

My nios ii version is 8.0,and i used c2h in it ,the function is 

unsigned short add(unsigned short a,unsigned short b){ 

unsigned short sum=0; 

sum=a+b;  

return sum; 

and main function is 

int main() 

unsigned short s1=10,s2=10; 

unsigned s;  

//printf("Hello from Nios II!\n"); 

 

s=add(s1,s2); 

printf("the sum is %ld\n",(long)s); 

return 0; 

the result is the sum is 1 

why?why did i get wrong result with c2h? 

My nios is the crack,so i download the limited sof to board
0 Kudos
0 Replies
Reply