I know. I have one myself...just a general question.
1. Can I cast a "positive" type into a real type in order to apply the log2 ?
2. If #1 is possible, can I recast the result back to a "positive" after applying the log2 function?
1. Yes, but I dont know what it would do if you tried to synthesise it into a non constant location (like assigning a signal), or slicing a signal.
2. Yes, but remember that casting a real to an integer will round the result.