help with file I/O and generic constants

B

bister

Hello,

I want to use a generic constant to pass the file name to the
following VHDL program but this type casting is killing me. Any help
with this would be greatly appreciated.


entity eprom is
generic (hex_file_name : text); <------ I want the file name to be
passed in the generic map here
port
(
.........

architecture behav_eprom of eprom is

file hex_file : text is in "/home/nelsob/d5/rtl/eeprom/npp55a.hex" ;
<--- this is what I have now that
works
but is a hard coded file name

........

begin
c_rom <= (others => 255 );
v_fileend := false;
while (not ( ENDFILE(hex_file) or v_fileend )) loop <---- this
is where it is used
-- while ((not ENDFILE(hex_file)) ) loop
READLINE(hex_file, in_text);

Thanks,
 
K

KJ

bister said:
Hello,

I want to use a generic constant to pass the file name to the
following VHDL program but this type casting is killing me. Any help
with this would be greatly appreciated.


entity eprom is
generic (hex_file_name : text); <------ I want the file name to be

You need 'hex_file_name' to be type 'string' above and then do the file
opening and closing down in the architecture.
passed in the generic map here
port
(
........

architecture behav_eprom of eprom is

file hex_file : text is in "/home/nelsob/d5/rtl/eeprom/npp55a.hex" ;

Use the file_open function passing it in 'hex_file_name'.

KJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top