Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17268 Discussions

how to convert vhdl binary coding to hex code??

Altera_Forum
Honored Contributor II
6,862 Views

ai guys... 

 

i'm new here... n i have a problem n need ur helps... 

i already write my vhdl binary code but i don't know how to convert it to hex code... 

my supervisor wants me to change my certain binary value into hex value...but i dont know what to add 

so that i can use hex value in my coding.. i really need ur help... 

 

thanks....
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
5,105 Views

There's a few ways you can do this. 

 

1) If your signal is a multiple of 4-bits, then you can use X to indicate hex. 

 

signal d : std_logic_vector(15 downto 0) := X"1234"; 

 

2) If your signal is a mixture, you can use a concatenate operator, eg., to set 18-bits to 12345h, you could use 

 

signal d : std_logic_vector(17 downto 0) := "01" & X"2345"; 

 

3) Using VHDL-2008 you can use a width specifier 

 

signal d : std_logic_vector(17 downto 0) := 18X"12345"; 

 

You can also use conversion functions, eg., to convert an integer value in hex format 16#12345# to std_logic_vector. 

 

Cheers, 

Dave 

 

edit - fixed the bus widths for you...
0 Kudos
Reply