lut5 − Arbitrary 5-input logic function based on a look-up table
loadrt lut5 [count=N|names=name1[,name2...]] |
lut5 constructs an arbitrary logic function with up to 5 inputs using a look-up table. The function is specified by function. The necessary value for function can be determined by writing the truth table, and computing the sum of the weights for which the output value should be TRUE.
Example
Functions
A 5-input and function is TRUE only when all the
inputs are true, so the correct value for function is
0x80000000.
A 5-input or function is TRUE whenever any of the inputs are true, so the correct value for function is 0xffffffffe.
A 2-input xor function is TRUE whenever exactly one of the inputs is true, so the correct value for function is 0x6. Only in-0 and in-1 should be connected to signals, because if any other bit is TRUE then the output will be FALSE.