Help with assert statement

Discussion in 'VHDL' started by RishiD, Nov 29, 2006.

  1. RishiD

    RishiD Guest

    Hi,

    I am attempting to write my first assert statements in my test bench.
    I want the assert statements to run every clock cycle so I put them in
    their own process. For some reason they don't seem to be working, the
    first assert EWgreen = '1' and NSgreen = '1' always get triggered. But
    according to the wave form it should not be triggered.

    Does the syntax look good for the assert statements?

    Thanks,

    Rishi


    PROCESS
    BEGIN
    CHECK_LOOP : LOOP

    WAIT FOR 100 ns;

    -- checks if any errors in traffic lights, giving go signals to both
    sides at same time
    assert (EWgreen = '1') and (NSgreen = '1') report "EWgreen and
    NSgreen at same time" severity failure;
    assert (EWgreen = '1') and (NSyellow = '1') report "EWgreen and
    NSyellow at same time" severity failure;
    assert (EWyellow = '1') and (NSgreen = '1') report "EWyellow and
    NSgreen at same time" severity failure;
    assert (EWyellow = '1') and (NSyellow = '1') report "EWyellow and
    NSyellow at same time" severity failure;

    -- checks to make sure crosswalk with walk signal given doesn't have
    a green/yellow light on same street
    -- severity is error only because this is a timing issue of the
    constants in the traffic controller
    assert (NSgreen = '1') and (NSpedwalk = '1') report "NSgreen and
    NSpedwalk at same time" severity error;
    assert (EWgreen = '1') and (EWpedwalk = '1') report "EWgreen and
    EWpedwalk at same time" severity error;
    assert (NSyellow = '1') and (NSpedwalk = '1') report "NSyellow and
    NSpedwalk at same time" severity error;
    assert (EWyellow = '1') and (EWpedwalk = '1') report "EWyellow and
    EWpedwalk at same time" severity error;

    END LOOP CHECK_LOOP;
    END PROCESS;
     
    RishiD, Nov 29, 2006
    #1
    1. Advertising

  2. RishiD

    Ajeetha Guest

    Hi Rishi,
    Why not use concurrent assert? SImply move your asserts to
    outside the process and you should be fine. However you may soon
    realize that the basic, boolean level assertion capability of VHDL is
    quite limited. New VHDL is considering adding PSL as part of it to make
    it very powerful. Meanwhile the PSL-VHDL flavor provides all the
    capabilities you need today! Also SVA + VHDL is picking up as well,
    especially given the SystemVerilog interest among various design
    houses.

    HTH
    Ajeetha, CVC
    www.noveldv.com

    RishiD wrote:
    > Hi,
    >
    > I am attempting to write my first assert statements in my test bench.
    > I want the assert statements to run every clock cycle so I put them in
    > their own process. For some reason they don't seem to be working, the
    > first assert EWgreen = '1' and NSgreen = '1' always get triggered. But
    > according to the wave form it should not be triggered.
    >
    > Does the syntax look good for the assert statements?
    >
    > Thanks,
    >
    > Rishi
    >
    >
    > PROCESS
    > BEGIN
    > CHECK_LOOP : LOOP
    >
    > WAIT FOR 100 ns;
    >
    > -- checks if any errors in traffic lights, giving go signals to both
    > sides at same time
    > assert (EWgreen = '1') and (NSgreen = '1') report "EWgreen and
    > NSgreen at same time" severity failure;
    > assert (EWgreen = '1') and (NSyellow = '1') report "EWgreen and
    > NSyellow at same time" severity failure;
    > assert (EWyellow = '1') and (NSgreen = '1') report "EWyellow and
    > NSgreen at same time" severity failure;
    > assert (EWyellow = '1') and (NSyellow = '1') report "EWyellow and
    > NSyellow at same time" severity failure;
    >
    > -- checks to make sure crosswalk with walk signal given doesn't have
    > a green/yellow light on same street
    > -- severity is error only because this is a timing issue of the
    > constants in the traffic controller
    > assert (NSgreen = '1') and (NSpedwalk = '1') report "NSgreen and
    > NSpedwalk at same time" severity error;
    > assert (EWgreen = '1') and (EWpedwalk = '1') report "EWgreen and
    > EWpedwalk at same time" severity error;
    > assert (NSyellow = '1') and (NSpedwalk = '1') report "NSyellow and
    > NSpedwalk at same time" severity error;
    > assert (EWyellow = '1') and (EWpedwalk = '1') report "EWyellow and
    > EWpedwalk at same time" severity error;
    >
    > END LOOP CHECK_LOOP;
    > END PROCESS;
     
    Ajeetha, Nov 29, 2006
    #2
    1. Advertising

  3. RishiD

    Andy Guest

    The Assert will fire when the condition is false! i.e. you "assert
    that the condition is true" therefore it warns you if it is not true
    (false).

    Andy


    RishiD wrote:
    > Hi,
    >
    > I am attempting to write my first assert statements in my test bench.
    > I want the assert statements to run every clock cycle so I put them in
    > their own process. For some reason they don't seem to be working, the
    > first assert EWgreen = '1' and NSgreen = '1' always get triggered. But
    > according to the wave form it should not be triggered.
    >
    > Does the syntax look good for the assert statements?
    >
    > Thanks,
    >
    > Rishi
    >
    >
    > PROCESS
    > BEGIN
    > CHECK_LOOP : LOOP
    >
    > WAIT FOR 100 ns;
    >
    > -- checks if any errors in traffic lights, giving go signals to both
    > sides at same time
    > assert (EWgreen = '1') and (NSgreen = '1') report "EWgreen and
    > NSgreen at same time" severity failure;
    > assert (EWgreen = '1') and (NSyellow = '1') report "EWgreen and
    > NSyellow at same time" severity failure;
    > assert (EWyellow = '1') and (NSgreen = '1') report "EWyellow and
    > NSgreen at same time" severity failure;
    > assert (EWyellow = '1') and (NSyellow = '1') report "EWyellow and
    > NSyellow at same time" severity failure;
    >
    > -- checks to make sure crosswalk with walk signal given doesn't have
    > a green/yellow light on same street
    > -- severity is error only because this is a timing issue of the
    > constants in the traffic controller
    > assert (NSgreen = '1') and (NSpedwalk = '1') report "NSgreen and
    > NSpedwalk at same time" severity error;
    > assert (EWgreen = '1') and (EWpedwalk = '1') report "EWgreen and
    > EWpedwalk at same time" severity error;
    > assert (NSyellow = '1') and (NSpedwalk = '1') report "NSyellow and
    > NSpedwalk at same time" severity error;
    > assert (EWyellow = '1') and (EWpedwalk = '1') report "EWyellow and
    > EWpedwalk at same time" severity error;
    >
    > END LOOP CHECK_LOOP;
    > END PROCESS;
     
    Andy, Nov 29, 2006
    #3
  4. RishiD

    RishiD Guest

    Thanks for the two tips, will put them both into use.

    Must have misread the assert statement description and wrote them
    backwards.

    Thanks guys.

    RishiD

    Andy wrote:
    > The Assert will fire when the condition is false! i.e. you "assert
    > that the condition is true" therefore it warns you if it is not true
    > (false).
    >
    > Andy
    >
    >
    > RishiD wrote:
    > > Hi,
    > >
    > > I am attempting to write my first assert statements in my test bench.
    > > I want the assert statements to run every clock cycle so I put them in
    > > their own process. For some reason they don't seem to be working, the
    > > first assert EWgreen = '1' and NSgreen = '1' always get triggered. But
    > > according to the wave form it should not be triggered.
    > >
    > > Does the syntax look good for the assert statements?
    > >
    > > Thanks,
    > >
    > > Rishi
    > >
    > >
    > > PROCESS
    > > BEGIN
    > > CHECK_LOOP : LOOP
    > >
    > > WAIT FOR 100 ns;
    > >
    > > -- checks if any errors in traffic lights, giving go signals to both
    > > sides at same time
    > > assert (EWgreen = '1') and (NSgreen = '1') report "EWgreen and
    > > NSgreen at same time" severity failure;
    > > assert (EWgreen = '1') and (NSyellow = '1') report "EWgreen and
    > > NSyellow at same time" severity failure;
    > > assert (EWyellow = '1') and (NSgreen = '1') report "EWyellow and
    > > NSgreen at same time" severity failure;
    > > assert (EWyellow = '1') and (NSyellow = '1') report "EWyellow and
    > > NSyellow at same time" severity failure;
    > >
    > > -- checks to make sure crosswalk with walk signal given doesn't have
    > > a green/yellow light on same street
    > > -- severity is error only because this is a timing issue of the
    > > constants in the traffic controller
    > > assert (NSgreen = '1') and (NSpedwalk = '1') report "NSgreen and
    > > NSpedwalk at same time" severity error;
    > > assert (EWgreen = '1') and (EWpedwalk = '1') report "EWgreen and
    > > EWpedwalk at same time" severity error;
    > > assert (NSyellow = '1') and (NSpedwalk = '1') report "NSyellow and
    > > NSpedwalk at same time" severity error;
    > > assert (EWyellow = '1') and (EWpedwalk = '1') report "EWyellow and
    > > EWpedwalk at same time" severity error;
    > >
    > > END LOOP CHECK_LOOP;
    > > END PROCESS;
     
    RishiD, Nov 29, 2006
    #4
    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. dwerdna
    Replies:
    5
    Views:
    5,481
    Ajeetha
    Mar 31, 2005
  2. Robert Brewer
    Replies:
    1
    Views:
    491
    bsmith
    Nov 7, 2004
  3. Thomas Guettler

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

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

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

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

    To assert or not to assert...

    ImpalerCore, Apr 27, 2010, in forum: C Programming
    Replies:
    79
    Views:
    1,669
    Richard Bos
    May 17, 2010
Loading...

Share This Page