- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page