Re: [vhdl-200x-ft] Revised FT18: condition operator

From: Jim Lewis <Jim@SynthWorks.com>
Date: Thu Dec 02 2004 - 08:15:05 PST

Tristan,
Note, condition? was (is being) replaced by ?? as updated below:
> Instead of
> *condition* ::= *boolean*_expression
> | ??( expression )
>
> Where ?? is called by the compiler when the expression does
> not resolve to boolean.

In this from of condition, ?? can only be called
implicitly at the highest level of the condition.
The expression must hence resolve to some type such
as std_logic or bit for ?? to be called.

> Why not:
> *condition* ::= expression
>
> Where a "??" function returning a boolean is implcitly called with the
> expression as only argument.

When is ?? called? Anytime? We looked at that.
If you demote std_logic to boolean too soon, you
loose the value of X. If A is 'X', should "not A"
translate to false (applying it after the not) or
true (applying ?? to A immediately). I think
John Ries was able to come up with some more
interesting cases than this.

> Of course, a 'function "??" (a : boolean) return boolean;"
> has to be defined. Things would be more orthogonal.
Assuming that it is defined for bit in std.standard and
std_ulogic in std_logic_1164.

Cheers,
Jim

P.S.
Of course, as a hardware designer, I never saw the
value of having a separate type for boolean. So
long term, I would like to see it easier to move
back in forth between them. Something more like:

   As an expression is being evaluated, promote boolean
   to bit and boolean to std_ulogic as needed. Optionally
   extend this to include bit to std_ulogic.

   When an expression is being assigned
   or has reached a conditional demote the expression
   value as needed. From std_ulogic to boolean and
   bit to boolean as needed. Optionally extend this to
   include std_ulogic to bit.

In the future we probably need some general mechanism for
defining type association. If we were to write something
like the above into the LRM now, it is potentially a wart
that would either need to be worked around in the future.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jim Lewis
Director of Training             mailto:Jim@SynthWorks.com
SynthWorks Design Inc.           http://www.SynthWorks.com
1-503-590-4787
Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Received on Thu Dec 2 08:15:13 2004

This archive was generated by hypermail 2.1.8 : Thu Dec 02 2004 - 08:15:31 PST