Friday, December 9, 2022

[FIXED] What is the meaning of the hex value syntax with an underscore? eg:parameter FOO = 20'h0002_0

Issue

Pretty much just the title. What does that underscore mean? How is this different from:

parameter FOO = 20'h00020;

I don't know what to look for to find an answer to this question as I don't know what this type of syntax is called.


Solution

From the IEEE Std (1800-2009), section "5.7.1 Integer literal constants":

The underscore character (_) shall be legal anywhere in a number except as the first character. The underscore character is ignored. This feature can be used to break up long numbers for readability purposes.

So, 20'h00020 is the same as 20'h0002_0.

I found this by searching in the above spec for "underscore".



Answered By - toolic
Answer Checked By - Marilyn (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.