Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 515
supernun Avatar asked Sep 11 '12 20:09

supernun


People also ask

What is underscore in hexadecimal?

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 .

What is a hex value?

The hexadecimal number system is a type of number system, that has a base value equal to 16. It is also pronounced sometimes as 'hex'. Hexadecimal numbers are represented by only 16 symbols. These symbols or values are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F.


1 Answers

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".

like image 114
toolic Avatar answered Sep 28 '22 13:09

toolic