help with file I/O and generic constants

Discussion in 'VHDL' started by bister, Dec 31, 2007.

  1. bister

    bister Guest

    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,
     
    bister, Dec 31, 2007
    #1
    1. Advertising

  2. bister

    KJ Guest

    "bister" <> wrote in message
    news:...
    > 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
     
    KJ, Dec 31, 2007
    #2
    1. Advertising

  3. bister

    KJ Guest

    "KJ" <> wrote in message
    news:hSYdj.2312$...
    >
    > "bister" <> wrote in message
    > news:...
    >> 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'.
    >


    Forgot to add a link to the FAQ for VHDL language questions.

    http://tams-www.informatik.uni-hamburg.de/vhdl/doc/faq/FAQ1.html

    KJ
     
    KJ, Dec 31, 2007
    #3
  4. bister

    bister Guest

    On Dec 30, 9:15 pm, "KJ" <> wrote:
    > "KJ" <> wrote in message
    >
    > news:hSYdj.2312$...
    >
    >
    >
    >
    >
    > > "bister" <> wrote in message
    > >news:...
    > >> 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'.

    >
    > Forgot to add a link to the FAQ for VHDL language questions.
    >
    > http://tams-www.informatik.uni-hamburg.de/vhdl/doc/faq/FAQ1.html
    >
    > KJ


    Thanks for the help. With the link to the FAQ and your suggestion to
    use file opening I got it to work.

    --RWN
     
    bister, Dec 31, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Maki

    Generic and constants

    Maki, Nov 24, 2004, in forum: VHDL
    Replies:
    11
    Views:
    927
  2. Murat Tasan
    Replies:
    1
    Views:
    8,076
    Chaitanya
    Feb 3, 2009
  3. Replies:
    2
    Views:
    448
  4. Replies:
    1
    Views:
    465
  5. janeruth
    Replies:
    1
    Views:
    982
    janeruth
    Jul 29, 2010
Loading...

Share This Page