Writing hexadecimal to file

Discussion in 'VHDL' started by Ralf Hildebrandt, Mar 6, 2007.

  1. schrieb:


    > I want to write the hexadecimal representation of
    > a 64bit vector into a file. Which library do I have to use ?


    Did you try the stdio_h from <http://bear.ces.cwru.edu/vhdl/>? This
    library offers C-like file I/O. If you trap into conversion problems,
    you could split the vector into smaller groups and convert them.

    Ralf
     
    Ralf Hildebrandt, Mar 6, 2007
    #1
    1. Advertising

  2. Ralf Hildebrandt

    Guest

    Hi newsgroup,


    I want to write the hexadecimal representation of
    a 64bit vector into a file. Which library do I have to use ?

    The "std_textio" library does not seem to have a write function
    for std_logic_vector, so I use "std_logic_textio" as overload
    library. But how can I write the contents as hexadecimal format ?

    Thank you for your opinion.



    signal data64b : std_logic_vector(63 downto 0);

    process(clk)
    file F : text;
    variable L : line;
    begin
    if rising_edge(clk) then
    ...
    if ls_store='1' then
    write(L, data64b);
    writeline(F,L);
    end if;
    end process;
     
    , Mar 6, 2007
    #2
    1. Advertising

  3. wrote:
    > Hi newsgroup,
    >
    >
    > I want to write the hexadecimal representation of
    > a 64bit vector into a file. Which library do I have to use ?


    use ieee.std_logic_1164.all;
    ...
    constant baz:std_logic_vector(63 downto 0):=x"aaaabbbbccccdddd";


    -- Mike Treseler
     
    Mike Treseler, Mar 6, 2007
    #3
  4. Ralf Hildebrandt

    Jim Lewis Guest

    Use hwrite :)

    Current limitations are that your array must have a
    multiple of 4 bits in it - which yours does. If not
    it is trivial to manually extend it.

    std_logic_textio is not a standard yet. it was donated
    to ieee. Updates were made as part of Accellera VHDL 3.0
    standard (July 2006).

    Cheers,
    Jim

    > Hi newsgroup,
    >
    >
    > I want to write the hexadecimal representation of
    > a 64bit vector into a file. Which library do I have to use ?
    >
    > The "std_textio" library does not seem to have a write function
    > for std_logic_vector, so I use "std_logic_textio" as overload
    > library. But how can I write the contents as hexadecimal format ?
    >
    > Thank you for your opinion.
    >
    >
    >
    > signal data64b : std_logic_vector(63 downto 0);
    >
    > process(clk)
    > file F : text;
    > variable L : line;
    > begin
    > if rising_edge(clk) then
    > ...
    > if ls_store='1' then
    > write(L, data64b);
    > writeline(F,L);
    > end if;
    > end process;
    >
     
    Jim Lewis, Mar 6, 2007
    #4
  5. Ralf Hildebrandt

    KJ Guest

    KJ, Mar 7, 2007
    #5
  6. Ralf Hildebrandt

    Guest

    Thank you for your proposals.

    Rgds
    Andre
     
    , Mar 7, 2007
    #6
    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. Victor Hannak
    Replies:
    0
    Views:
    7,483
    Victor Hannak
    Feb 20, 2004
  2. HNguyen
    Replies:
    4
    Views:
    2,429
    HNguyen
    Dec 21, 2004
  3. Cesar Andres Roldan Garcia

    Write an hexadecimal file

    Cesar Andres Roldan Garcia, Mar 30, 2005, in forum: Python
    Replies:
    3
    Views:
    496
  4. Vijay

    How to read a Hexadecimal file ?

    Vijay, Aug 7, 2006, in forum: C Programming
    Replies:
    8
    Views:
    651
    Joe Wright
    Aug 8, 2006
  5. Replies:
    4
    Views:
    488
Loading...

Share This Page