LUT5
- BigJohnT
-
Topic Author
- Offline
- Administrator
-
Less
More
- Posts: 7000
- Thank you received: 1175
13 Dec 2012 23:13 #27680
by BigJohnT
Replied by BigJohnT on topic LUT5
So you can just start at the top and tick off any that will be true then using the calculator in programming mode toggle the on bits starting from the lower right and set the readout to hex and there you are.
John
John
Please Log in or Create an account to join the conversation.
- PCW
-
- Away
- Moderator
-
Less
More
- Posts: 18527
- Thank you received: 5076
13 Dec 2012 23:15 #27681
by PCW
Replied by PCW on topic LUT5
"Actually, there are only 32 possible outputs of 5 inputs 
You are describing LUT32 which awaits the creation of the 4,294,967,296-bit CPU
"
The are only 32 outputs (one for each input state) _but_ there are 4,294,967,296 possible _functions_ (all 32 bit numbers from 0 to 0xFFFFFFFF)
The number of functions of N binary inputs is 2^(2^N)
which gets big really fast

You are describing LUT32 which awaits the creation of the 4,294,967,296-bit CPU

The are only 32 outputs (one for each input state) _but_ there are 4,294,967,296 possible _functions_ (all 32 bit numbers from 0 to 0xFFFFFFFF)
The number of functions of N binary inputs is 2^(2^N)
which gets big really fast

Please Log in or Create an account to join the conversation.
- BigJohnT
-
Topic Author
- Offline
- Administrator
-
Less
More
- Posts: 7000
- Thank you received: 1175
14 Dec 2012 00:14 #27686
by BigJohnT
Replied by BigJohnT on topic LUT5
I get it even though 0xFFFFFFFF = 4,294,967,295, 0x0 is a valid function which is off no matter what the inputs are doing.
John
John
Please Log in or Create an account to join the conversation.
- PCW
-
- Away
- Moderator
-
Less
More
- Posts: 18527
- Thank you received: 5076
14 Dec 2012 00:23 #27687
by PCW
Replied by PCW on topic LUT5
Yes 0 is always off, 0xFFFFFFFF is always on
As an aside, LUTs are how logic is done in FPGAs
Spartan2s and 3s use LUT4s and Spartan 6's use LUT6's
On the parts we use there are about 2500 to 10000 LUTs available
As an aside, LUTs are how logic is done in FPGAs
Spartan2s and 3s use LUT4s and Spartan 6's use LUT6's
On the parts we use there are about 2500 to 10000 LUTs available
Please Log in or Create an account to join the conversation.
- andypugh
-
- Away
- Moderator
-
Less
More
- Posts: 23315
- Thank you received: 4944
14 Dec 2012 00:52 #27691
by andypugh
Exactly.
It is actually not that hard to convert into hex (which is why programmers use Hex). Just look at the bits in groups of 4.
1000 = 8, 0100 = 4, 0010 = 2, 0001 = 1. Just add them together with A = 10, B = 11 etc
1010 0010 0111 0110 0100 1110 1001 (just some random digits as they came out of the keyboard)
= 0xA2764E9
Replied by andypugh on topic LUT5
So you can just start at the top and tick off any that will be true then using the calculator in programming mode toggle the on bits starting from the lower right and set the readout to hex and there you are.
Exactly.
It is actually not that hard to convert into hex (which is why programmers use Hex). Just look at the bits in groups of 4.
1000 = 8, 0100 = 4, 0010 = 2, 0001 = 1. Just add them together with A = 10, B = 11 etc
1010 0010 0111 0110 0100 1110 1001 (just some random digits as they came out of the keyboard)
= 0xA2764E9
Please Log in or Create an account to join the conversation.
- BigJohnT
-
Topic Author
- Offline
- Administrator
-
Less
More
- Posts: 7000
- Thank you received: 1175
- BigJohnT
-
Topic Author
- Offline
- Administrator
-
Less
More
- Posts: 7000
- Thank you received: 1175
14 Dec 2012 01:06 #27694
by BigJohnT
Ok, I get it now each bit of 4 is one number in the hex. So 1111 is F because 1 + 2 + 4 + 8 = 15 and because you start counting with 0 that is the 16th one.
John
Replied by BigJohnT on topic LUT5
It is actually not that hard to convert into hex (which is why programmers use Hex). Just look at the bits in groups of 4.
1000 = 8, 0100 = 4, 0010 = 2, 0001 = 1. Just add them together with A = 10, B = 11 etc
1010 0010 0111 0110 0100 1110 1001 (just some random digits as they came out of the keyboard)
= 0xA2764E9
Ok, I get it now each bit of 4 is one number in the hex. So 1111 is F because 1 + 2 + 4 + 8 = 15 and because you start counting with 0 that is the 16th one.
John
Please Log in or Create an account to join the conversation.
- PCW
-
- Away
- Moderator
-
Less
More
- Posts: 18527
- Thank you received: 5076
14 Dec 2012 01:13 - 14 Dec 2012 01:14 #27695
by PCW
Replied by PCW on topic LUT5
One hint if you do it by hand is to write the table backwards
11111 1
11110 0
11101 1
11100 1 = B
11011 1
11010 0
11001 0
11000 1 = 9
etc
Then you can convert groups of 4 bits into hex from the top down and write the hex number of the function from left to right
11111 1
11110 0
11101 1
11100 1 = B
11011 1
11010 0
11001 0
11000 1 = 9
etc
Then you can convert groups of 4 bits into hex from the top down and write the hex number of the function from left to right
Last edit: 14 Dec 2012 01:14 by PCW.
Please Log in or Create an account to join the conversation.
- strahlensauger
-
- Offline
- Elite Member
-
Less
More
- Posts: 195
- Thank you received: 66
30 Oct 2020 08:52 #187760
by strahlensauger
Replied by strahlensauger on topic LUT5
I was looking for the linuxcnc-desription of LUT5 and didn't understand the documentation immediately. I found a decent description here:
www.machinekit.io/docs/hal/rtcomps/
A good short summary of this thread.
Maybe that could be incorporated into the linuxcnc description?
www.machinekit.io/docs/hal/rtcomps/
A good short summary of this thread.
Maybe that could be incorporated into the linuxcnc description?
Please Log in or Create an account to join the conversation.
- rootboy
-
- Offline
- Senior Member
-
Less
More
- Posts: 76
- Thank you received: 25
30 Oct 2020 15:54 #187800
by rootboy
Replied by rootboy on topic LUT5
It seems to me that there are three-ish simple steps to filling out your LUT5:
1) Create a blank table based on the number of inputs that you are going to use. We'll use three inputs in this example. That gives us eight possible output states, so we will stop there.
XX321
00000
00001
00010
00011
00100
00101
00110
00111
Your blank table would expand or contract depending on how many inputs you plan on using.
2) Populate this table with what you want your output to be for all of the given states. They don't have to follow any given pattern, they just have to serve your purpose in that for a given input combination you get your desired output.
Each column will represent an input to your LUT5, and you can put them in any order. Again, for this example we will be using only three physical inputs as the inputs to the LUT5. I've labelled them X,X,3,2,1. The "X"s mean we don't care what the input is.
So go ahead and fill out your eight possible combinations.
XX321 Output
00000 = 1
00001 = 0
00010 = 0
00011 = 1
00100 = 1
00101 = 1
00110 = 0
00111 = 1
Reading them from bottom to top, that would be 10111001b or B9h ('b' for Binary, and 'h' for Hex). This would be used for your LUT5 configuration word. But hold on, it is only part of it.
Since we don't have an input "4" or "5", we would never get a valid input there. So from here on out we could set the outputs to all be "0"s.
01000 = 0
01001 = 0
...
11110 = 0
11111 = 0
But while that would be valid, it isn't such a good idea to leave them this way. The safer way to do this is to duplicate the eight possible valid combinations throughout the remainder of the table.
This is because given the historic interaction between houses, woodpeckers, and programmers, something will inevitably go wrong.
Or to put it bluntly, this way you would prevent some knucklehead from tying in an unexpected input to your LUT5 and crashing the entire thing.
Remember, it's one thing to say that you don't care about something, it's an entirely different thing to prove it.
So, this is what you would end up with after filling in the "don't care" states with the valid outputs from the first eight states:
XX321 Output
00000 = 1
00001 = 0
00010 = 0
00011 = 1
00100 = 1
00101 = 1
00110 = 0
001i11 = 1
And with the rest of them duplicated:
01000 = 1
01001 = 0
01010 = 0
01011 = 1
01100 = 1
01101 = 1
01110 = 0
01111 = 1
10000 = 1
10001 = 0
10010 = 0
10011 = 1
10100 = 1
10101 = 1
10110 = 0
10111 = 1
11000 = 1
11001 = 0
11010 = 0
11011 = 1
11100 = 1
11101 = 1
11110 = 0
11111 = 1
3) Now the easy part.
To get the configuration word for the LUT5 you would start from the bottom of the table and work your way back up typing the output bit for each row, creating four bytes (32 bits for the LUT5). Life is simple in this case since for the three input LUT5 the four bytes will repeat themselves.
Now
10111001b whiich is B9h. Put all four of them together and you get B9B9B9B9h.
And for the random person who comes along and wonders what exactly a LUT5 is good for, it's a five input wide (L)ook(U)p (T)able which allows you to set an individual output based on what the five inputs are. The beauty of the thing is that you no longer have to work out the "Product of the Sums" and the "Sum of the Products", and you can put your Kernaugh map in the dumpster.
You don't have to know, or care what is ANDed, ORed, NOTed, XORed, Baked or Fried. You just have to sit down and decide that for a given combination of switches, buttons, and whatnot what your output is going to do.
1) Create a blank table based on the number of inputs that you are going to use. We'll use three inputs in this example. That gives us eight possible output states, so we will stop there.
XX321
00000
00001
00010
00011
00100
00101
00110
00111
Your blank table would expand or contract depending on how many inputs you plan on using.
2) Populate this table with what you want your output to be for all of the given states. They don't have to follow any given pattern, they just have to serve your purpose in that for a given input combination you get your desired output.
Each column will represent an input to your LUT5, and you can put them in any order. Again, for this example we will be using only three physical inputs as the inputs to the LUT5. I've labelled them X,X,3,2,1. The "X"s mean we don't care what the input is.
So go ahead and fill out your eight possible combinations.
XX321 Output
00000 = 1
00001 = 0
00010 = 0
00011 = 1
00100 = 1
00101 = 1
00110 = 0
00111 = 1
Reading them from bottom to top, that would be 10111001b or B9h ('b' for Binary, and 'h' for Hex). This would be used for your LUT5 configuration word. But hold on, it is only part of it.
Since we don't have an input "4" or "5", we would never get a valid input there. So from here on out we could set the outputs to all be "0"s.
01000 = 0
01001 = 0
...
11110 = 0
11111 = 0
But while that would be valid, it isn't such a good idea to leave them this way. The safer way to do this is to duplicate the eight possible valid combinations throughout the remainder of the table.
This is because given the historic interaction between houses, woodpeckers, and programmers, something will inevitably go wrong.
Or to put it bluntly, this way you would prevent some knucklehead from tying in an unexpected input to your LUT5 and crashing the entire thing.
Remember, it's one thing to say that you don't care about something, it's an entirely different thing to prove it.
So, this is what you would end up with after filling in the "don't care" states with the valid outputs from the first eight states:
XX321 Output
00000 = 1
00001 = 0
00010 = 0
00011 = 1
00100 = 1
00101 = 1
00110 = 0
001i11 = 1
And with the rest of them duplicated:
01000 = 1
01001 = 0
01010 = 0
01011 = 1
01100 = 1
01101 = 1
01110 = 0
01111 = 1
10000 = 1
10001 = 0
10010 = 0
10011 = 1
10100 = 1
10101 = 1
10110 = 0
10111 = 1
11000 = 1
11001 = 0
11010 = 0
11011 = 1
11100 = 1
11101 = 1
11110 = 0
11111 = 1
3) Now the easy part.
To get the configuration word for the LUT5 you would start from the bottom of the table and work your way back up typing the output bit for each row, creating four bytes (32 bits for the LUT5). Life is simple in this case since for the three input LUT5 the four bytes will repeat themselves.
Now
10111001b whiich is B9h. Put all four of them together and you get B9B9B9B9h.
And for the random person who comes along and wonders what exactly a LUT5 is good for, it's a five input wide (L)ook(U)p (T)able which allows you to set an individual output based on what the five inputs are. The beauty of the thing is that you no longer have to work out the "Product of the Sums" and the "Sum of the Products", and you can put your Kernaugh map in the dumpster.
You don't have to know, or care what is ANDed, ORed, NOTed, XORed, Baked or Fried. You just have to sit down and decide that for a given combination of switches, buttons, and whatnot what your output is going to do.
Please Log in or Create an account to join the conversation.
Time to create page: 0.105 seconds