On 29/10/14 22:43, Trond Danielsen wrote: > If you open up the language to Nullable types you open up a giant can of > worms and errors. I agree. > If this sort of functionality in VHDL is need I > suggest that it is based on the option type known from functional > programming languages such as Haskell. Only then will you be able to > rely on the compiler avoid null-exceptions. Of cause a Maybe (Haskell) > or Option (F#) type would require significant modifications to the VHDL > type system, but it opens up a whole new world of possibilities. Currently (and even with vhdl87), you can write: type maybe_integer is record val : integer; is_nan : boolean; end record; And then declare "+", "-", "/" ... functions to have an integer+Nan semantic. If then you add conversion functions like: function "+" (l : maybe_integer) return integer is begin assert l.is_nan = false; return l.val; end "+"; function "+" (l : integer) return maybe_integer is begin return (l, false); end "+"; you have the Maybe semantic of Haskell (or BSV). This is a little bit heavier to declare in VHDL than in Haskell, but with a generic package this is doable. So I'd also prefer not to shake-up the language for the NaN need. Tristan. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Wed Oct 29 22:09:12 2014
This archive was generated by hypermail 2.1.8 : Wed Oct 29 2014 - 22:09:21 PDT