[vhdl-200x-ft] FT-04 Generalization

From: Bailey, Stephen <SBailey@model.com>
Date: Tue Jul 06 2004 - 13:50:21 PDT

The new minimum and maximum (or whatever their final name) functions would be much more useful if they were defined in terms of operating on an unconstrained array of the type. The prototypes would be changed as follows:

<type T>
Type anonymous_arr_of_T is array(Natural range <>) of T;
function minimum( A : anonymous_arr_of_T ) return T;
function maximum( A : anonymous_arr_of_T ) return T;

The benefit would be that an arbitrary number of values can be passed into the function and the function would return the minimum or maximum out of that set of values using an aggregate form:

if minimum( (a, b, c, d, e) ) = a then
  report "a is the smallest value in the set";
end if;

The drawback is an increase in complexity in that it requires an implicitly or explicitly declared unconstrained array of the type. It might be possible to finesse this into the language (when a type is declared, an unconstrained array is declared with the type as the element type). Some naming convention would be required for this implicit array declaration so it is useful for referencing in function overloadings.

------------
Stephen Bailey
ModelSim Verification TME
Mentor Graphics
sbailey@model.com
303-775-1655 (mobile, preferred)
720-494-1202 (office)
www.model.com <www.model.com>
Received on Tue Jul 6 13:50:23 2004

This archive was generated by hypermail 2.1.8 : Tue Jul 06 2004 - 13:50:27 PDT