aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue290/TbNamesPkg.vhd
blob: 8d5b0050432703ade91519adaf4a553a363eabc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
--
--  File Increment:         TbNamesPkg.vhd
--  Design Unit Increment:  TbNamesPkg
--  Revision:          STANDARD VERSION
--
--  Maintainer:        Jim Lewis      email:  jim@synthworks.com
--  Contributor(s):
--     Jim Lewis          SynthWorks
--
--
--  Package Defines
--      Data structure for Increment. 
--
--  Developed for:
--        SynthWorks Design Inc.
--        VHDL Training Classes
--        11898 SW 128th Ave.  Tigard, Or  97223
--        http://www.SynthWorks.com
--
--
--  Revision History:
--    Date      Version    Description
--    05/2015   2015.06    Added input to Get to return when not initialized
--
--
--  Copyright (c) 2010 - 2016 by SynthWorks Design Inc.  All rights reserved.
--

package TbNamesPkg is
  type IncrementPType is protected
    procedure Inc ;
    impure function Get return integer ;
  end protected IncrementPType ;
  
  procedure PrintNames ;
  procedure CallPrintNames ; 
end package TbNamesPkg ;

--- ///////////////////////////////////////////////////////////////////////////
--- ///////////////////////////////////////////////////////////////////////////
--- ///////////////////////////////////////////////////////////////////////////

package body TbNamesPkg is
  type IncrementPType is protected body
    variable IncrementVar : integer := 0 ;
    
    impure function PrintNamesFun(S : string) return integer is
    begin 
      report "IncrementVar'INSTANCE_NAME as a parameter: " & S ;
      report "IncrementVar: INSTANCE_NAME  " & IncrementVar'INSTANCE_NAME  ;
      report "IncrementVar: PATH_NAME      " & IncrementVar'PATH_NAME  ;
      report "function PrintNamesFun: INSTANCE_NAME  " & PrintNamesFun'INSTANCE_NAME  ;
      report "function PrintNamesFun: PATH_NAME      " & PrintNamesFun'PATH_NAME  ;
      return 0 ; 
    end function PrintNamesFun ; 
   
    variable Temp : integer := PrintNamesFun(IncrementVar'INSTANCE_NAME) ;

    ------------------------------------------------------------
    procedure Inc is
    ------------------------------------------------------------
    begin
      IncrementVar := IncrementVar + 1 ;
    end procedure Inc ;

    ------------------------------------------------------------
    impure function Get return integer is
    ------------------------------------------------------------
    begin
      report "IncrementVar: INSTANCE_NAME  " & IncrementVar'INSTANCE_NAME  ;
      report "IncrementVar: PATH_NAME      " & IncrementVar'PATH_NAME  ;
      report "Method Get: INSTANCE_NAME  " & Get'INSTANCE_NAME  ;
      report "Method Get: PATH_NAME      " & Get'PATH_NAME  ;
      return IncrementVar ; 
    end function Get ;
  end protected body IncrementPType ;

  
  procedure PrintNames is
  begin 
    report "procedure PrintNames: INSTANCE_NAME  " & PrintNames'INSTANCE_NAME  ;
    report "procedure PrintNames: PATH_NAME      " & PrintNames'PATH_NAME  ;
  end procedure PrintNames ; 
  
  procedure CallPrintNames is 
  begin
    PrintNames ;
  end procedure CallPrintNames ;
end package body TbNamesPkg ;