what's bad in this declaratio of time constant?

In your example, sec is associated with
9600, so you actually wrote 1/time which
will not work.

Try this:
constant BIT_TIME: time := (1/9600) * 1 sec;

You may not need the parentheses, but it is more
readable with them.

Cheers,
jim
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jim Lewis
Director of Training mailto:Jim@SynthWorks.com
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Valentin Tihomirov wrote:

constant BIT_TIME: time := 1/9600 sec;


???
 
"Jim Lewis" <Jim@SynthWorks.com> wrote in message
news:3F957DA4.5090103@SynthWorks.com...

YES! SUCCESS! I caught Jim Lewis out!!!

Try this:
constant BIT_TIME: time := (1/9600) * 1 sec;
Bad plan. 1/9600 is evaluated as an integer, yielding
the value 0.

How about
constant BIT_TIME: time := 1 sec / 9600;

This will work because 1 sec == 10^15 fs, and arithmetic
on physical units is always scaled to the base unit,
which is fs in the case of time.

That comes close to paying you back for catching me
out with a cunning type conversion at your tutorial
in Lyon :)
--
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, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail: jonathan.bromley@doulos.com
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.
 
How about
constant BIT_TIME: time := 1 sec / 9600;
Good point. :)
Serves me right for typing without thinking.


That comes close to paying you back for catching me
out with a cunning type conversion at your tutorial
in Lyon :)
You have a long memory. I will have to remember not
to what I did at FDL again - if only I could remember
what it was. :)

Cheers,
Jim
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jim Lewis
Director of Training mailto:Jim@SynthWorks.com
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Jonathan Bromley wrote:

"Jim Lewis" <Jim@SynthWorks.com> wrote in message
news:3F957DA4.5090103@SynthWorks.com...

YES! SUCCESS! I caught Jim Lewis out!!!


Try this:
constant BIT_TIME: time := (1/9600) * 1 sec;


Bad plan. 1/9600 is evaluated as an integer, yielding
the value 0.

How about
constant BIT_TIME: time := 1 sec / 9600;

This will work because 1 sec == 10^15 fs, and arithmetic
on physical units is always scaled to the base unit,
which is fs in the case of time.

That comes close to paying you back for catching me
out with a cunning type conversion at your tutorial
in Lyon :)
--
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, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail: jonathan.bromley@doulos.com
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.
 

Welcome to EDABoard.com

Sponsor

Back
Top