courses:system_design:project_management:lost_chapters

Name Spaces

  • Definitions of:
    • types, subtypes, constants, components and subprograms
  • Deferred constants:
    • constants, which are declared in the header of a package and are assigned a value in the body
package P is 
       constant C: integer;
end P;
package body P is 
       constant C : integer:=200;
end P;
package net is 
      subtype p_bit is std_ulogic;
      subtype p_bit_vector is std_ulogic_vector;
      subtype p_net_data is p_bit_vector (7 downto 0);
      type p_net_frame is array (1 downto 0) of p_net_data;
 
       constant low: integer := 0;
       constant high: integer :=1;
 
       constant period: time := 10 ns;

There are low-cost tools which do not support self defined packages.

Notes

It is possible to change the value of the constant C several times without recompiling the complete design. Only the package body has to be recompiled.

A package body is not necessary if no subprograms or deferred constants are declared.

Example:

package SimulationTimes is
        constant tCLK        :        time := 30 ns;
        constant tSetup     :        time := 10 ns;
        constant tHold       :        time := 14 ns;
        constant tCLK77  :        time := 77 ns;
        constant tWrite      :        time := 8 ns;
        constant tRead      :        time := 8 ns;
        constant tData       :        time := 21 ns;
end SimulationTimes ;

Visibility of Package Contents

Notes

With the keyword “all” as suffix in the use clause it is possible to make visible all the objects declared in the package header. If you only want to make visible special objects of the package header you have to use their simple name as suffix:

Library ps;
use ps.p.C;

Chapters of System Design > Project Management