I have seen a few times that this website encourages asking questions for which you already have an answer and to post this answer also. I did exactly this on stack overflow providing the code for a certain function.
I must admit that my question was not perfect as "I was not showing what I had tried". Obviously what I had tried was already the solution to the problem, so I posted it only in the answer itself.
Some people have downvoted the question probably because of not being the kind of question of somebody who has really made an effort to find a solution by himself. Therefore my prize for trying to share my code is losing reputation and I feel that discouraging.
Could you point me towards any successful example of somebody answering his own question to see how to do it?
Could you point me out what is so awful about mine? Calculate the module of a vector, or square root of a number, in VHDL
Finally, what do you think about somehow locking the voting of the question in the situation in which the user is also answering by himself? I mean that in order to downvote such question the voter is forced to notice that the asker has answered by himself, not trying to get an advantage out of other users in exchange for nothing.