lut5 is quite useful - I rather use that than gobs of and,or and not

here's a trivial script to make it a bit easier to use: 
http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Lut5

given a boolean expression of inputs, it will create truth table and function 
value ready to paste into a HAL file.

Example: 1-out-of-2 mux:

$ python lut5.py -n3 '(i2 and i1) or (not i2 and i0)'

 # expression = (i2 and i1) or (not i2 and i0) 
 #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  0
 # 3:  0  0  0  1  1  1   0x8
 # 4:  0  0  1  0  0  0
 # 5:  0  0  1  0  1  0
 # 6:  0  0  1  1  0  1   0x40
 # 7:  0  0  1  1  1  1   0x80
 # setp lut5.N.function 0xca

-Michael


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to