Showing value of loop iteration in assert statement

Discussion in 'VHDL' started by dwerdna, Mar 30, 2005.

  1. dwerdna

    dwerdna Guest

    Hello all

    I have this loop, but I cant work out to display the appropriate
    channel to the screen when it fails..

    The below example prints out the sentence as you see if (of course),
    but I want the value of J. I've tried a few things, similar to when
    you write values to a file, but havent been able to work it out

    Thanks

    Andrew

    for J in 0 to 3 loop
    if (exp_analog_channel(J) /= tb_channel_out(J)) then
    assert false
    report "Channel J failed " severity note; -- how do I get 'J' to
    show value??
    end if;
    end loop;
    dwerdna, Mar 30, 2005
    #1
    1. Advertising

  2. dwerdna

    Guest

    All strings can be displayed in the report message

    report "Channel"&conv_string(J)&"failed"
    severity note;
    , Mar 30, 2005
    #2
    1. Advertising

  3. On 29 Mar 2005 22:45:01 -0800, wrote:

    >All strings can be displayed in the report message
    >
    >report "Channel"&conv_string(J)&"failed"
    >severity note;


    conv_string is not standard; it's nicer to use the built-in
    function 'IMAGE that comes with every scalar data type:

    report "channel " & integer'IMAGE(J) & " failed"
    --
    Jonathan Bromley, Consultant

    DOULOS - Developing Design Know-how
    VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services

    Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK
    Tel: +44 (0)1425 471223 mail:
    Fax: +44 (0)1425 471573 Web: http://www.doulos.com

    The contents of this message may contain personal views which
    are not the views of Doulos Ltd., unless specifically stated.
    Jonathan Bromley, Mar 30, 2005
    #3
  4. dwerdna

    dwerdna Guest

    Thanks! I'll give it a go

    Andrew
    dwerdna, Mar 31, 2005
    #4
  5. dwerdna

    Jerry Guest

    report "Channel" & integer'image(J) & failed";

    "dwerdna" <> wrote in message
    news:...
    > Hello all
    >
    > I have this loop, but I cant work out to display the appropriate
    > channel to the screen when it fails..
    >
    > The below example prints out the sentence as you see if (of course),
    > but I want the value of J. I've tried a few things, similar to when
    > you write values to a file, but havent been able to work it out
    >
    > Thanks
    >
    > Andrew
    >
    > for J in 0 to 3 loop
    > if (exp_analog_channel(J) /= tb_channel_out(J)) then
    > assert false
    > report "Channel J failed " severity note; -- how do I get 'J' to
    > show value??
    > end if;
    > end loop;
    >
    Jerry, Mar 31, 2005
    #5
  6. dwerdna

    Ajeetha Guest

    Just to add to it: Just in case your data type is different from a
    scalar type, then 'image is not defined in VHDL-93. Ben has developed a
    IMAGE pkg that can handle most of the cases, take a look at
    http://www.vhdlcohen.com --> Models

    HTH
    Aji
    http://www.noveldv.com
    Ajeetha, Mar 31, 2005
    #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. Robert Brewer
    Replies:
    1
    Views:
    487
    bsmith
    Nov 7, 2004
  2. Thomas Guettler

    assert 0, "foo" vs. assert(0, "foo")

    Thomas Guettler, Feb 23, 2005, in forum: Python
    Replies:
    3
    Views:
    2,519
    Carl Banks
    Feb 23, 2005
  3. Alex Vinokur

    assert(x) and '#define ASSERT(x) assert(x)'

    Alex Vinokur, Nov 25, 2004, in forum: C Programming
    Replies:
    5
    Views:
    911
    Keith Thompson
    Nov 25, 2004
  4. ImpalerCore

    To assert or not to assert...

    ImpalerCore, Apr 27, 2010, in forum: C Programming
    Replies:
    79
    Views:
    1,659
    Richard Bos
    May 17, 2010
  5. Isaac Won
    Replies:
    9
    Views:
    371
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page