Page 1 of 1

LUT only works in simulation

Posted: Sat Feb 04, 2017 4:44 pm
by howard123
Hello

I am using a 24FV16KA304 device with FC7 and am not able to get my look-up table to work on hardware. It does work perfectly however in simulation.

I have stored about 1100 numbers in the range 1727 to 29271 using the LUT macro.

There is a compiler warning stating that these values are truncated to UINT. I should not have thought it a problem as my numbers are in that range and it is what the macro requires and the chip ROM is 16 bit anyway. Please correct me if I am wrong.

During simulation the loop exits with the correct value but on hardware the loop does not exit unless I force it to escape. My uninformed guess is that the numbers are not stored in ROM correctly.

Any ideas?

Howard
LUT test high res.fcfx
(14.37 KiB) Downloaded 388 times
LUT test high res.msg.txt
(98.93 KiB) Downloaded 363 times

Re: LUT only works in simulation

Posted: Tue Feb 07, 2017 11:01 am
by LeighM
Hi,
The problem is that the LUT component is generating a byte array for the target ROM, so the integers are limited to 255.
Looks like we need to add a property to set the bit width.
In the meantime I have a workaround that should give you what you want.
You will need to add this simulation icon into the start of your main ...
lut16.jpg
lut16.jpg (6.82 KiB) Viewed 7601 times
Then use the simulation "step" button to step over this icon, that will force the component into 16 bit integer mode.
Then you can compile to chip.

Or to avoid having to remember to run the icon, and if you are feeling adventurous, create a Compile Start event macro ...
EvStart.jpg
EvStart.jpg (58.85 KiB) Viewed 7601 times

Re: LUT only works in simulation

Posted: Wed Feb 08, 2017 4:45 pm
by howard123
Thanks
The first method worked. No more truncation messages and hence a fast compile. The second method, which would be more convenient, did not work.

Would you mind having a look at what I have done and correct as necessary.

Hope you can fix this sometime. :D

regards
Howard
LUT test high res 02.fcfx
(21.22 KiB) Downloaded 352 times

Re: LUT only works in simulation

Posted: Thu Feb 09, 2017 9:19 am
by LeighM
Updated project attached ...

Re: LUT only works in simulation

Posted: Thu Feb 09, 2017 3:50 pm
by howard123
Thanks that has worked.
It has used a considerable amount of program store - 4290 bytes. Are the LUT integers being declared as UINT32?
thanks

Re: LUT only works in simulation

Posted: Fri Feb 10, 2017 10:02 am
by LeighM
No, UINT16

Re: LUT only works in simulation

Posted: Wed Feb 15, 2017 11:29 am
by Benj
Here is an updated LUT component with a user configurable data type, this should allow you to select exactly which data type you want to use.

If you have a go with it then please let me know how you get on.

Simply copy the attached file to your "Flowcode 7/Components" directory and restart Flowcode for the changes to be loaded.
lut.fcpx
(5.81 KiB) Downloaded 361 times

Re: LUT only works in simulation

Posted: Mon Feb 27, 2017 10:32 am
by howard123
Thanks Ben that works perfectly
cheers
Howard