Writing Testbench Output Results

A

Analog Guy

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.
 
J

Jim Lewis

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:[email protected]
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

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

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top