LUT5

NAME
SYNOPSIS
DESCRIPTION
FUNCTIONS
PINS
PARAMETERS
LICENSE

NAME

lut5 − Arbitrary 5-input logic function based on a look-up table

SYNOPSIS

loadrt lut5 [count=N|names=name1[,name2...]]

DESCRIPTION

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.

Weights for each line of truth table
Bit 4Bit 3Bit 2Bit 1Bit 0 Weight
000000x1
000010x2
000100x4
000110x8
001000x10
001010x20
001100x40
001110x80
010000x100
010010x200
010100x400
010110x800
011000x1000
011010x2000
011100x4000
011110x8000
100000x10000
100010x20000
100100x40000
100110x80000
101000x100000
101010x200000
101100x400000
101110x800000
110000x1000000
110010x2000000
110100x4000000
110110x8000000
111000x10000000
111010x20000000
111100x40000000
111110x80000000

FUNCTIONS

lut5.N

PINS

lut5.N.in-0 bit in
lut5.
N.in-1 bit in
lut5.
N.in-2 bit in
lut5.
N.in-3 bit in
lut5.
N.in-4 bit in
lut5.
N.out bit out

PARAMETERS

lut5.N.function u32 rw

LICENSE

GPL