[vhdl-200x-ft] Generic packages and Generic Subprograms

From: Jim Lewis <jim@SynthWorks.com>
Date: Thu Dec 23 2004 - 08:43:17 PST

Peter,
With the generic clause following the generic package and
the generic clause preceding the generic procedure/function,
seems to lead to some interesting syntax errors.

Case 1:
Generics on package and subprogram (no issues, baseline case)
------------------

package a_generic_pkg is
   generic(type pkg_type) ;

   generic(type fun_type)
   function a_generic_fun(L: pkg_type) return fun_type ;
end a_generic_pkg ;

Case 2:
Generics on package and but not on subprogram
Issue: If leave off ";", then the generic belongs to
         the function and not the package.
------------------
library ieee ;
use std_logic_1164.all ;
package a_generic_pkg is
   generic(type pkg_type) ;

   function a_generic_fun(L: pkg_type) return std_logic_vector ;
end a_generic_pkg ;

Case 3:
Generics not on package and on subprogram
Issue: If add ";", then the generic belongs to
         the package and not the function.
------------------
library ieee ;
use std_logic_1164.all ;
package a_normal_pkg is

   generic(type fun_type)
   function a_generic_fun(L: fun_type) return std_logic_vector ;
end a_normal_pkg ;

At one point in time I think there was a goal to keep
a hamming distance between correct functionality.
Should we consider moving the generic clause for the
package before the package like the subprogram or
alternately should we consider moving the generic
clause to after the subprogram declaration.

Cheers,
Jim

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 23 08:43:25 2004

This archive was generated by hypermail 2.1.8 : Thu Dec 23 2004 - 08:44:45 PST