Velocity Reviews > VHDL > error in modelsim simulation

error in modelsim simulation

viswanath
Guest
Posts: n/a

 04-22-2004
Hi,
I was trying to implement digital sine modulation in vhdl and for the
same I was multiplying a sine value( which I assumed to be a real
number). For reasons unknown to me though it appears to be an ok
waveform I get error messages stating the following:
Error: XLOCAL <= 0.0 after reduction in SIN(X)
# Time: 479952500 ps Iteration: 0 Instance: /sigtst/s1
At this instant of time the value of sine is of the order 1e -14,
1e-15, 1e-13.
The code at which I think is the problem is :
sin_theta := sin(math_2_pi*real(now/1 ps)/real(period/ 1 ps));
What could that problem be? and how can one fix that?
I need this because for a further multiplication with another real
number I am getting a FATAL error message and the simulation stops. It
says the real number range has exceeded though I am multiplying two
real numbers which are within that range one the above number and
another number which is also a sine value. Though this cannot exceed
the range I get that message.
I would greatly appreciate any help and suggestions.
Thanking You in Anticipation,
Yours Truly,
Viswanath Daita

Jonathan Bromley
Guest
Posts: n/a

 04-22-2004
On 21 Apr 2004 21:25:40 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) (viswanath) wrote:

>Hi,
>I was trying to implement digital sine modulation in vhdl and for the
>same I was multiplying a sine value( which I assumed to be a real
>number). For reasons unknown to me though it appears to be an ok
>waveform I get error messages stating the following:
>Error: XLOCAL <= 0.0 after reduction in SIN(X)
># Time: 479952500 ps Iteration: 0 Instance: /sigtst/s1
>At this instant of time the value of sine is of the order 1e -14,
>1e-15, 1e-13.
>The code at which I think is the problem is :
>sin_theta := sin(math_2_pi*real(now/1 ps)/real(period/ 1 ps));
>What could that problem be? and how can one fix that?

I think the problem is internal to the SIN() function. You are
asking it to calculate the sine of a very large angle, far larger
than one rotation. To perform this calculation, the SIN()
function needs to reduce the angle so that it is within some
range (probably 0 to pi/2, though I'm not sure exactly how
the SIN() function works internally). My guess is that
there is some limitation to the way this has been implemented,
and you have discovered a corner-case bug.

If my guess is right, the obvious solution is to do the
reduction yourself:

sin_theta := sin(math_2_pi * real( (now/1 ps) mod (period/1 ps) ));

The IEEE standard specifies that accuracy may be degraded for
very large input angles, but doesn't permit failure like this.
Consequently it would be a good idea to capture the input value
(479952500/period) and report it to (E-Mail Removed) .
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail:(E-Mail Removed)
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.

viswanath
Guest
Posts: n/a

 04-22-2004
Hi Jonathan,
Thanks for the reply.Though it sounds exciting that I have discovered
a bug in modelsim I need a way to get around this problem.
I didnot explain to you what I did previously. I am trying to model a
continuous sine wave and the expression I have in the previous mail is
what I am using to calculate the modulation.((const)* sin(wt) )
How could one implement the same instead of using the kind of
expression that I used. where the omega frequency is in the order of
Mhz.
Can you please let me know?
Looking forward to your reply.
Thanking You,
Viswanath(aka Vishy)

Jonathan Bromley <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>. ..
> On 21 Apr 2004 21:25:40 -0700, (E-Mail Removed) (viswanath) wrote:
>
> >Hi,
> >I was trying to implement digital sine modulation in vhdl and for the
> >same I was multiplying a sine value( which I assumed to be a real
> >number). For reasons unknown to me though it appears to be an ok
> >waveform I get error messages stating the following:
> >Error: XLOCAL <= 0.0 after reduction in SIN(X)
> ># Time: 479952500 ps Iteration: 0 Instance: /sigtst/s1
> >At this instant of time the value of sine is of the order 1e -14,
> >1e-15, 1e-13.
> >The code at which I think is the problem is :
> >sin_theta := sin(math_2_pi*real(now/1 ps)/real(period/ 1 ps));
> >What could that problem be? and how can one fix that?

>
> I think the problem is internal to the SIN() function. You are
> asking it to calculate the sine of a very large angle, far larger
> than one rotation. To perform this calculation, the SIN()
> function needs to reduce the angle so that it is within some
> range (probably 0 to pi/2, though I'm not sure exactly how
> the SIN() function works internally). My guess is that
> there is some limitation to the way this has been implemented,
> and you have discovered a corner-case bug.
>
> If my guess is right, the obvious solution is to do the
> reduction yourself:
>
> sin_theta := sin(math_2_pi * real( (now/1 ps) mod (period/1 ps) ));
>
> The IEEE standard specifies that accuracy may be degraded for
> very large input angles, but doesn't permit failure like this.
> Consequently it would be a good idea to capture the input value
> (479952500/period) and report it to (E-Mail Removed) .
> --
> Jonathan Bromley, Consultant
>
> DOULOS - Developing Design Know-how
> VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services
>
> Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK
> Tel: +44 (0)1425 471223 mail:(E-Mail Removed)
> Fax: +44 (0)1425 471573 Web: http://www.doulos.com
>
> The contents of this message may contain personal views which
> are not the views of Doulos Ltd., unless specifically stated.

Jonathan Bromley
Guest
Posts: n/a

 04-23-2004
On 22 Apr 2004 11:24:35 -0700, (E-Mail Removed) (viswanath) wrote:

>Hi Jonathan,
>Thanks for the reply.Though it sounds exciting that I have discovered
>a bug in modelsim I need a way to get around this problem.

Read my post again. I gave you a solution.

>I didnot explain to you what I did previously. I am trying to model a
>continuous sine wave and the expression I have in the previous mail is
>what I am using to calculate the modulation.((const)* sin(wt) )

Yup. Your problem, of course, is that (omega.t) grows without
(theoretical) limit as the simulation runs. I suggested one of
many possible ways to work around that.

>How could one implement the same instead of using the kind of
>expression that I used.

Just in case you missed it last time:

sin_theta := sin(math_2_pi * real( (now/1 ps) mod (period/1 ps) ));
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail:(E-Mail Removed)
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.

viswanath
Guest
Posts: n/a

 04-25-2004
Hi Jonathan,
Thanks for your reply. I could get this thing finally working.
Viswanath

Jonathan Bromley <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>. ..
> On 22 Apr 2004 11:24:35 -0700, (E-Mail Removed) (viswanath) wrote:
>
> >Hi Jonathan,
> >Thanks for the reply.Though it sounds exciting that I have discovered
> >a bug in modelsim I need a way to get around this problem.

>
> Read my post again. I gave you a solution.
>
> >I didnot explain to you what I did previously. I am trying to model a
> >continuous sine wave and the expression I have in the previous mail is
> >what I am using to calculate the modulation.((const)* sin(wt) )

>
> Yup. Your problem, of course, is that (omega.t) grows without
> (theoretical) limit as the simulation runs. I suggested one of
> many possible ways to work around that.
>
> >How could one implement the same instead of using the kind of
> >expression that I used.

>
> Just in case you missed it last time:
>
> sin_theta := sin(math_2_pi * real( (now/1 ps) mod (period/1 ps) ));
> --
> Jonathan Bromley, Consultant
>
> DOULOS - Developing Design Know-how
> VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services
>
> Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK
> Tel: +44 (0)1425 471223 mail:(E-Mail Removed)
> Fax: +44 (0)1425 471573 Web: http://www.doulos.com
>
> The contents of this message may contain personal views which
> are not the views of Doulos Ltd., unless specifically stated.

 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 OffTrackbacks are On Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post vino_TUM VHDL 1 11-25-2011 01:49 PM ALuPin VHDL 13 11-27-2008 05:05 PM hansman VHDL 3 01-30-2004 09:05 AM Ouadid VHDL 7 12-18-2003 03:54 AM Manfred Balik VHDL 0 07-15-2003 02:12 PM

Advertisments