LUT5 probably BUG!
20 Aug 2013 14:48 #37869
by eslavko
LUT5 probably BUG! was created by eslavko
Hello...
Fidling with my gantry homing I use LUT5 function. If I understand all of that correctly then I can declare it's buggy!
lut5.1.in-0 = TRUE
lut5.1.in-1 = FALSE
lut5.1.in-2 = TRUE
lut5.1.in-3 = FALSE
lut5.1.in-4 = FALSE
with function set to 0x330 they return TRUE (correct)
with function set to 0xe10d they return FALSE (should be true! as 0x330+0xdddd=0xe10d)
I was checked that with halmeter and function number and inputs are ok, just result not!
Fidling with my gantry homing I use LUT5 function. If I understand all of that correctly then I can declare it's buggy!
lut5.1.in-0 = TRUE
lut5.1.in-1 = FALSE
lut5.1.in-2 = TRUE
lut5.1.in-3 = FALSE
lut5.1.in-4 = FALSE
with function set to 0x330 they return TRUE (correct)
with function set to 0xe10d they return FALSE (should be true! as 0x330+0xdddd=0xe10d)
I was checked that with halmeter and function number and inputs are ok, just result not!
Please Log in or Create an account to join the conversation.
20 Aug 2013 15:37 - 20 Aug 2013 15:37 #37872
by eslavko
Replied by eslavko on topic LUT5 probably BUG!
sadly found that even calculator at wiki.linuxcnc.org/cgi-bin/wiki.pl?Lut5 is bugy.
See atached schematic for lut. It's divided to 4 sub parts all joinded with two or gates at the right.
I used only 4 input pins and pin 5 (in-4) is tied to false.
So As I calculated LUT by hand (few minutes ago I find calculator ) for the 1'st term is only inverter. And as input0 should be 0 and other's are dont care the result should be sum for:
3 2 1 0 weights
0 0 0 0 0x1
0 0 1 0 0x4
0 1 0 0 0x10
0 1 1 0 0x40
1 0 0 0 0x100
1 0 1 0 0x400
1 1 0 0 0x1000
1 1 1 0 0x4000
sum of 0x5555
but python lut5.py -n4 '(~i0)'
give me sum as 0xffff wich is totaly wrong.
all other parts seems to be ok.
and I tested individula parts and they worked ok, but when it's joined the result is wrong!
and here is calculator formulas:
python lut5.py -n4 '(~i0)' #Wrong result - should be 0x5555
python lut5.py -n4 '(i0 & i1)' #0x8888 is correct
python lut5.py -n4 '((~i1) & i2) & (~i3)' #0x30 is correct
python lut5.py -n4 '((~(i1 | i2)) & i3)' #0x300 is correct
and all of them with final OR
python lut5.py -n4 '(~i0) | (i0 & i1) | ((~i1) & i2) & (~i3) | ((~(i1 | i2)) & i3)' #0xffff is wrong result
See atached schematic for lut. It's divided to 4 sub parts all joinded with two or gates at the right.
I used only 4 input pins and pin 5 (in-4) is tied to false.
So As I calculated LUT by hand (few minutes ago I find calculator ) for the 1'st term is only inverter. And as input0 should be 0 and other's are dont care the result should be sum for:
3 2 1 0 weights
0 0 0 0 0x1
0 0 1 0 0x4
0 1 0 0 0x10
0 1 1 0 0x40
1 0 0 0 0x100
1 0 1 0 0x400
1 1 0 0 0x1000
1 1 1 0 0x4000
sum of 0x5555
but python lut5.py -n4 '(~i0)'
give me sum as 0xffff wich is totaly wrong.
all other parts seems to be ok.
and I tested individula parts and they worked ok, but when it's joined the result is wrong!
and here is calculator formulas:
python lut5.py -n4 '(~i0)' #Wrong result - should be 0x5555
python lut5.py -n4 '(i0 & i1)' #0x8888 is correct
python lut5.py -n4 '((~i1) & i2) & (~i3)' #0x30 is correct
python lut5.py -n4 '((~(i1 | i2)) & i3)' #0x300 is correct
and all of them with final OR
python lut5.py -n4 '(~i0) | (i0 & i1) | ((~i1) & i2) & (~i3) | ((~(i1 | i2)) & i3)' #0xffff is wrong result
Last edit: 20 Aug 2013 15:37 by eslavko.
Please Log in or Create an account to join the conversation.
20 Aug 2013 16:45 #37876
by eslavko
Replied by eslavko on topic LUT5 probably BUG!
It's not so bad....
I find that there are nothing wrong with LUT, but manual is not correct in some terms.
As I had lut divided to 4 subparts and every subparts works then I added function to join them together.
And it's works in most cases, but not all! The weight's should be ORed together and not summed!
So manual say to use SUM, or to be precise hexadecimal SUM. But Should be binary ORed!
I lost a half of the day to discover that....
About calculator...
They are buggy!
python lut5.py -n4 '(~ i0)'
python lut5.py -n4 '(not i0)'
doesn't return same result! (the second one is correct)
I find that there are nothing wrong with LUT, but manual is not correct in some terms.
As I had lut divided to 4 subparts and every subparts works then I added function to join them together.
And it's works in most cases, but not all! The weight's should be ORed together and not summed!
So manual say to use SUM, or to be precise hexadecimal SUM. But Should be binary ORed!
I lost a half of the day to discover that....
About calculator...
They are buggy!
python lut5.py -n4 '(~ i0)'
python lut5.py -n4 '(not i0)'
doesn't return same result! (the second one is correct)
Please Log in or Create an account to join the conversation.
20 Aug 2013 17:05 #37878
by andypugh
Replied by andypugh on topic LUT5 probably BUG!
The manual for LUT5 may attempt to explain it so simply that it ends up being confusing.
Each input is a binary bit, and the inputs are interpreted to give a value from 0 to 31.
The output mask is a 32-bit number. The output value is the bit value of the output mask corresponding to the input value.
Each input is a binary bit, and the inputs are interpreted to give a value from 0 to 31.
The output mask is a 32-bit number. The output value is the bit value of the output mask corresponding to the input value.
Please Log in or Create an account to join the conversation.
Time to create page: 0.062 seconds