This is one of the reasons I am supporting the proposal for extended or arbitrary-length integers: http://www.eda-twiki.org/cgi-bin/view.cgi/P1076/ArbitraryIntegers Best regards, Daniel On 10 January 2015 at 13:42, Tristan Gingold <tgingold@free.fr> wrote: > On 10/01/15 06:19, David Koontz wrote: > >> >> On 10/01/2015, at 9:13 am, Tristan Gingold <tgingold@free.fr> wrote: >> >> On 08/01/15 22:41, Kevin Thibedeau wrote: >>> >>>> type frequency is range 0 to physical'high units >>>> uHz; >>>> milliHz = 1000 uHz; >>>> Hz = 1000 milliHz; >>>> kHz = 1000 Hz; >>>> MHz = 1000 kHz; >>>> GHz = 1000 MHz; >>>> THz = 1000 GHz; -- Up to 9.2 THz with a 63-bit positive range >>>> end units; >>>> >>> >>> What is wrong with: >>> >>> type frequency is range 0 to 2**63 -1 units >>> ... >>> end units; >>> >>> Should be already supported. >>> >> >> package physical is >> type FREQ is range 0 to 2**63 -1 units -- line 209 >> Hz; >> kHz = 1000 Hz; >> MHz = 1000 kHz; >> GHz = 1000 MHz; >> THz = 1000 GHz; >> end units; >> >> ghdl -a top_physicaltest.vhdl >> top_physicaltest.vhdl:209:30: arithmetic overflow in static expression >> top_physicaltest.vhdl:209:26: range constraint for a physical type must >> be static >> >> (ghdl-0.31). >> >> Analyzes successfully with 2**62 -1, and that sounds like an >> implementation limit. >> > > Yes, because 2**63 is of type universal integer (a 64 bit type in ghdl), > but out of the bounds. Would work if you write the whole number. > > (Ada with its arbitrary precision for universal types at compile time only > doesn't have such issue - and yes, I think this is the best model: > arbitrary precision at execution time would be a bad idea from a > performance point of view). > > Tristan. > > > > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > > > -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Fri Jan 9 22:47:06 2015
This archive was generated by hypermail 2.1.8 : Fri Jan 09 2015 - 22:47:28 PST