how to show a number in output text?

Discussion in 'VHDL' started by Amit, Nov 30, 2008.

  1. Amit

    Amit Guest

    Hello group,

    I'm learning to write a testbench so in part of the code I increment
    a variable to count number of errors during simulation.

    now, I need to know how I can print out a message showing number of
    detected errors as following:

    Found n error(s).

    where n is the value in the counter variable.

    Any help is appreciated.

    p.s. I thought using & to concatenate would work but no

    report "Found " & err_cnt & " error(s)" !!!! (wrong)
    Amit, Nov 30, 2008
    #1
    1. Advertising

  2. Amit

    Pinhas Guest

    On 30 נובמבר, 14:30, Brian Drummond <>
    wrote:
    > On Sun, 30 Nov 2008 02:21:04 -0800 (PST), Amit <>
    > wrote:
    >
    >
    >
    > >Hello group,

    >
    > >I'm learning to write a testbench so in part of the code I increment
    > >a variable to count number of errors during simulation.
    > >p.s. I thought using & to concatenate would work but no

    >
    > >report "Found " & err_cnt & " error(s)"   !!!!  (wrong)

    >
    > Concatenation works perfectly ... on strings, but err_cnt isn't a
    > string.
    >
    > What you need depends on the type of err_cnt.
    > If it is integer, simply
    > report "Found " & integer'image(err_cnt)  & " error(s)"
    > will do.
    >
    > - Brian


    Some examples (from an AHB monitor VHDL code) at
    h--p://bknpk.no-ip.biz/AHB_MON/ahb_mon_1.html
    You may also find this page intresting as well:
    http://bknpk.no-ip.biz/I2C/leon_2.html
    VHDL component to generate VCD waves to replace GHDL VCD wave dump
    option
    Pinhas, Nov 30, 2008
    #2
    1. Advertising

  3. Amit

    Amit Guest

    On Nov 30, 5:44 pm, David Bishop <> wrote:
    > Amit wrote:
    > > Found n error(s).

    >
    > > where n is the value in the counter variable.

    >
    > > Any help is appreciated.

    >
    > > p.s. I thought using & to concatenate would work but no

    >
    > > report "Found " & err_cnt & " error(s)"   !!!!  (wrong)

    >
    > Currently what you have to do is (as others have noted):
    > report "Found " & integer'image(err_cnt) & " error(s)"
    >
    > IN VHDL-2008 (which some vendors are starting to look at) you can do this:
    >
    > report "Found " & to_string(err_cnt) & " error(s)"
    >
    > The "to_string" function is overloaded for EVERY type, so you can use it
    > on STD_LOGIC_VECTOR, UNSIGNED, Boolean, etc...




    Thanks to all for your comments and help.

    Regards,
    Amit
    Amit, Dec 2, 2008
    #3
    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. Matt

    TO show or NOT to show

    Matt, May 2, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    379
  2. Disco Octopus

    to show image or to show flash

    Disco Octopus, May 13, 2004, in forum: HTML
    Replies:
    7
    Views:
    2,419
    Toby A Inkster
    May 14, 2004
  3. Replies:
    1
    Views:
    580
    Evertjan.
    Sep 30, 2005
  4. lrantisi
    Replies:
    2
    Views:
    309
    Andrew Thompson
    Nov 26, 2006
  5. Ryan C.
    Replies:
    7
    Views:
    322
    Brian Candler
    Feb 24, 2011
Loading...

Share This Page