EDAboard.com | EDAboard.de | EDAboard.co.uk | WTWH Media

read binary file in VHDL

Ask a question - edaboard.com

elektroda.net NewsGroups Forum Index - VHDL Language - read binary file in VHDL

elmakhloufi assaad
Guest

Mon Feb 26, 2018 1:19 pm   



I want to get access and read binary file content pixel of image from ENVI logiciel :size (100*100) pixel coded each pixel in 16 bits in vhdl.any idea or advice ?

Nicolas Matringe
Guest

Mon Feb 26, 2018 11:17 pm   



On 26.02.2018 12:19, elmakhloufi assaad wrote:
Quote:
I want to get access and read binary file content pixel of image from ENVI logiciel :size (100*100) pixel coded each pixel in 16 bits in vhdl.any idea or advice ?


Keep in mind that this can only work in simulation.
There are plenty of examples on how to access files with VHDL, Google is
definitely your friend here.
http://lmgtfy.com/?iie=1&q=read+binary+files+vhdl

Nicolas

andrew_b
Guest

Tue Feb 27, 2018 7:41 am   



On 26.02.2018 12:19, elmakhloufi assaad wrote:
> I want to get access and read binary file content pixel of image from ENVI logiciel :size (100*100) pixel coded each pixel in 16 bits in vhdl.any idea or advice ?

Here is my example:

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;

entity binary is
end binary;

architecture rtl of binary is

signal s : std_logic_vector (7 downto 0);

begin

process

subtype byte is character;
type binfile is file of byte;

file f : binfile;
variable b : byte;

begin
s <= (others => '0');
wait for 10 ns;

File_Open (f, "util.o", read_mode);

while (not EndFile (f)) loop
Read (f, b);
s <= std_logic_vector (to_unsigned (byte'pos(b), s'length));
wait for 10 ns;
end loop;

File_Close (f);

wait for 10 ns;
s <= (others => '0');

wait; -- forever
end process;

end rtl;

elmakhloufi assaad
Guest

Tue Feb 27, 2018 1:35 pm   



Le lundi 26 février 2018 11:19:07 UTC, elmakhloufi assaad a écrit :
Quote:
I want to get access and read binary file content pixel of image from ENVI logiciel :size (100*100) pixel coded each pixel in 16 bits in vhdl.any idea or advice ?
@andrew_b thankyou for this exemple , when i simulate this code with my binary file the message : he coldnt open file?


elmakhloufi assaad
Guest

Tue Feb 27, 2018 1:43 pm   



Le mardi 27 février 2018 11:35:49 UTC, elmakhloufi assaad a écrit :
Quote:
Le lundi 26 février 2018 11:19:07 UTC, elmakhloufi assaad a écrit :
I want to get access and read binary file content pixel of image from ENVI logiciel :size (100*100) pixel coded each pixel in 16 bits in vhdl.any idea or advice ?
@andrew_b thankyou for this exemple , when i simulate this code with my binary file the message : he coldnt open file?

Could not read binary file
C:\Users\hp\Desktop\file\vhdl.txt., because it was not written by Xilinx
Simulator
Simulation stopped when executing process: binary.vhd:14
on line 26 in file "C:/Xilinx92i/ENVI_read/binary.vhd"

Charles Bailey
Guest

Sun Mar 04, 2018 2:45 am   



On 2018-02-27 05:43, elmakhloufi assaad wrote:
Quote:
Le mardi 27 février 2018 11:35:49 UTC, elmakhloufi assaad a écrit :
Le lundi 26 février 2018 11:19:07 UTC, elmakhloufi assaad a écrit :
I want to get access and read binary file content pixel of image from ENVI logiciel :size (100*100) pixel coded each pixel in 16 bits in vhdl.any idea or advice ?
@andrew_b thankyou for this exemple , when i simulate this code with my binary file the message : he coldnt open file?
Could not read binary file
C:\Users\hp\Desktop\file\vhdl.txt., because it was not written by Xilinx
Simulator
Simulation stopped when executing process: binary.vhd:14
on line 26 in file "C:/Xilinx92i/ENVI_read/binary.vhd"


Try using vhdl-93 file_open syntax. Also, try fully qualifying the file
name. Also, make sure the vhdl is compiled with the vhdl-93 option. (Or
later. The file_open syntax was changed between vhdl-87 and vhdl-93.
Also, vhdl-87 defined only 128 values for the character data type;
vhdl-93 defined all 256 possible values for a byte.)


VARIABLE open_status : file_open_status;


File_Open (open_status, f, "fully_qualified_filename", read_mode);

elektroda.net NewsGroups Forum Index - VHDL Language - read binary file in VHDL

Ask a question - edaboard.com

Arabic version Bulgarian version Catalan version Czech version Danish version German version Greek version English version Spanish version Finnish version French version Hindi version Croatian version Indonesian version Italian version Hebrew version Japanese version Korean version Lithuanian version Latvian version Dutch version Norwegian version Polish version Portuguese version Romanian version Russian version Slovak version Slovenian version Serbian version Swedish version Tagalog version Ukrainian version Vietnamese version Chinese version Turkish version
EDAboard.com map