[SOLVED] VHDL simulation: $display vs report

Status
Not open for further replies.

LatticeSemiconductor

Member level 2
Joined
Aug 31, 2013
Messages
45
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
589
Hello all,

i have a testbench written in verilog that does the following:


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
initial
begin
 
    $display(" ") ;
    $display(" !!!!!!!!!!  Starting Tests  !!!!!!!!!!");
    $display(" ") ;
    $display(" ") ;
    $display(" ") ;
    $display(" ") ;
    $display("    operating @ 1MHz in Mode 1") ;
    $display(" ") ;
    $display("    Device Under Test operating in mode 1") ;
    $display(" ") ;
 
end






what i want is pretty much the same, for my VHDL testbench. I simply replaced $display with a report statement:



Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
init : process
  begin
    report " " ;
    report " !!!!!!!!!!  Starting Tests  !!!!!!!!!!" ;
    report " " ;
    report " " ;
    report " " ;
    report " " ;
    report "    operating @ 1MHz in Mode 1" ;
    report " " ;
    report "    Device Under Test operating in mode 1" ;
    report " " ;
    wait;
  end process ; -- init







I am using the Aldec Active HDL Simulator, and the output is not readable. I dont understand why it behaves different. How can i remove time and process indications?

thanks
 
Last edited by a moderator:

Unfortunately report does not work so well. You might create a package like following :
Code:
use std.textio.all ; 
package TextUtil is
  procedure Print(s : string) ;
end package TextUtil ; 
package body TextUtil is
  procedure Print(s : string) is 
    variable buf : line ; 
  begin
    write(buf, s) ; 
    WriteLine(OUTPUT, buf) ; 
  end procedure Print ; 
end package body TextUtil ;
Then your testbench can do:
Code:
    Print(" ") ;
    Print(" !!!!!!!!!!  Starting Tests  !!!!!!!!!!");
    Print(" ") ;

If you are doing much testbench coding in VHDL, you might check out the OSVVM libraries (https://www.osvvm.org).

The next revision of OSVVM (due early February) will have a Transcripting package (which will have the above and more) as well as an AlertLog package. Alerts and logs are similar to assert except they also give VHDL direct access to enabling and disabling of features, retrieving alert counts, and set stop counts (limits other than 1) - also the message prints in a single line.
 
works like a charm.
many thanks for this, and your link :smile:

i am coding everything in VHDL, including the testbenches, but in times like this, i wish there would be something like "inline verilog" :-D
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…