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

Reply

VHDL - time quantity in vhdl

 
Thread Tools Search this Thread
Old 10-01-2003, 07:45 PM   #1
Default time quantity in vhdl


Hi,

could anyone help me out with this ? look at the following comments
inside the code.


constant cin:time := 20.0 fs;
constant r_p:time := 2000.0;
constant r_n:time := 2000.0;
begin
p1: process(x)
variable t:time;
begin
if(x'EVENT and x='1') then
--
--Can I assign a real value multiplication to a time quanity.

t := time(cin*r_n);
y <= (not x) after t ps;
else
-- This is working fine but the above t equation is not working.
t := 20.0*2.0 ps;
y <= (not x) after t;
end if;
end process p1;

thanks a lot.
naveen


Nav
  Reply With Quote
Old 10-01-2003, 08:37 PM   #2
David Jones
 
Posts: n/a
Default Re: time quantity in vhdl
In article <>,
Nav <> wrote:
>Hi,
>
>could anyone help me out with this ? look at the following comments
>inside the code.
>
>
> constant cin:time := 20.0 fs;
> constant r_p:time := 2000.0;
> constant r_n:time := 2000.0;


The last two declarations should be illegal, as they do not give a unit.

A physical type such as time is represented internally as an integer,
expressing a multiple of the base physical unit. So, if your simulation
time type starts off as fs, then 1 ns is represented as 1,000,000.

You are permitted to multiply and divide by scalars. The result is still
an integer, in the base unit. So, 1.5 * 3 fs is 4 fs or 5 fs, due to rounding
(the exact outcome is simulator-dependent.)

The other problem spot is that time quantities are often quantized to the
simulator time resolution. For example, if your simulation timestep is 1 ns,
then all time literals will be a multiple of 1,000,000 fs. At this point,
you get wierdness such as:

constant t1:time := 1 ps;
constant t2:time := 2 ps;

variable ratio: integer;

if (t1 = t2) then
-- Surprise! This branch executes if resolution is ns.
ratio := t2 / t1; -- And this halts due to divide by zero.
else
-- And this branch executes if resolution is ps.
ratio := t2 / t1; -- And this works fine, producing 2.
end if;

This is done to increase the dynamic range of time. The VHDL standard requires
that 1 fs be accepted as a time unit, but this allows simulation for only
18,445 seconds if time is to be tracked as a 64-bit integer. By quantizing
time to 64 bits, simulators permit much longer simulation runs while
sacrificing sub-ns precision which many users don't care about.

>begin
> p1: process(x)
> variable t:time;
> begin
> if(x'EVENT and x='1') then
>--
>--Can I assign a real value multiplication to a time quanity.
> t := time(cin*r_n);


If r_n were declared as:

constant r_n:real := 2000.0

then this is legal, and will result in 40,000 fs.

> y <= (not x) after t ps;
> else
>-- This is working fine but the above t equation is not working.
> t := 20.0*2.0 ps;
> y <= (not x) after t;
> end if;
> end process p1;
>
>thanks a lot.
>naveen





David Jones
  Reply With Quote
Old 10-01-2003, 08:39 PM   #3
Niv
 
Posts: n/a
Default Re: time quantity in vhdl
It looks as if you've declared r_p & r_n as "time", so you're trying to
create "time_squared"
Make r_p & r_n of type INTEGER or NATURAL, then the multiply should work.

Niv.

"Nav" <> wrote in message
news: om...
> Hi,
>
> could anyone help me out with this ? look at the following comments
> inside the code.
>
>
> constant cin:time := 20.0 fs;
> constant r_p:time := 2000.0;
> constant r_n:time := 2000.0;
> begin
> p1: process(x)
> variable t:time;
> begin
> if(x'EVENT and x='1') then
> --
> --Can I assign a real value multiplication to a time quanity.
>
> t := time(cin*r_n);
> y <= (not x) after t ps;
> else
> -- This is working fine but the above t equation is not working.
> t := 20.0*2.0 ps;
> y <= (not x) after t;
> end if;
> end process p1;
>
> thanks a lot.
> naveen





Niv
  Reply With Quote
Old 10-02-2003, 03:41 PM   #4
Nav
 
Posts: n/a
Default Re: time quantity in vhdl
Hi Niv and dave,

Thanks for ur brief explanation into time....

I made one modification instead of defining r_p and r_n and c as time
I defined them as real. It makes sense since, if I define them all as
time then the varibale to which I assign this value will become time
squared which will make the physical quantity definition of t error.
I got it going... thanks to ur help....

keep it going folks,
Nav

"Niv" <niv**mines_a_pint_you_spamheads**@ntlworld.com> wrote in message news:<7bGeb.1615$>...
> It looks as if you've declared r_p & r_n as "time", so you're trying to
> create "time_squared"
> Make r_p & r_n of type INTEGER or NATURAL, then the multiply should work.
>
> Niv.
>
> "Nav" <> wrote in message
> news: om...
> > Hi,
> >
> > could anyone help me out with this ? look at the following comments
> > inside the code.
> >
> >
> > constant cin:time := 20.0 fs;
> > constant r_p:time := 2000.0;
> > constant r_n:time := 2000.0;
> > begin
> > p1: process(x)
> > variable t:time;
> > begin
> > if(x'EVENT and x='1') then
> > --
> > --Can I assign a real value multiplication to a time quanity.
> >
> > t := time(cin*r_n);
> > y <= (not x) after t ps;
> > else
> > -- This is working fine but the above t equation is not working.
> > t := 20.0*2.0 ps;
> > y <= (not x) after t;
> > end if;
> > end process p1;
> >
> > thanks a lot.
> > naveen



Nav
  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
The time it takes to burn DVDs? John DVD Video 27 06-01-2007 09:48 AM
Re: Is A+ certification a waste of time and money? René Nielsen A+ Certification 0 08-30-2003 08:32 AM
Re: Panasonic & Pioneer DVD players - time remaining display and black level settings? SloPoke DVD Video 0 08-18-2003 02:40 PM
Re: 7. The truth about our creator. .7 john smith DVD Video 2 07-25-2003 03:54 AM
Once Upon A Time In America Larry Gold DVD Video 1 06-28-2003 10:25 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