Verification Guild
A Community of Verification Professionals

 Create an AccountHome | Calendar | Downloads | FAQ | Links | Site Admin | Your Account  

Login
Nickname

Password

Security Code: Security Code
Type Security Code
BACKWARD

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Modules
· Home
· Downloads
· FAQ
· Feedback
· Recommend Us
· Web Links
· Your Account

Advertising

Who's Online
There are currently, 44 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here

  
Verification Guild: Forums

 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile  ProfileDigest    Log inLog in 

SystemVerilog as a modeling language?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Verification Guild Forum Index -> Main
View previous topic :: View next topic  
Author Message
tessitd
Senior
Senior


Joined: Sep 05, 2006
Posts: 286
Location: Colorado

PostPosted: Mon Nov 20, 2006 6:00 pm    Post subject: SystemVerilog as a modeling language? Reply with quote

To all,

Well someone asked me if I could model some DSP algorithms in SystemVerilog. I said sure we could do that - we are modeling some hardware we don't have that would have performed this function.

So I started looking the LRM and noticed that there is no real MATH library!!! Is this true that I cannot use sin(x) and such? Is my only recourse to use a DPI call to 'C' and link this in?

Thanks in advance,
TomT...
Back to top
View user's profile Send e-mail Visit poster's website
RCIngham
Senior
Senior


Joined: Feb 19, 2004
Posts: 194
Location: England (UK)

PostPosted: Tue Nov 21, 2006 4:31 am    Post subject: Reply with quote

As has been pointed out in other threads, SV is a super-set/extension of "vanilla" Verilog. If sine or any other desireable function exists in Verilog, you can use it in SV.

I've modelled DSP algorithms in VHDL, by using the IEEE 'math_real' package, but that may not help you.
Back to top
View user's profile
shalom
Senior
Senior


Joined: Jan 06, 2004
Posts: 110
Location: Jerusalem, Israel

PostPosted: Wed Nov 22, 2006 10:55 am    Post subject: Reply with quote

Verilog-2005 defines the following real math functions as well as the intger ceiling log base2 function $clog2(x):

Table 17-18—Verilog to C real math function cross-listing
Verilog function Equivalent C function Description
$ln(x) log(x) Natural logarithm
$log10(x) log10(x) Decimal logarithm
$exp(x) exp(x) Exponential
$sqrt(x) sqrt(x) Square root
$pow(x,y) pow(x,y) x**y
$floor(x) floor(x) Floor
$ceil(x) ceil(x) Ceiling
$sin(x) sin(x) Sine
$cos(x) cos(x) Cosine
$tan(x) tan(x) Tangent
$asin(x) asin(x) Arc-sine
$acos(x) acos(x) Arc-cosine
$atan(x) atan(x) Arc-tangent
$atan2(x,y) atan2(x,y) Arc-tangent of x/y
$hypot(x,y) hypot(x,y) sqrt(x*x+y*y)
$sinh(x) sinh(x) Hyperbolic sine
$cosh(x) cosh(x) Hyperbolic cosine
$tanh(x) tanh(x) Hyperbolic tangent
$asinh(x) asinh(x) Arc-hyperbolic sine
$acosh(x) acosh(x) Arc-hyperbolic cosine
$atanh(x) atanh(x) Arc-hyperbolic tangent
Back to top
View user's profile Send e-mail Visit poster's website
cabriggs
Senior
Senior


Joined: Jan 12, 2004
Posts: 96
Location: Massachusetts

PostPosted: Wed Nov 22, 2006 12:02 pm    Post subject: Re: SystemVerilog as a modeling language? Reply with quote

tessitd wrote:
Is this true that I cannot use sin(x) and such? Is my only recourse to use a DPI call to 'C' and link this in?


True, but at least calling standard C library functions is trivial through the DPI. All you have to do is write the import statement and, in this case, make sure the math library is compiled in (it probably already is).

-cb
Back to top
View user's profile
alexg
Senior
Senior


Joined: Jan 07, 2004
Posts: 586
Location: Ottawa

PostPosted: Thu Nov 23, 2006 10:02 am    Post subject: Reply with quote

Quote:
Well someone asked me if I could model some DSP algorithms in SystemVerilog. I said sure we could do that - we are modeling some hardware we don't have that would have performed this function.

So I started looking the LRM and noticed that there is no real MATH library!!! Is this true that I cannot use sin(x) and such? Is my only recourse to use a DPI call to 'C' and link this in?


If company develops DSP chips, so it probably develops Matlab/Simulink DSP models to test DSP algorithms prior hardware development. Then, it is much easier to use already tested DSP models to verify the hardware. BTW, Matlab/Simulink already has dynamic bidirectional links to Modelsim and Ncverilog.

-Alex
Back to top
View user's profile Send e-mail
RCIngham
Senior
Senior


Joined: Feb 19, 2004
Posts: 194
Location: England (UK)

PostPosted: Thu Nov 23, 2006 11:14 am    Post subject: Reply with quote

alexg wrote:

If company develops DSP chips, so it probably develops Matlab/Simulink DSP models to test DSP algorithms prior hardware development. Then, it is much easier to use already tested DSP models to verify the hardware. BTW, Matlab/Simulink already has dynamic bidirectional links to Modelsim and Ncverilog.

-Alex


But a cycle-accurate model in Matlab/Simulink? If that's what they need? Or perhaps they don't have (can't afford) all the incremental licences.
Back to top
View user's profile
alexg
Senior
Senior


Joined: Jan 07, 2004
Posts: 586
Location: Ottawa

PostPosted: Thu Nov 23, 2006 11:48 am    Post subject: Reply with quote

Quote:
But a cycle-accurate model in Matlab/Simulink?


I am against writing cycle-accurate models for verification. In many cases, it is more painful and error-prone than writing actual designs.

In my opinion, models (if used) must have untimed transaction interface only. Reusable transactors & monitors which transfer untimed transactions to/from timed ones have to be developed to support untimed models /checkers/scoreboards.

Regards,
-Alex
Back to top
View user's profile Send e-mail
tessitd
Senior
Senior


Joined: Sep 05, 2006
Posts: 286
Location: Colorado

PostPosted: Tue Nov 28, 2006 12:40 pm    Post subject: Reply with quote

Thanks for all that replied. I will look into the Verilog 2005 library, does VCS 2006.06 have support?

Regarding modelling - what I was really after was injecting noise into an algorithm. One class of noise is of course random. But this design also has anti-aliasing which is sensitive to a slow moving sin wave. So we wanted to create this as one of our noise sources.

But I didn't find a math package in SV or in Verilog 2001. I will review what is in Verilog 2005 if VCS supports it. Also using the C math package is very doable. I just found this lack of math package to be an issue.

For RCIngham I am a big fan of the VHDL IEEE math_real package Smile I wish that SV would adopt some of these better features of VHDL!

TomT...
Back to top
View user's profile Send e-mail Visit poster's website
shalom
Senior
Senior


Joined: Jan 06, 2004
Posts: 110
Location: Jerusalem, Israel

PostPosted: Wed Nov 29, 2006 6:58 am    Post subject: Reply with quote

The IEEE SV standard 1800-2005 includes Verilog-2005. 1800 is a set of extensions to Verilog-2005.

However, in practice, at the current time, many tools implement older versions of SV.

Even the tools which are implementing the IEEE version of SV have not yet implemented many of the extensions to Verilog-2001 which are defined in the Verilog-2005 standard.

So in principle, SV includes Verilog-2005. In practice, actual implementations do not yet do this.
Back to top
View user's profile Send e-mail Visit poster's website
tessitd
Senior
Senior


Joined: Sep 05, 2006
Posts: 286
Location: Colorado

PostPosted: Wed Oct 08, 2008 2:38 pm    Post subject: Reply with quote

shalom wrote:
Verilog-2005 defines the following real math functions as well as the intger ceiling log base2 function $clog2(x):


Really when I look in the Verilog 2001 LRM these don't show up? What am I missing?

TomT...
Back to top
View user's profile Send e-mail Visit poster's website
DavidCastle
Senior
Senior


Joined: Jul 14, 2008
Posts: 54
Location: S. California

PostPosted: Wed Oct 08, 2008 3:19 pm    Post subject: Reply with quote

4 years
Back to top
View user's profile
DavidCastle
Senior
Senior


Joined: Jul 14, 2008
Posts: 54
Location: S. California

PostPosted: Wed Oct 08, 2008 3:36 pm    Post subject: Reply with quote

Seriously section 17 defines a lot more system tasks and functions in 2005 than 2001.

But, where in the SystemVerilog LRM does it specifically say that Verilog system tasks and functions are supported?
Back to top
View user's profile
dave_59
Senior
Senior


Joined: Jun 22, 2004
Posts: 974
Location: Fremont, CA

PostPosted: Wed Oct 08, 2008 4:54 pm    Post subject: Reply with quote

DavidCastle wrote:


But, where in the SystemVerilog LRM does it specifically say that Verilog system tasks and functions are supported?


On page 1:

IEEE Std 1800™-2005 wrote:
Abstract: This standard provides a set of extensions to the IEEE 1364™ Verilog® hardware
description language (HDL) to aid in the creation and verification of abstract architectural level
models.


The 1800-2009 LRM will incorporate the 1364 LRM.

Dave Rich
Back to top
View user's profile Send e-mail Visit poster's website
DavidCastle
Senior
Senior


Joined: Jul 14, 2008
Posts: 54
Location: S. California

PostPosted: Wed Oct 08, 2008 5:04 pm    Post subject: Reply with quote

Greetings Dave,

I saw that statement, but it sounds so nebulous that I didn't think it was really saying what it sounded like. And, it leaves a lot unsaid like, "Which version is an extension of which version?"

Regards,
David
Back to top
View user's profile
tessitd
Senior
Senior


Joined: Sep 05, 2006
Posts: 286
Location: Colorado

PostPosted: Wed Oct 08, 2008 5:15 pm    Post subject: Reply with quote

Ok,

So I am using VCS and I put in my code:

mylog = $sin(.5);

The compiler throws a message like it doesn't understand $sin? What am I missing?

TomT...
Back to top
View user's profile Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Verification Guild Forum Index -> Main All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Verification Guild © 2006 Janick Bergeron
Web site engine's code is Copyright © 2003 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 1.667 Seconds