Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - how to show a number in output text?

 
Thread Tools Search this Thread
Old 11-30-2008, 10:21 AM   #1
Default how to show a number in output text?



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
  Reply With Quote
Old 11-30-2008, 03:24 PM   #2
Pinhas
 
Posts: n/a
Default Re: how to show a number in output text?
On 30 ×*ובמבר, 14:30, Brian Drummond <brian_drumm...@btconnect.com>
wrote:
> On Sun, 30 Nov 2008 02:21:04 -0800 (PST), Amit <amit.ko...@gmail.com>
> 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
  Reply With Quote
Old 12-02-2008, 07:13 AM   #3
Amit
 
Posts: n/a
Default Re: how to show a number in output text?
On Nov 30, 5:44*pm, David Bishop <dbis...@vhdl.org> 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
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Different types of video output - I'm confused robotiser@googlemail.com DVD Video 2 07-29-2007 04:25 PM
This is incredible! jc_ice DVD Video 1 08-13-2006 10:47 AM
Re: 38,000 U.S. KILLED & WOUNDED IN IRAQ & dvd's JA DVD Video 0 03-06-2005 01:16 AM
Sony Precision Cinema Progressive Output vs Component 480p Output Otto Pylot DVD Video 1 04-18-2004 10:49 PM
Panasonic S25 DVD player w/o S-video output - will its replacement have S-video? Mark DVD Video 1 02-11-2004 04:19 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

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