I've been listening in to the debate on modular types et al, and have a practical comment to offer, from the days when we coded directly on the iron: Most or all modern computer instruction sets support multi-precision integer arithmetic to some degree, especially addition and subtraction, where "multi-precision" means integer multiples of a 32-bit or sometimes 64-bit integer words. Such arithmetic can execute very fast, even though it's done in software, and the code is simple. To get the details, look at the CPU hardware instruction set documentation. One can always access the data and instruction using assembly code. Some kinds of C probably also have the hooks and handles. We are talking about maybe ten lines of code, so portability between hardware platforms isn't really necessary. One just provides an assembly-coded C function for each CPU type. Joe From: Jim Lewis <jim@synthworks.com> To: vhdl-200x@eda.org Date: 10/23/2014 05:34 PM Subject: Re: [vhdl-200x] Modular types, alternative solutions Sent by: owner-vhdl-200x@eda.org Hi Tristan, >> The second proposes adding discriminants (another concept borrowed >> from ADA). I am actually surprised that ADA did not do modular >> types this way as this provides a general feature that we can use >> for other things, such as saturating types. > Your discriminant proposal doesn't allow large modular types, and > doesn't provide strong typing :-( The proposal shows an example using current VHDL types. Certainly if integers are extended, the extended integers could be used. Hard to base a proposal on something that does not exist yet. In addition, as a general feature, discriminants could be used to create a saturating integer type or even a real number with a modulus (independent as to whether it makes sense or not). Cheers, Jim p.s. I added notes on your thoughts about generics. It would be interesting to hear your reply. Also note that Cliff W has been experimenting with a package that uses generics to do modulo types. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Jim Lewis Jim@SynthWorks.com VHDL Training Expert http://www.SynthWorks.com IEEE VHDL Working Group Chair OSVVM, Chief Architect and Cofounder 1-503-590-4787 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- 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.
This archive was generated by hypermail 2.1.8 : Thu Oct 23 2014 - 14:48:18 PDT