0 votes
in Verilog by (200 points)

How do you use hex in Verilog?

2 Answers

0 votes
by (240 points)

Hex in Verilog are 16 based integers. I usually explicitly define the size, then type "'h" and then the value. I use hex values when I need some hardware-close representation of data: register's fields, sometimes in arithmetic, floating point representation, etc.

localparam mask = 16'hfc73;
reg [15:0] rega = 16'h0e58;
assign fields = rega & mask;

0 votes
by (240 points)

8'h23 = 35 (Decimal) = 0010_0011 (Binary)

Hardware Coder Community

© 2022 by Hardware Coder. User contributions are licensed under cc by-sa 4.0 with attribution required. Attribution means a link to the question, answer, user, etc on this site.

This site is owned and operated by Hardware Coder in McKinney, Texas.

Send Us A Message
About Us

By using this site, you agree to the following:

Privacy Policy
Terms and Conditions
DMCA Policy
Earnings Disclaimer
Legal Disclaimer

...