|
LCS-2016-032 |
|
2 |
|
11-Mar-2017 |
|
Voting |
|
Jim Lewis and Patrick Lehmann |
|
Main.JimLewis and Main.PatrickLehmann |
|
PATH_NAME and Protected Types |
|
history |
|
PATH_NAME and INSTANCE_NAME, and Protected Types |
Examples: library Lib; -- All design units are in this library: package P is -- P'PATH_NAME = ":lib:p:" -- P'INSTANCE_NAME = ":lib:p:" procedure Proc (F: inout INTEGER); -- Proc'PATH_NAME = ":lib:p:proc[integer]:" [delete space before signature] -- Proc'INSTANCE_NAME = ":lib:p:proc[integer]:" [delete space before signature] constant C: INTEGER := 42; -- C'PATH_NAME = ":lib:p:c" type IncPt1 is protected procedure increment; impure function get return INTEGER; end protected IncPt1; end package P; -- C'INSTANCE_NAME = ":lib:p:c" package body P is procedure Proc (F: inout INTEGER) is variable x: INTEGER; -- x'PATH_NAME = ":lib:p:proc[integer]:x" [delete space before signature] begin -- x'INSTANCE_NAME = ":lib:p:proc[integer]:x" [delete space before signature] · · · end procedure Proc; type IncPt1 is protected body variable IncCounter : INTEGER := 0; -- For shared variable ArchInc -- IncCounter'PATH_NAME = "e:ArchInc:IncCounter" -- IncCounter'INSTANCE_NAME = "e(a):ArchInc:IncCounter" -- For variable ProcInc -- IncCounter'PATH_NAME = "e:p1:ProcInc:IncCounter" -- IncCounter'INSTANCE_NAME = "e(a):p1:ProcInc:IncCounter" procedure increment is begin -- For shared variable ArchInc -- increment'PATH_NAME = "e:ArchInc:increment" -- increment'INSTANCE_NAME = "e(a):ArchInc:increment" -- For variable ProcInc -- increment'PATH_NAME = "e:p1:ProcInc:increment" -- increment'INSTANCE_NAME = "e(a):p1:ProcInc:increment" IncCounter := IncCounter + 1; end procedure increment; impure function get return INTEGER is begin -- For shared variable ArchInc -- get'PATH_NAME = "e:ArchInc:get" -- get'INSTANCE_NAME = "e(a):ArchInc:get" -- For variable ProcInc -- get'PATH_NAME = "e:p1:ProcInc:get" -- get'INSTANCE_NAME = "e(a):p1:ProcInc:get" return IncCounter; end function get; end protected IncPt1; end package body P; library Lib; use Lib.P.all; -- Assume that E is in Lib and entity E is -- E is the top-level design entity: -- E'PATH_NAME = ":e:" -- E'INSTANCE_NAME = ":e(a):" generic (G: INTEGER); -- G'PATH_NAME = ":e:g" -- G'INSTANCE_NAME = ":e(a):g" port (P: in INTEGER); -- P'PATH_NAME = ":e:p" end entity E; -- P'INSTANCE_NAME = ":e(a):p" architecture A of E is signal S: BIT_VECTOR (1 to G); -- S'PATH_NAME = ":e:s" -- S'INSTANCE_NAME = ":e(a):s" procedure Proc1 (signal sp1: NATURAL; C: out INTEGER) is -- Proc1'PATH_NAME = ":e:proc1[natural,integer]:" -- Proc1'INSTANCE_NAME = ":e(a):proc1[natural,integer]:" -- C'PATH_NAME = ":e:proc1[natural,integer]:c" -- C'INSTANCE_NAME = ":e(a):proc1[natural,integer]:c" variable max: DELAY_LENGTH; -- max'PATH_NAME = ":e:proc1[natural,integer]:max" -- max'INSTANCE_NAME = ":e(a):proc1[natural,integer]:max" begin max := sp1 * 1 ns; [Note: add a 1 before ns] wait on sp1 for max; c := sp1; end procedure Proc1; shared variable ArchInc : IncPt1; -- ArchInc'PATH_NAME = ":e:ArchInc" -- ArchInc'INSTANCE_NAME = ":e(a):ArchInc" begin p1: process variable T: INTEGER := 12; -- T'PATH_NAME = :e:p1:t"[Entity top and bottom unchanged]begin-- T'INSTANCE_NAME = ":e(a):p1:t" variable ProcInc : IncPt1; -- ProcInc'PATH_NAME = ":e:p1:ProcInc" -- ProcInc'INSTANCE_NAME = ":e(a):p1:ProcInc" begin · · · end process p1; process variable T: INTEGER := 12; -- T'PATH_NAME = ":e::t" begin -- T'INSTANCE_NAME = ":e(a)::t" · · · end process; [Note: delete space between ; and process] end architecture;