Am 30.12.2011 um 15:23 schrieb Viesturs Lācis:
> 2011/12/30 Michael Haberler <[email protected]>:
>> use lut5:
>>
>> http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Lut5
>> http://www.linuxcnc.org/docs/devel/html/man/man9/lut5.9.html
>>
>> $ lut5 -n4 'i0 or i1 or i2 or i3'
>> # expression = i0 or i1 or i2 or i3
>> #in: i4 i3 i2 i1 i0 out weight
>> # 0: 0 0 0 0 0 0
>> # 1: 0 0 0 0 1 1 0x2
>> # 2: 0 0 0 1 0 1 0x4
>> # 3: 0 0 0 1 1 1 0x8
>> # 4: 0 0 1 0 0 1 0x10
>> # 5: 0 0 1 0 1 1 0x20
>> # 6: 0 0 1 1 0 1 0x40
>> # 7: 0 0 1 1 1 1 0x80
>> # 8: 0 1 0 0 0 1 0x100
>> # 9: 0 1 0 0 1 1 0x200
>> #10: 0 1 0 1 0 1 0x400
>> #11: 0 1 0 1 1 1 0x800
>> #12: 0 1 1 0 0 1 0x1000
>> #13: 0 1 1 0 1 1 0x2000
>> #14: 0 1 1 1 0 1 0x4000
>> #15: 0 1 1 1 1 1 0x8000
>> # setp lut5.N.function 0xfffe
>>
>
> Michael, can You explain in simple language, how does the "weight" work?
> If I understand correctly, the look-up table should list all the
> possible combinations of inputs and specify output - 0 or 1 - for each
> case. But I do not get about the weight.
5 inputs have 2^5 combinations which can be represented in a 32bit int, which
is the function value
The index access the 'table' is computed by giving the inputs a 'weight':
FUNCTION(_) {
int shift = 0;
if(in_0) shift += 1;
if(in_1) shift += 2;
if(in_2) shift += 4;
if(in_3) shift += 8;
if(in_4) shift += 16;
out = (function & (1<<shift)) != 0;
}
see man lut5
poor man's PAL, if you will - I think it's cool
-m
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users