Writing Testbench Output Results

Discussion in 'VHDL' started by Analog Guy, Sep 29, 2004.

  1. Analog Guy

    Analog Guy Guest

    I am a bit confused about how to write testbench results to both the
    ModelSim screen as well as to an output file??? I was under the
    assumption that a WRITELINE destroys the LINE variable, hence I tried
    the following:

    PROCEDURE print_main_header (text_in : IN STRING) IS
    VARIABLE L : LINE;
    VARIABLE F : LINE;
    BEGIN
    WRITE(L, MAJOR_DIVIDER);
    F := L;
    WRITELINE(OUTPUT, L); -- write to ModelSim window
    WRITELINE(output_file, F); -- write to file


    But received the following ModelSim failure:

    ** Failure: (vsim-5) ****** Memory failure. *****
    # Bad pointer/access type passed to memory subsystem.
    # Pointer may have been previously deallocated.

    Any explanation of the problem would be appreciated.
    Analog Guy, Sep 29, 2004
    #1
    1. Advertising

  2. Analog Guy

    Jim Lewis Guest

    In the next revision of VHDL, we are adding a function
    like the following to std.textio:

    procedure tee (file F : TEXT; variable L : in LINE) is
    variable CopiedBuf : LINE;
    begin
    CopiedBuf := new STRING'(L.all);
    writeline(F, CopiedBuf);
    deallocate (CopiedBuf);
    writeline(OUTPUT, L) ;
    end procedure tee;

    If you do this alot and decide to put it in a package,
    do not name it tee as when the next revision of the language
    is released, you will have a name conflict.

    Cheers,
    Jim

    > I am a bit confused about how to write testbench results to both the
    > ModelSim screen as well as to an output file??? I was under the
    > assumption that a WRITELINE destroys the LINE variable, hence I tried
    > the following:
    >
    > PROCEDURE print_main_header (text_in : IN STRING) IS
    > VARIABLE L : LINE;
    > VARIABLE F : LINE;
    > BEGIN
    > WRITE(L, MAJOR_DIVIDER);
    > F := L;
    > WRITELINE(OUTPUT, L); -- write to ModelSim window
    > WRITELINE(output_file, F); -- write to file
    >
    >
    > But received the following ModelSim failure:
    >
    > ** Failure: (vsim-5) ****** Memory failure. *****
    > # Bad pointer/access type passed to memory subsystem.
    > # Pointer may have been previously deallocated.
    >
    > Any explanation of the problem would be appreciated.



    --
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Jim Lewis
    Director of Training mailto:
    SynthWorks Design Inc. http://www.SynthWorks.com
    1-503-590-4787

    Expert VHDL Training for Hardware Design and Verification
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Jim Lewis, Sep 29, 2004
    #2
    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. Stephane ACOUNIS

    Tutorial on writing testbench files

    Stephane ACOUNIS, Jan 21, 2004, in forum: VHDL
    Replies:
    7
    Views:
    15,925
    QuestaTechnologies
    Apr 20, 2010
  2. Monique Y. Mudama
    Replies:
    1
    Views:
    448
    Monique Y. Mudama
    Jun 28, 2005
  3. titan85
    Replies:
    0
    Views:
    1,943
    titan85
    Apr 21, 2010
  4. Mav
    Replies:
    22
    Views:
    364
  5. o pere o
    Replies:
    7
    Views:
    173
Loading...

Share This Page