std_match
Advanced Member level 4
Yes, it is now completely clear where the confusion comes from.
We are discussing the answers to 2 different questions:
1. How many bits do I need to represent the number N
2. How many bits do I need to address N different values?
I prefer a function that gives the answer to question 1 (TrickyDicky's function).
The reason is that for question 2 I am already used to see it as a range (0 to N-1) or (N-1 downto 0).
It is then clear that the highest index is N-1, and TrickyDicky's function can be used to calculate how many bits are needed to represent it.
We are discussing the answers to 2 different questions:
1. How many bits do I need to represent the number N
2. How many bits do I need to address N different values?
I prefer a function that gives the answer to question 1 (TrickyDicky's function).
The reason is that for question 2 I am already used to see it as a range (0 to N-1) or (N-1 downto 0).
It is then clear that the highest index is N-1, and TrickyDicky's function can be used to calculate how many bits are needed to represent it.