RE: [vhdl-200x] More operators for integers

From: Martin.J Thompson <Martin.J.Thompson@trw.com>
Date: Tue Oct 21 2014 - 01:39:43 PDT
I'm merely wanting to be clear that errors will be raised in the usual way and that there is no magic or changes to expected behaviour.  Not necessarily that they will get much use, or that every operator *can* result in errors, merely that there should be no surprises where errors are concerned.

A "logical operator" example, if you have a +ve integer and "not" it (ie flip every bit, resulting in a -ve number) and assign it to a natural, or some other subtype without the appropriate negative range, you will get an error.

Cheers,
Martin




-----Original Message-----
From: owner-vhdl-200x@eda.org [mailto:owner-vhdl-200x@eda.org] On Behalf Of whygee@f-cpu.org
Sent: 20 October 2014 23:22
To: vhdl-200x@eda.org
Subject: RE: [vhdl-200x] More operators for integers

Le 2014-10-20 11:49, Martin.J Thompson a écrit :
>> so it would be a compile-time error ?
> No, runtime.  If you have a variable (say) containing the maximum 
> value for its range, then incrementing it will cause a runtime error.
> Similarly shifting it left as described in this proposal would error 
> through the same mechanism.

but that would only be used on the "arithmetic" operations, namely sla and sra, and I can't remember ever using sla, which is identical to sll. If I want arithmetic accuracy, I use a standard multiply and divide.
srl and sra do not overflow so no error needs to be checked.
It makes even less sense for and/or/xor/not.

Can you explain your logic for the errors ?
and would it trap, or return a magic/meta-value ?

> Martin
yg


--
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 Tue Oct 21 01:40:14 2014

This archive was generated by hypermail 2.1.8 : Tue Oct 21 2014 - 01:41:51 PDT