Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > assert/report problems

Reply
Thread Tools

assert/report problems

 
 
Steve J
Guest
Posts: n/a
 
      05-25-2005
Hi,

I'm currently getting a strange message from my testbench output that
says

"Error: Master Selection : Test case 5 failed. Master bit was '1' but
should have been '1'"

This is generated using the following:
assert ((DATA_BUS(master_bit)) = (this_case(0)));
report "Master Selection : Test case " & integer'image(I) & " failed.
Master bit was " & std_logic'image(DATA_BUS(master_bit)) & " but should
have been " & std_logic'image(this_case(0))
severity error;

Why is this?
master_bit is an integer, DATA_BUS is a 16 bit std_logic_vector input
to my procedure and this_case is a 4-bit std_logic_vector

What I don't understand is why the comparison after the assert is false
when printing the two bits out in the report they look the same.

All suggestions appreciated

Steve

 
Reply With Quote
 
 
 
 
Steffen Netz
Guest
Posts: n/a
 
      05-25-2005

Hi Steve,

this a trap of VHDL, because the assert statement tests on false Condition!
You can write :

assert NOT(((DATA_BUS(master_bit)) = (this_case(0))));
^
or assert ((DATA_BUS(master_bit)) /= (this_case(0)));
^

regards,

Steffen

Steve J wrote:
> Hi,
>
> I'm currently getting a strange message from my testbench output that
> says
>
> "Error: Master Selection : Test case 5 failed. Master bit was '1' but
> should have been '1'"
>
> This is generated using the following:
> assert ((DATA_BUS(master_bit)) = (this_case(0)));
> report "Master Selection : Test case " & integer'image(I) & " failed.
> Master bit was " & std_logic'image(DATA_BUS(master_bit)) & " but should
> have been " & std_logic'image(this_case(0))
> severity error;
>
> Why is this?
> master_bit is an integer, DATA_BUS is a 16 bit std_logic_vector input
> to my procedure and this_case is a 4-bit std_logic_vector
>
> What I don't understand is why the comparison after the assert is false
> when printing the two bits out in the report they look the same.
>
> All suggestions appreciated
>
> Steve
>


 
Reply With Quote
 
 
 
 
Steve J
Guest
Posts: n/a
 
      05-25-2005
I appreciate that assert reports an error on a false condition. That's
not what is confusing me as I've tried adding a not and the same thing
happens.

In the report statement I'm using the 'image to output the value of the
two sides of the comparison.

What I don't understand is why if both sides of the '=' are the same,
why is the rest of the report/severity bit being triggered. Surely '1'
= '1' is true and hence I wouldn't get a message.

Steve

Steffen Netz wrote:
> Hi Steve,
>
> this a trap of VHDL, because the assert statement tests on false Condition!
> You can write :
>
> assert NOT(((DATA_BUS(master_bit)) = (this_case(0))));
> ^
> or assert ((DATA_BUS(master_bit)) /= (this_case(0)));
> ^
>
> regards,
>
> Steffen
>
> Steve J wrote:
> > Hi,
> >
> > I'm currently getting a strange message from my testbench output that
> > says
> >




> > "Error: Master Selection : Test case 5 failed. Master bit was '1' but
> > should have been '1'"
> >
> > This is generated using the following:
> > assert ((DATA_BUS(master_bit)) = (this_case(0)));
> > report "Master Selection : Test case " & integer'image(I) & " failed.
> > Master bit was " & std_logic'image(DATA_BUS(master_bit)) & " but should
> > have been " & std_logic'image(this_case(0))
> > severity error;
> >
> > Why is this?
> > master_bit is an integer, DATA_BUS is a 16 bit std_logic_vector input
> > to my procedure and this_case is a 4-bit std_logic_vector
> >
> > What I don't understand is why the comparison after the assert is false
> > when printing the two bits out in the report they look the same.
> >
> > All suggestions appreciated
> >
> > Steve
> >


 
Reply With Quote
 
Steve J
Guest
Posts: n/a
 
      05-25-2005
I've replaced the statement causing me problems with

assert true;
report "......

and I still get the error messages.

Why would an assert statement always trigger? The assert is in a
procedure in a package. Would that cause problems?

TIA

Steve

 
Reply With Quote
 
Steffen Netz
Guest
Posts: n/a
 
      05-25-2005

Hey,

assert rises the message if the condition is "true" !!!

assert true
report "I'm here"

gives I'm here

assert false
report "I'm here"

gives -
( Nothing ) !!!

Steffen

Steve J wrote:
> I appreciate that assert reports an error on a false condition. That's
> not what is confusing me as I've tried adding a not and the same thing
> happens.
>
> In the report statement I'm using the 'image to output the value of the
> two sides of the comparison.
>
> What I don't understand is why if both sides of the '=' are the same,
> why is the rest of the report/severity bit being triggered. Surely '1'
> = '1' is true and hence I wouldn't get a message.
>
> Steve
>
> Steffen Netz wrote:
> > Hi Steve,
> >
> > this a trap of VHDL, because the assert statement tests on false Condition!
> > You can write :
> >
> > assert NOT(((DATA_BUS(master_bit)) = (this_case(0))));
> > ^
> > or assert ((DATA_BUS(master_bit)) /= (this_case(0)));
> > ^
> >
> > regards,
> >
> > Steffen
> >
> > Steve J wrote:
> > > Hi,
> > >
> > > I'm currently getting a strange message from my testbench output that
> > > says
> > >

>
>
>
> > > "Error: Master Selection : Test case 5 failed. Master bit was '1' but
> > > should have been '1'"
> > >
> > > This is generated using the following:
> > > assert ((DATA_BUS(master_bit)) = (this_case(0)));
> > > report "Master Selection : Test case " & integer'image(I) & " failed.
> > > Master bit was " & std_logic'image(DATA_BUS(master_bit)) & " but should
> > > have been " & std_logic'image(this_case(0))
> > > severity error;
> > >
> > > Why is this?
> > > master_bit is an integer, DATA_BUS is a 16 bit std_logic_vector input
> > > to my procedure and this_case is a 4-bit std_logic_vector
> > >
> > > What I don't understand is why the comparison after the assert is false
> > > when printing the two bits out in the report they look the same.
> > >
> > > All suggestions appreciated
> > >
> > > Steve
> > >

>


 
Reply With Quote
 
Mariusz
Guest
Posts: n/a
 
      05-25-2005
Steve J wrote:

> I've replaced the statement causing me problems with
>
> assert true;
> report "......
>
> and I still get the error messages.
>
> Why would an assert statement always trigger? The assert is in a
> procedure in a package. Would that cause problems?
>
> TIA
>
> Steve
>

Try removing the ; after assert. It executes a null command and the
report works always.
 
Reply With Quote
 
Steve J
Guest
Posts: n/a
 
      05-25-2005
Mariusz,

Thanks for that. That appears to have solved it.
I'm surprised that isn't picked up by a syntax checker when I compile
the code.

Steffen,
Are you saying that in correct VHDL the error message is printed when
the condition is true? That's not what I've understood from other
sources.
http://www.acc-eda.com/vhdlref/refgu...statements.htm

Steve

 
Reply With Quote
 
Steffen Netz
Guest
Posts: n/a
 
      05-25-2005
....
>
> Steffen,
> Are you saying that in correct VHDL the error message is printed when
> the condition is true? That's not what I've understood from other
> sources.
> http://www.acc-eda.com/vhdlref/refgu...statements.htm
>
> Steve
>


I'm so stupid, that's when you have to work in Verilog for a while.
You are so right,
Sorry,

Steffen
 
Reply With Quote
 
Mariusz
Guest
Posts: n/a
 
      05-25-2005
Steve J wrote:

> Mariusz,
>
> Thanks for that. That appears to have solved it.
> I'm surprised that isn't picked up by a syntax checker when I compile
> the code.
>
> Steffen,
> Are you saying that in correct VHDL the error message is printed when
> the condition is true? That's not what I've understood from other
> sources.
> http://www.acc-eda.com/vhdlref/refgu...statements.htm
>
> Steve
>

Steve,

No compiler should complain. That's what LRM reads. All sections are
optional so assert alone is perfectly OK.

Mariusz
 
Reply With Quote
 
Srinivasan Venkataramanan
Guest
Posts: n/a
 
      05-26-2005
Hi,

"Steve J" <> wrote in message
news: ups.com...
> Mariusz,
>
> Thanks for that. That appears to have solved it.
> I'm surprised that isn't picked up by a syntax checker when I compile
> the code.


Perhaps you had a VHDL-93 mode turned ON (or is the default in your
compiler). report alone was allowed in VHDL-93, so if you wanted your
compiler to error out, use 87 - I wouldn't recommend that though.

--
Srinivasan Venkataramanan
Co-Author: SystemVerilog Assertions Handbook, http://www.abv-sva.org
Co-Author: Using PSL/SUGAR for Formal and Dynamic Verification 2nd Edition.
http://www.noveldv.com
I own my words and not my employer, unless specifically mentioned


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving the web, charset problems and symbols problems Sak Na rede Ruby 0 01-30-2009 05:05 AM
Problems, problems for newbie Shelly ASP .Net 1 09-03-2007 02:10 AM
Problems compiling simple C++ code (also problems with std::string) Susan Baker C++ 2 06-26-2005 01:43 AM
Re: sound problems and modem problems Harold Potter Computer Support 5 12-04-2003 04:12 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57