Help - Search - Members - Calendar
Full Version: Translation error
Impulse Support Forums > Impulse Forums > Impulse C Support Forum
Curreri
The block of code below is used to write to an array. There is an Impulse C translation mistake from source code to hardware. Upon inspection of the generated HDL, it is observed that Impulse-C performs an erroneous 5-bit comparison of c2 and c1 (line 4). The 64-bit comparison of 4294967286 > 4294967296 (which evaluates to false) becomes a 5-bit comparison of 22 > 0 (which evaluates to true), allowing the array address to become negative (line 4). In contrast, the simulator executing the source code on the CPU sets the address to zero (line 5).

CODE
1 co_uint64 c2, c1;
2 co_int32 address, array[20], out;
3 c2 = 4294967286; c1 = 4294967296;
4 if (c2 > c1) address = c2 - c1;
5 else address = 0;
6 out = user(address);


The code was executed on the XD1000 platform. Impulse-C version 3.30 and Quartus 8.1 was used.
RalphBodenner
Thanks for the report, John. I'll try to reproduce this with the latest compiler release.

Regards,
Ralph
RalphBodenner
Hi John,

This bug will be fixed in the upcoming 3.60 release.

Regards,
Ralph
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.