- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hi, I am pretty new to Verilog and Quartus II, and was hoping someone could help me out.
My output is a 12-bit signed register. I get the value of this through an equation, and as part of that equation I have an exponential calculation, 2**B (where B is a register containing a value of 0-10). Doing this gives me an error "Warning (10230): Verilog HDL assignment warning at xxx.v(25): truncated value with size 32 to match size of target (12)", but the value of the calculation is correct. I think this is because it is treating the 2 as 32-bit integer, then when it truncates to 12 bits, it is just cutting off leading zeroes. So I tried changing it to something like 2'd2**B, but then the result of the calculation is wrong. Is there a way to do an exponent without getting an error? Thanks so much!Lien copié
2 Réponses
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
We should be clear. You are not getting an error but a warning. The warning is simply telling you that the value (2**B) has a result that is larger than 12 bits.
You can safely ignore the warning. or change it to this: {12'd2}**B; Jake- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Thank you very much for the help. Just so that I can learn something through this process, I would really appreciate it if you could tell me how the code is interpreted differently. How is {12'd2) different than 12'd2? Thanks.

Répondre
Options du sujet
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable