LUT5(9)

πŸ“¦
version 2.9.4 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– LUT5(9) πŸ’–

okay bestie, welcome to the lut5 page β€” it lives in the HAL Component section and it is genuinely one of my faves because it can be literally any logic gate you can dream of. grab a strawberry πŸ“ and let's get into it.


🌸 NAME 🌸

lut5 β€” arbitrary 5-input logic function based on a look-up table. yes that's it, that's the whole name, and it is exactly what it says. iconic.

πŸ¦‹ SYNOPSIS πŸ¦‹

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

πŸ’… DESCRIPTION πŸ’…

okay so here's the tea β˜• β€” lut5 constructs a logic function with up to 5 inputs using a look-up table. The value for function can be determined by writing the truth table, and computing the sum of all the weights for which the output value would be TRUE. The weights are hexadecimal, not decimal, so hexadecimal math must be used to sum the weights (do not come at me with decimal, it's not giving). A wiki page has a calculator to assist in computing the proper value for function:

https://wiki.linuxcnc.org/cgi-bin/wiki.pl?Lut5

and like, the range on this thing? Note that LUT5 will generate any of the 4,294,967,296 logical functions of 5 inputs, so AND, OR, NAND, NOR, XOR and every other combinatorial function is possible. she really said "I contain multitudes" πŸ’…

✨ Example Functions ✨

  • A 5-input and function is TRUE only when all the inputs are true, so the correct value for function is 0x80000000. no crumbs. πŸ‘‘
  • A 2-input or function would be the sum of 0x2 + 0x4 + 0x8, so the correct value for function is 0xe.
  • A 5-input or function is TRUE whenever any of the inputs are true, so the correct value for function is 0xfffffffe. Because every weight except 0x1 is true, the function is the sum of every line except the first one. subtle but slay.
  • 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. important bestie, don't skip that one!!

πŸŽ€ and now the moment you've all been waiting for: the weights for each line of the truth table. left to right that's Bit 4, Bit 3, Bit 2, Bit 1, Bit 0, then the weight. all 32 lines, no skipping, i would never do you like that πŸ’œ
  • 0 0 0 0 0 β†’ 0x1
  • 0 0 0 0 1 β†’ 0x2
  • 0 0 0 1 0 β†’ 0x4
  • 0 0 0 1 1 β†’ 0x8
  • 0 0 1 0 0 β†’ 0x10
  • 0 0 1 0 1 β†’ 0x20
  • 0 0 1 1 0 β†’ 0x40
  • 0 0 1 1 1 β†’ 0x80
  • 0 1 0 0 0 β†’ 0x100
  • 0 1 0 0 1 β†’ 0x200
  • 0 1 0 1 0 β†’ 0x400
  • 0 1 0 1 1 β†’ 0x800
  • 0 1 1 0 0 β†’ 0x1000
  • 0 1 1 0 1 β†’ 0x2000
  • 0 1 1 1 0 β†’ 0x4000
  • 0 1 1 1 1 β†’ 0x8000
  • 1 0 0 0 0 β†’ 0x10000
  • 1 0 0 0 1 β†’ 0x20000
  • 1 0 0 1 0 β†’ 0x40000
  • 1 0 0 1 1 β†’ 0x80000
  • 1 0 1 0 0 β†’ 0x100000
  • 1 0 1 0 1 β†’ 0x200000
  • 1 0 1 1 0 β†’ 0x400000
  • 1 0 1 1 1 β†’ 0x800000
  • 1 1 0 0 0 β†’ 0x1000000
  • 1 1 0 0 1 β†’ 0x2000000
  • 1 1 0 1 0 β†’ 0x4000000
  • 1 1 0 1 1 β†’ 0x8000000
  • 1 1 1 0 0 β†’ 0x10000000
  • 1 1 1 0 1 β†’ 0x20000000
  • 1 1 1 1 0 β†’ 0x40000000
  • 1 1 1 1 1 β†’ 0x80000000

πŸŽ€ FUNCTIONS πŸŽ€

lut5.N

✨ PINS ✨

every pin, all six of them, look at her go:

  • 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 πŸ”₯

just the one, and she's powerful:

  • lut5.N.function β€” u32 rw

πŸ‘‘ SEE ALSO πŸ‘‘

and(9), logic(9), not(9), or2(9), xor2(9). the whole friend group fr fr 🫢

πŸ’œ AUTHOR πŸ’œ

Jeff Epler

🌈 LICENSE 🌈

GPL


LinuxCNC Documentation β€” 2026-03-17 β€” and that's the whole page bestie, you ate, go build a truth table πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from