[vhdl-200x-ft] FT22, static aggregates and composite expression has been updated

From: John Ries <johnr_at_.....>
Date: Fri Mar 11 2005 - 10:20:59 PST
FT22 has been updated to reflect the use of aggregates as choices for case statements
and how the effect the value of the aggregate.
-- 
-- mailto: johnr@model.com     phone: (503)685-0864
--   http://www.model.com        fax: (503)685-0921
--


IEEE 200X Fast Track Change Proposal

ID:	  FT-22

Proposer:     John Ries
email:        johnr@model.com

Status:       Open
Proposed:     04/20/04
Analyzed:     Date
Resolved:     Date

Enhancement Summary:  Allow aggregates, array operands, and array operators
to be locally static.   
Related issues:          
Relevant LRM section:    7.4.1

Enhancement Detail:
----------------------------

Currently the only locally static non-scalars are bit string literals
and string literals.  As a result aggregates, concatenation, slices,
or functions returning composites cannot be used in places that
require locally static expression such as choices for cases.

This enhancement is to modify the statement

  "An expression is said to be locally static if and only if every
  operator in the expression denotes an implicitly defined operator
  whose operands and result are scalar and if every primary in the
  expression is a locally static primary, where locally static primary
  is defined to be one of the following:"

To

  "An expression is said to be locally static if and only if every
  operator in the expression denotes an implicitly defined operator
  and if every primary in the expression is a locally static primary,
  where locally static primary is defined to be one of the following:"

Addition items defining a locally static primary would be added

  "k) An array aggregate, if and only if

      1) All expression in its element associations are locally static
         expressions, and 
      2) All ranges in its element associations are locally static 
         ranges
      3) The aggregate subtype is locally static.

   l) A record aggregate, if and only if all expressions in its
      element associations are locally static expressions and the
      subtype is locally stati

   m) A subelement or a slice of a locally static primary, provided
      that any index expressions are locally static expressions and any
      discrete ranges used in slice names are locally static discrete
      ranges

A locally static range is either a range of the second form (see 3.1) whose
bounds are locally static expressions, or a range of the first form whose prefix 
denotes either a locally static subtype or and object that is of a locally static 
subtype. A locally static range constraint is a range constraint whose range is
locally static.

   n) A selected name, whose prefix denotes a locally static primary."

If the proposal for locally static composites (FT22) is accepted. We need to
handle choices that are aggregates.  An aggregate used as a choice has it
type determine from the select expressions type.  If the select expression is one of the
following

  - The name of an object whose subtype is locally static
  - An indexed name whose prefix is one of the members of this list and whose indexing
    expressions are locally static expressions
  - A slice name whose prefix is one of the members of this list and whose discrete range is
    a locally static discrete range
  - A function call whose return type mark denotes a locally static subtype
  - A qualified expression or type conversion whose type mark denotes a locally static subtype
  - An item in this list enclosed by parens.

Then the aggregate has a locally static subtype constructed from the
base type and the constraint determined from the list above. This allows for 
the use of OTHERS in an aggregate.  For example:
SIGNAL  s : std_logic_vector(3 DOWNTO 0);
...

CASE s IS
  WHEN ( 0 => '1', OTHERS => '0') =>  -- same as "0001"
  WHEN ( 1 => '1', OTHERS => '0') =>  -- same as "0010"
  WHEN ( 2 => '1', OTHERS => '0') =>  -- same as "0100"
  WHEN ( 3 => '1', OTHERS => '0') =>  -- same as "1000"
...

If the select expression is not an item in the above list,
then the aggregates constraints are determined from the aggregates contents.
As the result OTHERS cannot be used in an aggregate that is a choice.

This does cause some odd things though.  For example

SIGNAL s : std_logic_vector(3 DOWNTO 0);

CASE  s IS
 WHEN ( 0 => '1', 1 TO 3 => '0') => -- same as "0001"
 WHEN ( 0 => '0', 1 => '1' 2 TO 3 => '0') => -- same as "0010"
 ...

SIGNAL s2 : std_logic_vector ( some_generic - 1 DOWNTO 0);

CASE s2 IS
 WHEN ( 0 => '1', 1 TO 3 => '0') => -- same as "1000"
 WHEN ( 0 => '0', 1 => '1' 2 TO 3 => '0') => -- same as "0100"
 ...

This is because in the first example the aggregate's subtype is
determine fromt he select expression.  In the second case the
subtype is determined from the aggregate's choices and the
indexed constraint of the base type array indices.

These changes allow better use of existing language construct at the
expense of compiler complexity.  Specifically the inability to use
& in constants that are then used as case choices currently is illegal
and causes problems for users.  


Analysis:
----------------------------
[To be performed by the 200X Fast Track Working Group]


Resolution:
----------------------------
[To be performed by the 200X Fast Track Working Group]
Received on Fri Mar 11 10:25:34 2005

This archive was generated by hypermail 2.1.8 : Fri Mar 11 2005 - 10:25:36 PST