Skip to content

Commit c9c552a

Browse files
committed
2018.04 Release
2 parents 93d2318 + b69c77e commit c9c552a

File tree

7 files changed

+11106
-10985
lines changed

7 files changed

+11106
-10985
lines changed

AlertLogPkg.vhd

Lines changed: 3317 additions & 3310 deletions
Large diffs are not rendered by default.

CoveragePkg.vhd

Lines changed: 5071 additions & 5043 deletions
Large diffs are not rendered by default.

MessagePkg.vhd

Lines changed: 165 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -1,165 +1,166 @@
1-
--
2-
-- File Name: MessagePkg.vhd
3-
-- Design Unit Name: MessagePkg
4-
-- Revision: STANDARD VERSION, revision 2015.01
5-
--
6-
-- Maintainer: Jim Lewis email: [email protected]
7-
-- Contributor(s):
8-
-- Jim Lewis SynthWorks
9-
--
10-
--
11-
-- Package Defines
12-
-- Data structure for multi-line name/message to be associated with a data structure.
13-
--
14-
-- Developed for:
15-
-- SynthWorks Design Inc.
16-
-- VHDL Training Classes
17-
-- 11898 SW 128th Ave. Tigard, Or 97223
18-
-- http://www.SynthWorks.com
19-
--
20-
-- Latest standard version available at:
21-
-- http://www.SynthWorks.com/downloads
22-
--
23-
-- Revision History:
24-
-- Date Version Description
25-
-- 06/2010: 0.1 Initial revision
26-
-- 07/2014: 2014.07 Moved specialization required by CoveragePkg to CoveragePkg
27-
-- 07/2014: 2014.07a Removed initialized pointers which can lead to memory leaks.
28-
-- 01/2015: 2015.01 Removed initialized parameter from Get
29-
--
30-
--
31-
-- Copyright (c) 2010 - 2015 by SynthWorks Design Inc. All rights reserved.
32-
--
33-
-- Verbatim copies of this source file may be used and
34-
-- distributed without restriction.
35-
--
36-
-- This source file is free software; you can redistribute it
37-
-- and/or modify it under the terms of the ARTISTIC License
38-
-- as published by The Perl Foundation; either version 2.0 of
39-
-- the License, or (at your option) any later version.
40-
--
41-
-- This source is distributed in the hope that it will be
42-
-- useful, but WITHOUT ANY WARRANTY; without even the implied
43-
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
44-
-- PURPOSE. See the Artistic License for details.
45-
--
46-
-- You should have received a copy of the license with this source.
47-
-- If not download it from,
48-
-- http://www.perlfoundation.org/artistic_license_2_0
49-
--
50-
use work.OsvvmGlobalPkg.all ;
51-
use work.AlertLogPkg.all ;
52-
53-
library ieee ;
54-
use ieee.std_logic_1164.all ;
55-
use ieee.numeric_std.all ;
56-
use ieee.math_real.all ;
57-
use std.textio.all ;
58-
59-
package MessagePkg is
60-
61-
type MessagePType is protected
62-
63-
procedure Set (MessageIn : String) ;
64-
impure function Get (ItemNumber : integer) return string ;
65-
impure function GetCount return integer ;
66-
impure function IsSet return boolean ;
67-
procedure Clear ; -- clear message
68-
procedure Deallocate ; -- clear message
69-
70-
end protected MessagePType ;
71-
72-
end package MessagePkg ;
73-
74-
--- ///////////////////////////////////////////////////////////////////////////
75-
--- ///////////////////////////////////////////////////////////////////////////
76-
--- ///////////////////////////////////////////////////////////////////////////
77-
78-
package body MessagePkg is
79-
80-
-- Local Data Structure Types
81-
type LineArrayType is array (natural range <>) of line ;
82-
type LineArrayPtrType is access LineArrayType ;
83-
84-
type MessagePType is protected body
85-
86-
variable MessageCount : integer := 0 ;
87-
constant INITIAL_ITEM_COUNT : integer := 16 ;
88-
variable MaxMessageCount : integer := 0 ;
89-
variable MessagePtr : LineArrayPtrType ;
90-
91-
------------------------------------------------------------
92-
procedure Set (MessageIn : String) is
93-
------------------------------------------------------------
94-
variable NamePtr : line ;
95-
variable OldMaxMessageCount : integer ;
96-
variable OldMessagePtr : LineArrayPtrType ;
97-
begin
98-
MessageCount := MessageCount + 1 ;
99-
if MessageCount > MaxMessageCount then
100-
OldMaxMessageCount := MaxMessageCount ;
101-
MaxMessageCount := MaxMessageCount + INITIAL_ITEM_COUNT ;
102-
OldMessagePtr := MessagePtr ;
103-
MessagePtr := new LineArrayType(1 to MaxMessageCount) ;
104-
for i in 1 to OldMaxMessageCount loop
105-
MessagePtr(i) := OldMessagePtr(i) ;
106-
end loop ;
107-
Deallocate( OldMessagePtr ) ;
108-
end if ;
109-
MessagePtr(MessageCount) := new string'(MessageIn) ;
110-
end procedure Set ;
111-
112-
------------------------------------------------------------
113-
impure function Get (ItemNumber : integer) return string is
114-
------------------------------------------------------------
115-
begin
116-
if MessageCount > 0 then
117-
if ItemNumber >= 1 and ItemNumber <= MessageCount then
118-
return MessagePtr(ItemNumber).all ;
119-
else
120-
Alert(OSVVM_ALERTLOG_ID, "%% MessagePkg.Get input value out of range", FAILURE) ;
121-
return "" ; -- error if this happens
122-
end if ;
123-
else
124-
Alert(OSVVM_ALERTLOG_ID, "%% MessagePkg.Get message is not set", FAILURE) ;
125-
return "" ; -- error if this happens
126-
end if ;
127-
end function Get ;
128-
129-
------------------------------------------------------------
130-
impure function GetCount return integer is
131-
------------------------------------------------------------
132-
begin
133-
return MessageCount ;
134-
end function GetCount ;
135-
136-
------------------------------------------------------------
137-
impure function IsSet return boolean is
138-
------------------------------------------------------------
139-
begin
140-
return MessageCount > 0 ;
141-
end function IsSet ;
142-
143-
------------------------------------------------------------
144-
procedure Deallocate is -- clear message
145-
------------------------------------------------------------
146-
variable CurPtr : LineArrayPtrType ;
147-
begin
148-
for i in 1 to MessageCount loop
149-
deallocate( MessagePtr(i) ) ;
150-
end loop ;
151-
MessageCount := 0 ;
152-
MaxMessageCount := 0 ;
153-
deallocate( MessagePtr ) ;
154-
end procedure Deallocate ;
155-
156-
------------------------------------------------------------
157-
procedure Clear is -- clear
158-
------------------------------------------------------------
159-
begin
160-
Deallocate ;
161-
end procedure Clear ;
162-
163-
end protected body MessagePType ;
164-
1+
--
2+
-- File Name: MessagePkg.vhd
3+
-- Design Unit Name: MessagePkg
4+
-- Revision: STANDARD VERSION, revision 2015.01
5+
--
6+
-- Maintainer: Jim Lewis email: [email protected]
7+
-- Contributor(s):
8+
-- Jim Lewis SynthWorks
9+
--
10+
--
11+
-- Package Defines
12+
-- Data structure for multi-line name/message to be associated with a data structure.
13+
--
14+
-- Developed for:
15+
-- SynthWorks Design Inc.
16+
-- VHDL Training Classes
17+
-- 11898 SW 128th Ave. Tigard, Or 97223
18+
-- http://www.SynthWorks.com
19+
--
20+
-- Latest standard version available at:
21+
-- http://www.SynthWorks.com/downloads
22+
--
23+
-- Revision History:
24+
-- Date Version Description
25+
-- 06/2010: 0.1 Initial revision
26+
-- 07/2014: 2014.07 Moved specialization required by CoveragePkg to CoveragePkg
27+
-- 07/2014: 2014.07a Removed initialized pointers which can lead to memory leaks.
28+
-- 01/2015: 2015.01 Removed initialized parameter from Get
29+
-- 04/2018: 2018.04 Minor updates to alert message
30+
--
31+
--
32+
-- Copyright (c) 2010 - 2018 by SynthWorks Design Inc. All rights reserved.
33+
--
34+
-- Verbatim copies of this source file may be used and
35+
-- distributed without restriction.
36+
--
37+
-- This source file is free software; you can redistribute it
38+
-- and/or modify it under the terms of the ARTISTIC License
39+
-- as published by The Perl Foundation; either version 2.0 of
40+
-- the License, or (at your option) any later version.
41+
--
42+
-- This source is distributed in the hope that it will be
43+
-- useful, but WITHOUT ANY WARRANTY; without even the implied
44+
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
45+
-- PURPOSE. See the Artistic License for details.
46+
--
47+
-- You should have received a copy of the license with this source.
48+
-- If not download it from,
49+
-- http://www.perlfoundation.org/artistic_license_2_0
50+
--
51+
use work.OsvvmGlobalPkg.all ;
52+
use work.AlertLogPkg.all ;
53+
54+
library ieee ;
55+
use ieee.std_logic_1164.all ;
56+
use ieee.numeric_std.all ;
57+
use ieee.math_real.all ;
58+
use std.textio.all ;
59+
60+
package MessagePkg is
61+
62+
type MessagePType is protected
63+
64+
procedure Set (MessageIn : String) ;
65+
impure function Get (ItemNumber : integer) return string ;
66+
impure function GetCount return integer ;
67+
impure function IsSet return boolean ;
68+
procedure Clear ; -- clear message
69+
procedure Deallocate ; -- clear message
70+
71+
end protected MessagePType ;
72+
73+
end package MessagePkg ;
74+
75+
--- ///////////////////////////////////////////////////////////////////////////
76+
--- ///////////////////////////////////////////////////////////////////////////
77+
--- ///////////////////////////////////////////////////////////////////////////
78+
79+
package body MessagePkg is
80+
81+
-- Local Data Structure Types
82+
type LineArrayType is array (natural range <>) of line ;
83+
type LineArrayPtrType is access LineArrayType ;
84+
85+
type MessagePType is protected body
86+
87+
variable MessageCount : integer := 0 ;
88+
constant INITIAL_ITEM_COUNT : integer := 16 ;
89+
variable MaxMessageCount : integer := 0 ;
90+
variable MessagePtr : LineArrayPtrType ;
91+
92+
------------------------------------------------------------
93+
procedure Set (MessageIn : String) is
94+
------------------------------------------------------------
95+
variable NamePtr : line ;
96+
variable OldMaxMessageCount : integer ;
97+
variable OldMessagePtr : LineArrayPtrType ;
98+
begin
99+
MessageCount := MessageCount + 1 ;
100+
if MessageCount > MaxMessageCount then
101+
OldMaxMessageCount := MaxMessageCount ;
102+
MaxMessageCount := MaxMessageCount + INITIAL_ITEM_COUNT ;
103+
OldMessagePtr := MessagePtr ;
104+
MessagePtr := new LineArrayType(1 to MaxMessageCount) ;
105+
for i in 1 to OldMaxMessageCount loop
106+
MessagePtr(i) := OldMessagePtr(i) ;
107+
end loop ;
108+
Deallocate( OldMessagePtr ) ;
109+
end if ;
110+
MessagePtr(MessageCount) := new string'(MessageIn) ;
111+
end procedure Set ;
112+
113+
------------------------------------------------------------
114+
impure function Get (ItemNumber : integer) return string is
115+
------------------------------------------------------------
116+
begin
117+
if MessageCount > 0 then
118+
if ItemNumber >= 1 and ItemNumber <= MessageCount then
119+
return MessagePtr(ItemNumber).all ;
120+
else
121+
Alert(OSVVM_ALERTLOG_ID, "OSVVM.MessagePkg.Get input value out of range", FAILURE) ;
122+
return "" ; -- error if this happens
123+
end if ;
124+
else
125+
Alert(OSVVM_ALERTLOG_ID, "OSVVM.MessagePkg.Get message is not set", FAILURE) ;
126+
return "" ; -- error if this happens
127+
end if ;
128+
end function Get ;
129+
130+
------------------------------------------------------------
131+
impure function GetCount return integer is
132+
------------------------------------------------------------
133+
begin
134+
return MessageCount ;
135+
end function GetCount ;
136+
137+
------------------------------------------------------------
138+
impure function IsSet return boolean is
139+
------------------------------------------------------------
140+
begin
141+
return MessageCount > 0 ;
142+
end function IsSet ;
143+
144+
------------------------------------------------------------
145+
procedure Deallocate is -- clear message
146+
------------------------------------------------------------
147+
variable CurPtr : LineArrayPtrType ;
148+
begin
149+
for i in 1 to MessageCount loop
150+
deallocate( MessagePtr(i) ) ;
151+
end loop ;
152+
MessageCount := 0 ;
153+
MaxMessageCount := 0 ;
154+
deallocate( MessagePtr ) ;
155+
end procedure Deallocate ;
156+
157+
------------------------------------------------------------
158+
procedure Clear is -- clear
159+
------------------------------------------------------------
160+
begin
161+
Deallocate ;
162+
end procedure Clear ;
163+
164+
end protected body MessagePType ;
165+
165166
end package body MessagePkg ;

0 commit comments

Comments
 (0)