Dave,
You can use time'pos(value) to get the number of primary units in a time
value. The result is of type universal_integer. It doesn't get around the
problem of exceeding the representable range of universal_integer, but it
does avoid using "/".
Cheers,
PA
-- Dr. Peter J. Ashenden peter@ashenden.com.au Ashenden Designs Pty. Ltd. www.ashenden.com.au PO Box 640 Ph: +61 8 8339 7532 Stirling, SA 5152 Fax: +61 8 8339 2616 Australia Mobile: +61 414 70 9106 > -----Original Message----- > From: owner-vhdl-200x-ft@eda.org > [mailto:owner-vhdl-200x-ft@eda.org] On Behalf Of David Bishop > Sent: Tuesday, 28 September 2004 05:48 > To: vhdl-200x-ft@eda.org > Subject: [vhdl-200x-ft] to_string (time, resolution) problem > > > I was playing around with the to_string function: > > function to_string ( > VALUE : in TIME; > JUSTIFIED : in SIDE := right; > FIELD : in WIDTH := 0; > resolution : in TIME := Sim_Resolution > ) return STRING; > > and looking into implementations. > > In the LRM, there is only one way to get "time" into any > other format: function "/" (anonymous, anonymous: TIME) > return universal_integer; > > Since 1 hr / 1 fs > integer'high there is no way I can do > this, because I need to use "real" math to manipulate the number. > > Can I recommend that we drop this one and go back to: > function to_string ( > VALUE : in TIME; > JUSTIFIED : in SIDE := right; > FIELD : in WIDTH := 0 > ) return STRING; > > Though I like the idea of the deferred constant > "sim_resolution". It gives you something to check in your > testbenches to make sure that you have the correct simulation > resolution set. > > If somebody comes up with a clever idea, we can always > revisit it later. > > -- > David W. Bishop dbishop@vhdl.org All standard disclaimers apply. >Received on Mon Sep 27 16:52:55 2004
This archive was generated by hypermail 2.1.8 : Mon Sep 27 2004 - 16:52:57 PDT