Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > how to show a number in output text?

Reply
Thread Tools

how to show a number in output text?

 
 
Amit
Guest
Posts: n/a
 
      11-30-2008

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)



 
Reply With Quote
 
 
 
 
Pinhas
Guest
Posts: n/a
 
      11-30-2008
On 30 *ובמבר, 14:30, Brian Drummond <(E-Mail Removed)>
wrote:
> On Sun, 30 Nov 2008 02:21:04 -0800 (PST), Amit <(E-Mail Removed)>
> 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
 
Reply With Quote
 
 
 
 
Amit
Guest
Posts: n/a
 
      12-02-2008
On Nov 30, 5:44*pm, David Bishop <(E-Mail Removed)> 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
 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
OT: Number Nine, Number Nine, Number Nine Frisbee MCSE 37 09-26-2005 04:06 PM
TO show or NOT to show Matt ASP .Net 1 05-02-2005 09:07 PM
to show image or to show flash Disco Octopus HTML 7 05-14-2004 06:27 AM
Command "show run" does not show all interfaces Peter Jonas Cisco 3 01-05-2004 12:13 AM



Advertisments