do you want to translate hex into binary in VHDL fomat?
such as assembler -> hex file -> binary in VHDL format, and then run the code in FPGA or CPLD use for debuging your microprocessor which is implemented in FPGA or CPLD??
Added after 1 minutes:
I used one c code transfer hex into verilog format, in my opinion, it is the same as VHDL
why i want to do this! now i have a hex file and i want to operate in bit handling!
for example :0x5A ->0101 1010 maybe, I want to get
the 011010 six bits! do you have another solution except transfering hex into binary!
u are right! but i want to get the value of last 5 bits("11110") or 6 bits ("111110")
may do this ?a<=x"FE"&&x"1F"
the result may a<=x"1E" it's get the value of last 5 bits
in vhdl every thing is in binary, you cannot have a data type which can store hex. so when you will read from a file using something like
Code:
variable l1 : line;
variable var1 : std_logic_vector(7 downto 0);
.
.
readline(f1,l1); --read a line from a file f1 which contains hex words example FE
hread(var1,l1); -- read into var1, a hex value from line l1.
The variable var1 will be a binary value. i.e you wont have to do anything to it to convert it to binary. and if you are interested in last 5 bits, then you can do
Code:
variable l1 : line;
variable var1 : std_logic_vector(7 downto 0);
variable var_five_bits : std_logic(4 downto 0);
.
.
readline(f1,l1); --read a line from a file which contains hex words example FE
hread(var1,l1);
var_five_bits := var1(4 downto 0);
if i want to get the mid 4bits .can i get this
signal xx : std_logic_vector (7 downto 0);
signal mid4bites: std_logic_vector (3 downto 0);
mid4bits<=xx(5 downto 2);
if i want to get the mid 4bits .can i get this
signal xx : std_logic_vector (7 downto 0);
signal mid4bites: std_logic_vector (3 downto 0);
mid4bits<=xx(5 downto 2);
do you want to translate hex into binary in VHDL fomat?
such as assembler -> hex file -> binary in VHDL format, and then run the code in FPGA or CPLD use for debuging your microprocessor which is implemented in FPGA or CPLD??
Added after 1 minutes:
I used one c code transfer hex into verilog format, in my opinion, it is the same as VHDL