error in modelsim simulation

V

viswanath

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
 
J

Jonathan Bromley

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 address 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:[email protected]
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.
 
V

viswanath

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)
 
J

Jonathan Bromley

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:[email protected]
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.
 
V

viswanath

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,836
Latest member
BuyBlissBitesCBD

Latest Threads

Top