Skip to content

Commit

Permalink
Updated files to OSVVM release 2014.07a.
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Lehmann authored and Patrick Lehmann committed Dec 7, 2015
1 parent cde14ce commit 0042ec4
Show file tree
Hide file tree
Showing 8 changed files with 956 additions and 430 deletions.
1,152 changes: 805 additions & 347 deletions CoveragePkg.vhd

Large diffs are not rendered by default.

Binary file removed CoveragePkg_release_notes.pdf
Binary file not shown.
Binary file modified CoveragePkg_user_guide.pdf
Binary file not shown.
111 changes: 33 additions & 78 deletions MessagePkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
--
--
-- Package Defines
-- Data structure for name and message handling.
-- Data structure for multi-line name/message to be associated with a data structure.
--
-- Developed for:
-- SynthWorks Design Inc.
Expand All @@ -23,9 +23,11 @@
-- Revision History:
-- Date Version Description
-- 06/2010: 0.1 Initial revision
-- 07/2014: 2014.07 Moved specialization required by CoveragePkg to CoveragePkg
-- 07/2014: 2014.07a Removed initialized pointers which can lead to memory leaks.
--
--
-- Copyright (c) 2010 - 2013 by SynthWorks Design Inc. All rights reserved.
-- Copyright (c) 2010 - 2014 by SynthWorks Design Inc. All rights reserved.
--
-- Verbatim copies of this source file may be used and
-- distributed without restriction.
Expand Down Expand Up @@ -55,18 +57,13 @@ package MessagePkg is

type MessagePType is protected

procedure SetName (NameIn : String) ;
impure function GetName return string ;
impure function IsSetName return boolean ;

procedure SetMessage (MessageIn : String) ;
impure function GetMessage (ItemNumber : integer) return string ;
impure function GetMessageCount return integer ;

procedure DeallocateName ; -- clear name
procedure DeallocateMessage ; -- clear message
procedure Deallocate ; -- clear all

procedure Set (MessageIn : String) ;
impure function Get (ItemNumber : integer := 1) return string ;
impure function GetCount return integer ;
impure function IsSet return boolean ;
procedure Clear ; -- clear message
procedure Deallocate ; -- clear message

end protected MessagePType ;

end package MessagePkg ;
Expand All @@ -75,58 +72,16 @@ package body MessagePkg is
-- Local Data Structure Types
type LineArrayType is array (natural range <>) of line ;
type LineArrayPtrType is access LineArrayType ;

------------------------------------------------------------
-- Local. Get first word from a string
function GetWord (Message : string) return string is
------------------------------------------------------------
alias aMessage : string( 1 to Message'length) is Message ;
begin
for i in aMessage'range loop
if aMessage(i) = ' ' or aMessage(i) = HT then
return aMessage(1 to i-1) ;
end if ;
end loop ;
return aMessage ;
end function GetWord ;


type MessagePType is protected body

variable NamePtr : line := new string'("") ;
variable MessageCount : integer := 0 ;
constant INITIAL_ITEM_COUNT : integer := 25 ;
variable MaxMessageCount : integer := INITIAL_ITEM_COUNT ;
variable MessagePtr : LineArrayPtrType := new LineArrayType(1 to INITIAL_ITEM_COUNT) ;

------------------------------------------------------------
procedure SetName (NameIn : String) is
------------------------------------------------------------
begin
deallocate(NamePtr) ;
NamePtr := new string'(NameIn) ;
end procedure SetName ;

------------------------------------------------------------
impure function GetName return string is
------------------------------------------------------------
begin
if NamePtr.all /= "" or MessagePtr(1) = NULL then
return NamePtr.all ;
else
return GetWord( MessagePtr(1).all ) ;
end if ;
end function GetName ;

------------------------------------------------------------
impure function IsSetName return boolean is
------------------------------------------------------------
begin
return NamePtr.all /= "" ;
end function IsSetName ;
constant INITIAL_ITEM_COUNT : integer := 16 ;
variable MaxMessageCount : integer := 0 ;
variable MessagePtr : LineArrayPtrType ;

------------------------------------------------------------
procedure SetMessage (MessageIn : String) is
procedure Set (MessageIn : String) is
------------------------------------------------------------
variable NamePtr : line ;
variable OldMaxMessageCount : integer ;
Expand All @@ -135,7 +90,7 @@ package body MessagePkg is
MessageCount := MessageCount + 1 ;
if MessageCount > MaxMessageCount then
OldMaxMessageCount := MaxMessageCount ;
MaxMessageCount := OldMaxMessageCount * 2 ;
MaxMessageCount := MaxMessageCount + INITIAL_ITEM_COUNT ;
OldMessagePtr := MessagePtr ;
MessagePtr := new LineArrayType(1 to MaxMessageCount) ;
for i in 1 to OldMaxMessageCount loop
Expand All @@ -144,10 +99,10 @@ package body MessagePkg is
Deallocate( OldMessagePtr ) ;
end if ;
MessagePtr(MessageCount) := new string'(MessageIn) ;
end procedure SetMessage ;
end procedure Set ;

------------------------------------------------------------
impure function GetMessage (ItemNumber : integer) return string is
impure function Get (ItemNumber : integer := 1) return string is
------------------------------------------------------------
begin
if MessageCount > 0 then
Expand All @@ -158,44 +113,44 @@ package body MessagePkg is
return "" ; -- error if this happens
end if ;
else
return NamePtr.all ;
report LF & "%% MessagePkg:MessagePType.GetMessage message is not set" severity failure ;
return "" ; -- error if this happens
end if ;
end function GetMessage ;
end function Get ;

------------------------------------------------------------
impure function GetMessageCount return integer is
impure function GetCount return integer is
------------------------------------------------------------
begin
return MessageCount ;
end function GetMessageCount ;
end function GetCount ;

------------------------------------------------------------
procedure DeallocateName is -- clear name
impure function IsSet return boolean is
------------------------------------------------------------
begin
deallocate(NamePtr) ;
NamePtr := new string'("") ;
end procedure DeallocateName ;
return MessageCount > 0 ;
end function IsSet ;

------------------------------------------------------------
procedure DeallocateMessage is -- clear message
procedure Deallocate is -- clear message
------------------------------------------------------------
variable CurPtr : LineArrayPtrType ;
begin
for i in 1 to MessageCount loop
deallocate( MessagePtr(i) ) ;
end loop ;
MessageCount := 0 ;
-- Do NOT Do this: deallocate( MessagePtr ) ;
end procedure DeallocateMessage ;
MaxMessageCount := 0 ;
deallocate( MessagePtr ) ;
end procedure Deallocate ;

------------------------------------------------------------
procedure Deallocate is -- clear all
procedure Clear is -- clear
------------------------------------------------------------
begin
DeallocateName ;
DeallocateMessage ;
end procedure Deallocate ;
Deallocate ;
end procedure Clear ;

end protected body MessagePType ;

Expand Down
113 changes: 113 additions & 0 deletions NamePkg.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
--
-- File Name: NamePkg.vhd
-- Design Unit Name: NamePkg
-- Revision: STANDARD VERSION, revision 2014.07
--
-- Maintainer: Jim Lewis email: [email protected]
-- Contributor(s):
-- Jim Lewis SynthWorks
--
--
-- Package Defines
-- Data structure for name.
--
-- Developed for:
-- SynthWorks Design Inc.
-- VHDL Training Classes
-- 11898 SW 128th Ave. Tigard, Or 97223
-- http://www.SynthWorks.com
--
-- Latest standard version available at:
-- http://www.SynthWorks.com/downloads
--
-- Revision History:
-- Date Version Description
-- 06/2010: 0.1 Initial revision
-- 07/2014: 2014.07 Moved specialization required by CoveragePkg to CoveragePkg
-- Separated name handling from message handling to simplify naming
-- 07/2014: 2014.07a Removed initialized pointers which can lead to memory leaks.
--
--
-- Copyright (c) 2010 - 2014 by SynthWorks Design Inc. All rights reserved.
--
-- Verbatim copies of this source file may be used and
-- distributed without restriction.
--
-- This source file is free software; you can redistribute it
-- and/or modify it under the terms of the ARTISTIC License
-- as published by The Perl Foundation; either version 2.0 of
-- the License, or (at your option) any later version.
--
-- This source is distributed in the hope that it will be
-- useful, but WITHOUT ANY WARRANTY; without even the implied
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-- PURPOSE. See the Artistic License for details.
--
-- You should have received a copy of the license with this source.
-- If not download it from,
-- http://www.perlfoundation.org/artistic_license_2_0
--

use std.textio.all ;

package NamePkg is

type NamePType is protected
procedure Set (NameIn : String) ;
impure function Get return string ;
impure function IsSet return boolean ;
procedure Clear ; -- clear name
procedure Deallocate ; -- effectively alias to clear name
end protected NamePType ;

end package NamePkg ;
package body NamePkg is


type NamePType is protected body

variable NamePtr : line ;

------------------------------------------------------------
procedure Set (NameIn : String) is
------------------------------------------------------------
begin
deallocate(NamePtr) ;
NamePtr := new string'(NameIn) ;
end procedure Set ;

------------------------------------------------------------
impure function Get return string is
------------------------------------------------------------
begin
if NamePtr = NULL then
return "" ;
else
return NamePtr.all ;
end if ;
end function Get ;

------------------------------------------------------------
impure function IsSet return boolean is
------------------------------------------------------------
begin
return NamePtr /= NULL ;
end function IsSet ;

------------------------------------------------------------
procedure Clear is -- clear name
------------------------------------------------------------
begin
deallocate(NamePtr) ;
end procedure Clear ;

------------------------------------------------------------
procedure Deallocate is -- clear name
------------------------------------------------------------
begin
Clear ;
end procedure Deallocate ;

end protected body NamePType ;

end package body NamePkg ;
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ This is an **unofficial** repository of "Open Source VHDL Verification Methodolo
**Copyright:** Copyright © 2012-2015 by [SynthWorks Design Inc.](http://www.synthworks.com/)

## Release History
- 16.12.2014 - **2014.07a** OSVVM VHDL sources, CoveragePkg User’s Guide, RandomPkg User’s Guide, and release notes.<sup>1</sup>
- 22.01.2014 - **2014.01** Complete OS-VVM package containing VHDL sources and documentation.
- 25.05.2013 - **2013.05** Complete OS-VVM package containing VHDL sources, documentation <s>and sample designs</s><sup>2</sup>.

- 22.01.2014 - 2014.01 Complete OS-VVM package containing VHDL sources and documentation.
- 25.05.2013 - 2013.05 Complete OS-VVM package containing VHDL sources, documentation <s>and sample designs</s><sup>1</sup>.


<sup>1</sup> This repository does not contain the OS-VVM user guide and the example designs provided by [Aldec][aldec], due to the unknow license state of these files.
<sup>1</sup> Bugfix for release 2014.07: Fix memory leak in deallocate.
<sup>2</sup> This repository does not contain the OS-VVM user guide and the example designs provided by [Aldec][aldec], due to the unknow license state of these files.

------

Expand Down
Binary file modified RandomPkg_user_guide.pdf
Binary file not shown.
Binary file added osvvm_release_notes.pdf
Binary file not shown.

0 comments on commit 0042ec4

Please sign in to comment.