diff --git a/AlertLogPkg.vhd b/AlertLogPkg.vhd
new file mode 100644
index 0000000..e980095
--- /dev/null
+++ b/AlertLogPkg.vhd
@@ -0,0 +1,2192 @@
+--
+-- File Name: AlertLogPkg.vhd
+-- Design Unit Name: AlertLogPkg
+-- Revision: STANDARD VERSION, revision 2015.03
+--
+-- Maintainer: Jim Lewis email: jim@synthworks.com
+-- Contributor(s):
+-- Jim Lewis jim@synthworks.com
+--
+--
+-- Description:
+-- Alert handling and log filtering (verbosity control)
+-- Alert handling provides a method to count failures, errors, and warnings
+-- To accumlate counts, a data structure is created in a shared variable
+-- It is of type AlertLogStructPType which is defined in AlertLogBasePkg
+-- Log filtering provides verbosity control for logs (display or do not display)
+-- AlertLogPkg provides a simplified interface to the shared variable
+--
+--
+-- Developed for:
+-- SynthWorks Design Inc.
+-- VHDL Training Classes
+-- 11898 SW 128th Ave. Tigard, Or 97223
+-- http://www.SynthWorks.com
+--
+-- Revision History:
+-- Date Version Description
+-- 01/2015: 2015.01 Initial revision
+-- 02/2015 2015.03 Added: AlertIfEqual, AlertIfNotEqual, AlertIfDiff, PathTail,
+-- ReportNonZeroAlerts, ReadLogEnables
+--
+--
+-- Copyright (c) 2015 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 ;
+use work.OsvvmGlobalPkg.all ;
+use work.TranscriptPkg.all ;
+
+library IEEE ;
+use ieee.std_logic_1164.all ;
+use ieee.numeric_std.all ;
+
+package AlertLogPkg is
+
+ subtype AlertLogIDType is integer ;
+ type AlertType is (FAILURE, ERROR, WARNING) ; -- NEVER
+ subtype AlertIndexType is AlertType range FAILURE to WARNING ;
+ type AlertCountType is array (AlertIndexType) of integer ;
+ type AlertEnableType is array(AlertIndexType) of boolean ;
+ type LogType is (ALWAYS, DEBUG, FINAL, INFO) ; -- NEVER
+ subtype LogIndexType is LogType range DEBUG to INFO ;
+ type LogEnableType is array (LogIndexType) of boolean ;
+
+ constant ALERTLOG_BASE_ID : AlertLogIDType := 0 ;
+ constant ALERT_DEFAULT_ID : AlertLogIDType := 1 ;
+ constant LOG_DEFAULT_ID : AlertLogIDType := 1 ;
+ constant ALERTLOG_DEFAULT_ID : AlertLogIDType := ALERT_DEFAULT_ID ;
+ constant OSVVM_ALERTLOG_ID : AlertLogIDType := 2 ;
+ constant ALERTLOG_ID_NOT_FOUND : AlertLogIDType := -1 ; -- alternately integer'right
+ constant ALERTLOG_ID_NOT_ASSIGNED : AlertLogIDType := -1 ;
+ constant MIN_NUM_AL_IDS : AlertLogIDType := 32 ; -- Number IDs initially allocated
+
+ alias AlertLogOptionsType is work.OsvvmGlobalPkg.OsvvmOptionsType ;
+
+ ------------------------------------------------------------
+ -- Alert always goes to the transcript file
+ procedure Alert(
+ AlertLogID : AlertLogIDType ;
+ Message : string ;
+ Level : AlertType := ERROR
+ ) ;
+ procedure Alert( Message : string ; Level : AlertType := ERROR ) ;
+
+ ------------------------------------------------------------
+ -- Similar to assert, except condition is positive
+ procedure AlertIf( AlertLogID : AlertLogIDType ; condition : boolean ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIf( condition : boolean ; Message : string ; Level : AlertType := ERROR ) ;
+ impure function AlertIf( AlertLogID : AlertLogIDType ; condition : boolean ; Message : string ; Level : AlertType := ERROR ) return boolean ;
+ impure function AlertIf( condition : boolean ; Message : string ; Level : AlertType := ERROR ) return boolean ;
+
+ -- deprecated
+ procedure AlertIf( condition : boolean ; AlertLogID : AlertLogIDType ; Message : string ; Level : AlertType := ERROR ) ;
+ impure function AlertIf( condition : boolean ; AlertLogID : AlertLogIDType ; Message : string ; Level : AlertType := ERROR ) return boolean ;
+
+ ------------------------------------------------------------
+ -- Direct replacement for assert
+ procedure AlertIfNot( AlertLogID : AlertLogIDType ; condition : boolean ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNot( condition : boolean ; Message : string ; Level : AlertType := ERROR ) ;
+ impure function AlertIfNot( AlertLogID : AlertLogIDType ; condition : boolean ; Message : string ; Level : AlertType := ERROR ) return boolean ;
+ impure function AlertIfNot( condition : boolean ; Message : string ; Level : AlertType := ERROR ) return boolean ;
+
+ -- deprecated
+ procedure AlertIfNot( condition : boolean ; AlertLogID : AlertLogIDType ; Message : string ; Level : AlertType := ERROR ) ;
+ impure function AlertIfNot( condition : boolean ; AlertLogID : AlertLogIDType ; Message : string ; Level : AlertType := ERROR ) return boolean ;
+
+ ------------------------------------------------------------
+ -- overloading for common functionality
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : std_logic ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : std_logic_vector ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : unsigned ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : signed ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : integer ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : real ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : character ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : string ; Message : string ; Level : AlertType := ERROR ) ;
+
+ procedure AlertIfEqual( L, R : std_logic ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfEqual( L, R : std_logic_vector ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfEqual( L, R : unsigned ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfEqual( L, R : signed ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfEqual( L, R : integer ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfEqual( L, R : real ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfEqual( L, R : character ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfEqual( L, R : string ; Message : string ; Level : AlertType := ERROR ) ;
+
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : std_logic ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : std_logic_vector ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : unsigned ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : signed ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : integer ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : real ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : character ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : string ; Message : string ; Level : AlertType := ERROR ) ;
+
+ procedure AlertIfNotEqual( L, R : std_logic ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNotEqual( L, R : std_logic_vector ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNotEqual( L, R : unsigned ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNotEqual( L, R : signed ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNotEqual( L, R : integer ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNotEqual( L, R : real ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNotEqual( L, R : character ; Message : string ; Level : AlertType := ERROR ) ;
+ procedure AlertIfNotEqual( L, R : string ; Message : string ; Level : AlertType := ERROR ) ;
+ ------------------------------------------------------------
+ -- Simple Diff for file comparisons
+ procedure AlertIfDiff (AlertLogID : AlertLogIDType ; Name1, Name2 : string; Message : string := "" ; Level : AlertType := ERROR ) ;
+ procedure AlertIfDiff (Name1, Name2 : string; Message : string := "" ; Level : AlertType := ERROR ) ;
+ procedure AlertIfDiff (AlertLogID : AlertLogIDType ; file File1, File2 : text; Message : string := "" ; Level : AlertType := ERROR ) ;
+ procedure AlertIfDiff (file File1, File2 : text; Message : string := "" ; Level : AlertType := ERROR ) ;
+
+
+ ------------------------------------------------------------
+ procedure SetAlertLogJustify ;
+ procedure ReportAlerts ( Name : String ; AlertCount : AlertCountType ) ;
+ procedure ReportAlerts ( Name : string := OSVVM_STRING_INIT_PARM_DETECT ; AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID ; ExternalErrors : AlertCountType := (others => 0) ) ;
+ procedure ReportNonZeroAlerts ( Name : string := OSVVM_STRING_INIT_PARM_DETECT ; AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID ; ExternalErrors : AlertCountType := (others => 0) ) ;
+ procedure ClearAlerts ;
+ function "+" (L, R : AlertCountType) return AlertCountType ;
+ function "-" (L, R : AlertCountType) return AlertCountType ;
+ function "-" (R : AlertCountType) return AlertCountType ;
+ impure function SumAlertCount(AlertCount: AlertCountType) return integer ;
+ impure function GetAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return AlertCountType ;
+ impure function GetAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return integer ;
+ impure function GetEnabledAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return AlertCountType ;
+ impure function GetEnabledAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return integer ;
+ impure function GetDisabledAlertCount return AlertCountType ;
+ impure function GetDisabledAlertCount return integer ;
+ impure function GetDisabledAlertCount(AlertLogID: AlertLogIDType) return AlertCountType ;
+ impure function GetDisabledAlertCount(AlertLogID: AlertLogIDType) return integer ;
+
+ ------------------------------------------------------------
+ -- log filtering for verbosity control, optionally has a separate file parameter
+ procedure Log(
+ AlertLogID : AlertLogIDType ;
+ Message : string ;
+ Level : LogType := ALWAYS
+ ) ;
+ procedure Log( Message : string ; Level : LogType := ALWAYS) ;
+
+ impure function IsLoggingEnabled(AlertLogID : AlertLogIDType ; Level : LogType) return boolean ;
+ impure function IsLoggingEnabled(Level : LogType) return boolean ;
+
+
+ ------------------------------------------------------------
+ -- Accessor Methods
+ procedure SetAlertLogName(Name : string ) ;
+ procedure InitializeAlertLogStruct ;
+ procedure DeallocateAlertLogStruct ;
+ impure function FindAlertLogID(Name : string ) return AlertLogIDType ;
+ impure function FindAlertLogID(Name : string ; ParentID : AlertLogIDType) return AlertLogIDType ;
+ impure function GetAlertLogID(Name : string ; ParentID : AlertLogIDType := ALERTLOG_BASE_ID) return AlertLogIDType ;
+
+ ------------------------------------------------------------
+ -- Accessor Methods
+ procedure SetGlobalAlertEnable (A : boolean := TRUE) ;
+ impure function SetGlobalAlertEnable (A : boolean := TRUE) return boolean ;
+
+ procedure SetAlertStopCount(AlertLogID : AlertLogIDType ; Level : AlertType ; Count : integer) ;
+ procedure SetAlertStopCount(Level : AlertType ; Count : integer) ;
+
+ procedure SetAlertEnable(Level : AlertType ; Enable : boolean) ;
+ procedure SetAlertEnable(AlertLogID : AlertLogIDType ; Level : AlertType ; Enable : boolean ; DescendHierarchy : boolean := TRUE) ;
+
+ procedure SetLogEnable(Level : LogType ; Enable : boolean) ;
+ procedure SetLogEnable(AlertLogID : AlertLogIDType ; Level : LogType ; Enable : boolean ; DescendHierarchy : boolean := TRUE) ;
+
+ procedure ReportLogEnables ;
+ impure function GetAlertLogName(AlertLogID : AlertLogIDType) return string ;
+
+ ------------------------------------------------------------
+ procedure SetAlertLogOptions (
+ FailOnWarning : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ FailOnDisabledErrors : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ ReportHierarchy : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertLevel : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertName : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertTime : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogLevel : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogName : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogTime : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ AlertPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ LogPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ ReportPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ DoneName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
+ ) ;
+
+ -- Used by TextUtilPkg
+ impure function GetAlertReportPrefix return string ;
+ impure function GetAlertDoneName return string ;
+ impure function GetAlertPassName return string ;
+ impure function GetAlertFailName return string ;
+
+ -- File Reading Utilities
+ function IsLogEnableType (Name : String) return boolean ;
+ procedure ReadLogEnables (file AlertLogInitFile : text) ;
+ procedure ReadLogEnables (FileName : string) ;
+
+ -- String Helper Functions -- This should be in a more general string package
+ function PathTail (A : string) return string ;
+
+end AlertLogPkg ;
+
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+
+use work.NamePkg.all ;
+
+package body AlertLogPkg is
+
+ -- instead of justify(to_upper(to_string())), just look up the upper case, left justified values
+ type AlertNameType is array(AlertType) of string(1 to 7) ;
+ constant ALERT_NAME : AlertNameType := (WARNING => "WARNING", ERROR => "ERROR ", FAILURE => "FAILURE") ; -- , NEVER => "NEVER "
+ type LogNameType is array(LogType) of string(1 to 7) ;
+ constant LOG_NAME : LogNameType := (DEBUG => "DEBUG ", FINAL => "FINAL ", INFO => "INFO ", ALWAYS => "ALWAYS ") ; -- , NEVER => "NEVER "
+
+ -- Local
+ constant NUM_PREDEFINED_AL_IDS : AlertLogIDType := 2 ; -- Not including base
+
+
+ type AlertLogStructPType is protected
+
+ ------------------------------------------------------------
+ procedure alert (
+ ------------------------------------------------------------
+ AlertLogID : AlertLogIDType ;
+ message : string ;
+ level : AlertType := ERROR
+ ) ;
+
+ ------------------------------------------------------------
+ procedure SetJustify ;
+ procedure ReportAlerts ( Name : string ; AlertCount : AlertCountType ) ;
+ procedure ReportAlerts ( Name : string := OSVVM_STRING_INIT_PARM_DETECT ; AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID ; ExternalErrors : AlertCountType := (0,0,0) ; ReportAll : boolean := TRUE ) ;
+ procedure ClearAlerts ;
+ impure function GetAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return AlertCountType ;
+ impure function GetEnabledAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return AlertCountType ;
+ impure function GetDisabledAlertCount return AlertCountType ;
+ impure function GetDisabledAlertCount(AlertLogID: AlertLogIDType) return AlertCountType ;
+
+ ------------------------------------------------------------
+ procedure log (
+ ------------------------------------------------------------
+ AlertLogID : AlertLogIDType ;
+ Message : string ;
+ Level : LogType := ALWAYS
+ ) ;
+
+ ------------------------------------------------------------
+ -- FILE IO Controls
+-- procedure SetTranscriptEnable (A : boolean := TRUE) ;
+-- impure function IsTranscriptEnabled return boolean ;
+-- procedure MirrorTranscript (A : boolean := TRUE) ;
+-- impure function IsTranscriptMirrored return boolean ;
+
+ ------------------------------------------------------------
+ ------------------------------------------------------------
+ -- AlertLog Structure Creation and Interaction Methods
+
+ ------------------------------------------------------------
+ procedure SetAlertLogName(Name : string ) ;
+ procedure SetNumAlertLogIDs (NewNumAlertLogIDs : integer) ;
+ impure function FindAlertLogID(Name : string ) return AlertLogIDType ;
+ impure function FindAlertLogID(Name : string ; ParentID : AlertLogIDType) return AlertLogIDType ;
+ impure function GetAlertLogID(Name : string ; ParentID : AlertLogIDType) return AlertLogIDType ;
+ procedure Initialize(NewNumAlertLogIDs : integer := MIN_NUM_AL_IDS) ;
+ procedure Deallocate ;
+
+ ------------------------------------------------------------
+ ------------------------------------------------------------
+ -- Accessor Methods
+ ------------------------------------------------------------
+ procedure SetGlobalAlertEnable (A : boolean := TRUE) ;
+
+ procedure SetAlertStopCount(AlertLogID : AlertLogIDType ; Level : AlertType ; Count : integer) ;
+
+ procedure SetAlertEnable(Level : AlertType ; Enable : boolean) ;
+ procedure SetAlertEnable(AlertLogID : AlertLogIDType ; Level : AlertType ; Enable : boolean ; DescendHierarchy : boolean := TRUE) ;
+
+ procedure SetLogEnable(Level : LogType ; Enable : boolean) ;
+ procedure SetLogEnable(AlertLogID : AlertLogIDType ; Level : LogType ; Enable : boolean ; DescendHierarchy : boolean := TRUE) ;
+
+ impure function IsLoggingEnabled(AlertLogID : AlertLogIDType ; Level : LogType) return boolean ;
+
+ procedure ReportLogEnables ;
+ impure function GetAlertLogName(AlertLogID : AlertLogIDType) return string ;
+
+ ------------------------------------------------------------
+ -- Reporting Accessor
+ procedure SetAlertLogOptions (
+ FailOnWarning : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ FailOnDisabledErrors : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ ReportHierarchy : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertLevel : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertName : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertTime : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogLevel : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogName : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogTime : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ AlertPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ LogPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ ReportPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ DoneName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
+ ) ;
+
+ impure function GetAlertReportPrefix return string ;
+ impure function GetAlertDoneName return string ;
+ impure function GetAlertPassName return string ;
+ impure function GetAlertFailName return string ;
+
+ end protected AlertLogStructPType ;
+
+ --- ///////////////////////////////////////////////////////////////////////////
+
+ type AlertLogStructPType is protected body
+
+ variable GlobalAlertEnabled : boolean := TRUE ; -- Allows turn off and on
+-- variable TranscriptEnabled : boolean := FALSE ;
+-- variable TranscriptMirrored : boolean := FALSE ;
+
+ ------------------------------------------------------------
+ type AlertLogRecType is record
+ ------------------------------------------------------------
+ Name : Line ;
+ ParentID : AlertLogIDType ;
+ AlertCount : AlertCountType ;
+ AlertStopCount : AlertCountType ;
+ AlertEnabled : AlertEnableType ;
+ LogEnabled : LogEnableType ;
+ end record AlertLogRecType ;
+
+ ------------------------------------------------------------
+ -- Basis for AlertLog Data Structure
+ variable NumAlertLogIDs : AlertLogIDType := NUM_PREDEFINED_AL_IDS ; -- Initial number defined
+ variable NumAllocatedAlertLogIDs : AlertLogIDType := 0 ;
+ type AlertLogRecPtrType is access AlertLogRecType ;
+ type AlertLogArrayType is array (AlertLogIDType range <>) of AlertLogRecPtrType ;
+ type AlertLogArrayPtrType is access AlertLogArrayType ;
+ variable AlertLogPtr : AlertLogArrayPtrType ;
+
+ ------------------------------------------------------------
+ -- Report formatting settings, with defaults
+ variable FailOnWarningVar : boolean := TRUE ;
+ variable FailOnDisabledErrorsVar : boolean := TRUE ;
+ variable ReportHierarchyVar : boolean := TRUE ;
+ variable HierarchyInUseVar : boolean := FALSE ;
+
+ variable WriteAlertLevelVar : boolean := TRUE ;
+ variable WriteAlertNameVar : boolean := TRUE ;
+ variable WriteAlertTimeVar : boolean := TRUE ;
+ variable WriteLogLevelVar : boolean := TRUE ;
+ variable WriteLogNameVar : boolean := TRUE ;
+ variable WriteLogTimeVar : boolean := TRUE ;
+
+ variable AlertPrefixVar : NamePType ;
+ variable LogPrefixVar : NamePType ;
+ variable ReportPrefixVar : NamePType ;
+ variable DoneNameVar : NamePType ;
+ variable PassNameVar : NamePType ;
+ variable FailNameVar : NamePType ;
+
+ variable AlertLogJustifyAmountVar : integer := 0 ;
+ variable ReportJustifyAmountVar : integer := 0 ;
+
+ ------------------------------------------------------------
+ -- PT Local
+ impure function LeftJustify(A : String; Amount : integer) return string is
+ ------------------------------------------------------------
+ constant Spaces : string(1 to maximum(1, Amount)) := (others => ' ') ;
+ begin
+ if A'length >= Amount then
+ return A ;
+ else
+ return A & Spaces(1 to Amount - A'length) ;
+ end if ;
+ end function LeftJustify ;
+
+
+ ------------------------------------------------------------
+ -- PT Local
+ procedure IncrementAlertCount(
+ ------------------------------------------------------------
+ constant AlertLogID : in AlertLogIDType ;
+ constant Level : in AlertType ;
+ variable StopDueToCount : inout boolean
+ ) is
+ begin
+ -- Always Count at this level
+ AlertLogPtr(AlertLogID).AlertCount(Level) := AlertLogPtr(AlertLogID).AlertCount(Level) + 1 ;
+ -- Only do remaining actions if enabled
+ if AlertLogPtr(AlertLogID).AlertEnabled(Level) then
+ -- Exceeded Stop Count at this level?
+ if AlertLogPtr(AlertLogID).AlertCount(Level) >= AlertLogPtr(AlertLogID).AlertStopCount(Level) then
+ StopDueToCount := TRUE ;
+ end if ;
+ -- Propagate counts to parent(s) -- Ascend Hierarchy
+ if AlertLogID /= ALERTLOG_BASE_ID then
+ IncrementAlertCount(AlertLogPtr(AlertLogID).ParentID, Level, StopDueToCount) ;
+ end if ;
+ end if ;
+ end procedure IncrementAlertCount ;
+
+ ------------------------------------------------------------
+ procedure alert (
+ ------------------------------------------------------------
+ AlertLogID : AlertLogIDType ;
+ message : string ;
+ level : AlertType := ERROR
+ ) is
+ variable buf : Line ;
+ constant AlertPrefix : string := ResolveOsvvmOption(AlertPrefixVar.GetOpt, OSVVM_DEFAULT_ALERT_PREFIX) ;
+ variable StopDueToCount : boolean := FALSE ;
+ begin
+ if GlobalAlertEnabled then
+ -- do not write when disabled
+ if AlertLogPtr(AlertLogID).AlertEnabled(Level) then
+ write(buf, AlertPrefix) ;
+ if WriteAlertLevelVar then
+ -- write(buf, " " & to_string(Level) ) ;
+ write(buf, " " & ALERT_NAME(Level)) ; -- uses constant lookup
+ end if ;
+ if HierarchyInUseVar and WriteAlertNameVar then
+-- write(buf, " in " & justify(AlertLogPtr(AlertLogID).Name.all & ",", LEFT, AlertLogJustifyAmountVar) ) ;
+ write(buf, " in " & LeftJustify(AlertLogPtr(AlertLogID).Name.all & ",", AlertLogJustifyAmountVar) ) ;
+ end if ;
+ write(buf, " " & Message) ;
+ if WriteAlertTimeVar then
+ write(buf, " at " & to_string(NOW, 1 ns)) ;
+ end if ;
+ writeline(buf) ;
+ end if ;
+ -- Always Count
+ IncrementAlertCount(AlertLogID, Level, StopDueToCount) ;
+ if StopDueToCount then
+ write(buf, LF & AlertPrefix & " Stop Count on " & ALERT_NAME(Level) & " reached") ;
+ if HierarchyInUseVar then
+ write(buf, " in " & AlertLogPtr(AlertLogID).Name.all) ;
+ end if ;
+ write(buf, " at " & to_string(NOW, 1 ns) & " ") ;
+ writeline(buf) ;
+ ReportAlerts ;
+ std.env.stop(0) ;
+ end if ;
+ end if ;
+ end procedure alert ;
+
+ ------------------------------------------------------------
+ -- PT Local
+ impure function CalcJustify (AlertLogID : AlertLogIDType ; CurrentLength : integer ; IndentAmount : integer) return integer_vector is
+ ------------------------------------------------------------
+ variable ResultValues, LowerLevelValues : integer_vector(1 to 2) ; -- 1 = Max, 2 = Indented
+ begin
+ ResultValues(1) := CurrentLength + 1 ; -- AlertLogJustifyAmountVar
+ ResultValues(2) := CurrentLength + IndentAmount ; -- ReportJustifyAmountVar
+ for i in AlertLogID+1 to NumAlertLogIDs loop
+ if AlertLogID = AlertLogPtr(i).ParentID then
+ LowerLevelValues := CalcJustify(i, AlertLogPtr(i).Name'length, IndentAmount + 2) ;
+ ResultValues(1) := maximum(ResultValues(1), LowerLevelValues(1)) ;
+ ResultValues(2) := maximum(ResultValues(2), LowerLevelValues(2)) ;
+ end if ;
+ end loop ;
+ return ResultValues ;
+ end function CalcJustify ;
+
+ ------------------------------------------------------------
+ procedure SetJustify is
+ ------------------------------------------------------------
+ variable ResultValues : integer_vector(1 to 2) ; -- 1 = Max, 2 = Indented
+ begin
+ ResultValues := CalcJustify(ALERTLOG_BASE_ID, 0, 0) ;
+ AlertLogJustifyAmountVar := ResultValues(1) ;
+ ReportJustifyAmountVar := ResultValues(2) ;
+ end procedure SetJustify ;
+
+ ------------------------------------------------------------
+ -- PT Local
+ impure function GetEnabledAlertCount(AlertCount: AlertCountType; AlertEnabled : AlertEnableType) return AlertCountType is
+ ------------------------------------------------------------
+ variable Count : AlertCountType := (others => 0) ;
+ begin
+ if AlertEnabled(FAILURE) then
+ Count(FAILURE) := AlertCount(FAILURE) ;
+ end if ;
+ if AlertEnabled(ERROR) then
+ Count(ERROR) := AlertCount(ERROR) ;
+ end if ;
+ if FailOnWarningVar and AlertEnabled(WARNING) then
+ Count(WARNING) := AlertCount(WARNING) ;
+ end if ;
+ return Count ;
+ end function GetEnabledAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return AlertCountType is
+ ------------------------------------------------------------
+ variable AlertCount : AlertCountType ;
+ begin
+ return AlertLogPtr(AlertLogID).AlertCount ;
+ end function GetAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetEnabledAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return AlertCountType is
+ ------------------------------------------------------------
+ variable AlertCount : AlertCountType ;
+ begin
+ return GetEnabledAlertCount(AlertLogPtr(AlertLogID).AlertCount, AlertLogPtr(AlertLogID).AlertEnabled) ;
+ end function GetEnabledAlertCount ;
+
+ ------------------------------------------------------------
+ -- PT Local
+ impure function GetDisabledAlertCount(AlertCount: AlertCountType; AlertEnabled : AlertEnableType) return AlertCountType is
+ ------------------------------------------------------------
+ variable Count : AlertCountType := (others => 0) ;
+ begin
+ if not AlertEnabled(FAILURE) then
+ Count(FAILURE) := AlertCount(FAILURE) ;
+ end if ;
+ if not AlertEnabled(ERROR) then
+ Count(ERROR) := AlertCount(ERROR) ;
+ end if ;
+ if FailOnWarningVar and not AlertEnabled(WARNING) then
+ Count(WARNING) := AlertCount(WARNING) ;
+ end if ;
+ return Count ;
+ end function GetDisabledAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetDisabledAlertCount return AlertCountType is
+ ------------------------------------------------------------
+ variable Count : AlertCountType := (others => 0) ;
+ begin
+ for i in ALERTLOG_BASE_ID to NumAlertLogIDs loop
+ Count := Count + GetDisabledAlertCount(AlertLogPtr(i).AlertCount, AlertLogPtr(i).AlertEnabled) ;
+ end loop ;
+ return Count ;
+ end function GetDisabledAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetDisabledAlertCount(AlertLogID: AlertLogIDType) return AlertCountType is
+ ------------------------------------------------------------
+ variable Count : AlertCountType := (others => 0) ;
+ begin
+ Count := GetDisabledAlertCount(AlertLogPtr(AlertLogID).AlertCount, AlertLogPtr(AlertLogID).AlertEnabled) ;
+ for i in AlertLogID+1 to NumAlertLogIDs loop
+ if AlertLogID = AlertLogPtr(i).ParentID then
+ Count := Count + GetDisabledAlertCount(i) ;
+ end if ;
+ end loop ;
+ return Count ;
+ end function GetDisabledAlertCount ;
+
+ ------------------------------------------------------------
+ -- PT Local
+ procedure PrintTopAlerts (
+ ------------------------------------------------------------
+ NumErrors : integer ;
+ AlertCount : AlertCountType ;
+ Name : string ;
+ NumDisabledErrors : integer
+ ) is
+ constant ReportPrefix : string := ResolveOsvvmWritePrefix(ReportPrefixVar.GetOpt ) ;
+ constant DoneName : string := ResolveOsvvmDoneName(DoneNameVar.GetOpt ) ;
+ constant PassName : string := ResolveOsvvmPassName(PassNameVar.GetOpt ) ;
+ constant FailName : string := ResolveOsvvmFailName(FailNameVar.GetOpt ) ;
+ variable buf : line ;
+ begin
+ if NumErrors = 0 then
+ if NumDisabledErrors = 0 then
+ -- Passed
+ Write(buf, ReportPrefix & DoneName & " " & PassName & " " & Name &
+ " at " & to_string(NOW, 1 ns)) ;
+ WriteLine(buf) ;
+ else
+ -- Failed Due to Disabled Errors
+ Write(buf, ReportPrefix & DoneName & " " & FailName & " " & Name &
+ " Failed Due to Disabled Error(s) = " & to_string(NumDisabledErrors) &
+ " at " & to_string(NOW, 1 ns)) ;
+ WriteLine(buf) ;
+ end if ;
+ else
+ -- Failed
+ Write(buf, ReportPrefix & DoneName & " " & FailName & " "& Name &
+ " Total Error(s) = " & to_string(NumErrors) ) ;
+ write(buf, " Failures: " & to_string(AlertCount(FAILURE)) ) ;
+ write(buf, " Errors: " & to_string(AlertCount(ERROR) ) ) ;
+ write(buf, " Warnings: " & to_string(AlertCount(WARNING) ) ) ;
+ Write(buf, " at " & to_string(NOW, 1 ns)) ;
+ WriteLine(buf) ;
+ end if ;
+ end procedure PrintTopAlerts ;
+
+ ------------------------------------------------------------
+ -- PT Local
+ procedure PrintChild(
+ ------------------------------------------------------------
+ AlertLogID : AlertLogIDType ;
+ Prefix : string ;
+ IndentAmount : integer ;
+ ReportAll : boolean
+ ) is
+ variable buf : line ;
+ begin
+ for i in AlertLogID+1 to NumAlertLogIDs loop
+ if AlertLogID = AlertLogPtr(i).ParentID then
+ if ReportAll or SumAlertCount(AlertLogPtr(i).AlertCount) > 0 then
+ Write(buf, Prefix & " " & LeftJustify(AlertLogPtr(i).Name.all, ReportJustifyAmountVar - IndentAmount)) ;
+ write(buf, " Failures: " & to_string(AlertLogPtr(i).AlertCount(FAILURE) ) ) ;
+ write(buf, " Errors: " & to_string(AlertLogPtr(i).AlertCount(ERROR) ) ) ;
+ write(buf, " Warnings: " & to_string(AlertLogPtr(i).AlertCount(WARNING) ) ) ;
+ WriteLine(buf) ;
+ end if ;
+ PrintChild(
+ AlertLogID => i,
+ Prefix => Prefix & " ",
+ IndentAmount => IndentAmount + 2,
+ ReportAll => ReportAll
+ ) ;
+ end if ;
+ end loop ;
+ end procedure PrintChild ;
+
+ ------------------------------------------------------------
+ procedure ReportAlerts ( Name : string := OSVVM_STRING_INIT_PARM_DETECT ; AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID ; ExternalErrors : AlertCountType := (0,0,0) ; ReportAll : boolean := TRUE) is
+ ------------------------------------------------------------
+ variable NumErrors : integer ;
+ variable NumDisabledErrors : integer ;
+ constant ReportPrefix : string := ResolveOsvvmWritePrefix(ReportPrefixVar.GetOpt) ;
+ begin
+ if ReportJustifyAmountVar <= 0 then
+ SetJustify ;
+ end if ;
+ NumErrors := SumAlertCount(ExternalErrors) + SumAlertCount( GetEnabledAlertCount(AlertLogPtr(AlertLogID).AlertCount, AlertLogPtr(AlertLogID).AlertEnabled)) ;
+ if FailOnDisabledErrorsVar then
+ NumDisabledErrors := SumAlertCount( GetDisabledAlertCount(AlertLogID) ) ;
+ else
+ NumDisabledErrors := 0 ;
+ end if ;
+ if IsOsvvmStringSet(Name) then
+ PrintTopAlerts (
+ NumErrors => NumErrors,
+ AlertCount => AlertLogPtr(AlertLogID).AlertCount + ExternalErrors,
+ Name => Name,
+ NumDisabledErrors => NumDisabledErrors
+ ) ;
+ else
+ PrintTopAlerts (
+ NumErrors => NumErrors,
+ AlertCount => AlertLogPtr(AlertLogID).AlertCount + ExternalErrors,
+ Name => AlertLogPtr(AlertLogID).Name.all,
+ NumDisabledErrors => NumDisabledErrors
+ ) ;
+ end if ;
+ --Print Hierarchy when enabled and error or disabled error
+ if (HierarchyInUseVar and ReportHierarchyVar) and (NumErrors /= 0 or NumDisabledErrors /=0) then
+ PrintChild(
+ AlertLogID => AlertLogID,
+ Prefix => ReportPrefix & " ",
+ IndentAmount => 2,
+ ReportAll => ReportAll
+ ) ;
+ end if ;
+ end procedure ReportAlerts ;
+
+ ------------------------------------------------------------
+ procedure ReportAlerts ( Name : string ; AlertCount : AlertCountType ) is
+ ------------------------------------------------------------
+ begin
+ PrintTopAlerts (
+ NumErrors => SumAlertCount(AlertCount),
+ AlertCount => AlertCount,
+ Name => Name,
+ NumDisabledErrors => 0
+ ) ;
+ end procedure ReportAlerts ;
+
+ ------------------------------------------------------------
+ procedure ClearAlerts is
+ ------------------------------------------------------------
+ begin
+ AlertLogPtr(ALERTLOG_BASE_ID).AlertCount := (0, 0, 0) ;
+ AlertLogPtr(ALERTLOG_BASE_ID).AlertStopCount := (FAILURE => 0, ERROR => integer'right, WARNING => integer'right) ;
+
+ for i in ALERTLOG_BASE_ID + 1 to NumAlertLogIDs loop
+ AlertLogPtr(i).AlertCount := (0, 0, 0) ;
+ AlertLogPtr(i).AlertStopCount := (FAILURE => integer'right, ERROR => integer'right, WARNING => integer'right) ;
+ end loop ;
+ end procedure ClearAlerts ;
+
+ ------------------------------------------------------------
+ -- PT Local
+ procedure LocalLog (
+ ------------------------------------------------------------
+ AlertLogID : AlertLogIDType ;
+ Message : string ;
+ Level : LogType
+ ) is
+ variable buf : line ;
+ constant LogPrefix : string := ResolveOsvvmOption(LogPrefixVar.GetOpt, OSVVM_DEFAULT_LOG_PREFIX) ;
+ begin
+ write(buf, LogPrefix) ;
+ if WriteLogLevelVar then
+ write(buf, " " & LOG_NAME(Level) ) ;
+ end if ;
+ if HierarchyInUseVar and WriteLogNameVar then
+-- write(buf, " in " & justify(AlertLogPtr(AlertLogID).Name.all & ",", LEFT, AlertLogJustifyAmountVar) ) ;
+ write(buf, " in " & LeftJustify(AlertLogPtr(AlertLogID).Name.all & ",", AlertLogJustifyAmountVar) ) ;
+ end if ;
+ write(buf, " " & Message) ;
+ if WriteLogTimeVar then
+ write(buf, " at " & to_string(NOW, 1 ns)) ;
+ end if ;
+ writeline(buf) ;
+ end procedure LocalLog ;
+
+ ------------------------------------------------------------
+ procedure log (
+ ------------------------------------------------------------
+ AlertLogID : AlertLogIDType ;
+ Message : string ;
+ Level : LogType := ALWAYS
+ ) is
+ begin
+ if Level = ALWAYS then
+ LocalLog(AlertLogID, Message, Level) ;
+ elsif AlertLogPtr(AlertLogID).LogEnabled(Level) then
+ LocalLog(AlertLogID, Message, Level) ;
+ end if ;
+ end procedure log ;
+
+ ------------------------------------------------------------
+ ------------------------------------------------------------
+ -- AlertLog Structure Creation and Interaction Methods
+
+ ------------------------------------------------------------
+ procedure SetAlertLogName(Name : string ) is
+ ------------------------------------------------------------
+ begin
+ Deallocate(AlertLogPtr(ALERTLOG_BASE_ID).Name) ;
+ AlertLogPtr(ALERTLOG_BASE_ID).Name := new string'(Name) ;
+ end procedure SetAlertLogName ;
+
+ ------------------------------------------------------------
+ -- PT Local
+ procedure NewAlertLogRec(AlertLogID : AlertLogIDType ; Name : string ; ParentID : AlertLogIDType) is
+ ------------------------------------------------------------
+ variable AlertEnabled : AlertEnableType ;
+ variable AlertStopCount : AlertCountType ;
+ variable LogEnabled : LogEnableType ;
+ begin
+ if AlertLogID = ALERTLOG_BASE_ID then
+ AlertEnabled := (TRUE, TRUE, TRUE) ;
+ LogEnabled := (FALSE, FALSE, FALSE) ;
+ AlertStopCount := (FAILURE => 0, ERROR => integer'right, WARNING => integer'right) ;
+ else
+ if ParentID < ALERTLOG_BASE_ID then
+ AlertEnabled := AlertLogPtr(ALERTLOG_BASE_ID).AlertEnabled ;
+ LogEnabled := AlertLogPtr(ALERTLOG_BASE_ID).LogEnabled ;
+ else
+ AlertEnabled := AlertLogPtr(ParentID).AlertEnabled ;
+ LogEnabled := AlertLogPtr(ParentID).LogEnabled ;
+ end if ;
+ AlertStopCount := (FAILURE => integer'right, ERROR => integer'right, WARNING => integer'right) ;
+ end if ;
+ AlertLogPtr(AlertLogID) := new AlertLogRecType'(
+ Name => new string'(NAME),
+ ParentID => ParentID,
+ AlertCount => (0, 0, 0),
+ AlertEnabled => AlertEnabled,
+ AlertStopCount => AlertStopCount,
+ LogEnabled => LogEnabled
+ ) ;
+ end procedure NewAlertLogRec ;
+
+ ------------------------------------------------------------
+ -- Construct initial data structure
+ procedure Initialize(NewNumAlertLogIDs : integer := MIN_NUM_AL_IDS) is
+ ------------------------------------------------------------
+ begin
+ if NumAllocatedAlertLogIDs /= 0 then
+ Alert(ALERT_DEFAULT_ID, "AlertLogPkg: Initialize, data structure already initialized", FAILURE) ;
+ return ;
+ end if ;
+ -- Initialize Pointer
+ AlertLogPtr := new AlertLogArrayType(ALERTLOG_BASE_ID to NewNumAlertLogIDs) ;
+ NumAllocatedAlertLogIDs := NewNumAlertLogIDs ;
+ NumAlertLogIDs := NUM_PREDEFINED_AL_IDS ;
+ -- Create BASE AlertLogID (if it differs from DEFAULT
+ if ALERTLOG_BASE_ID /= ALERT_DEFAULT_ID then
+ NewAlertLogRec(ALERTLOG_BASE_ID, "AlertLogTop", ALERTLOG_BASE_ID) ;
+ end if ;
+ -- Create DEFAULT AlertLogID
+ NewAlertLogRec(ALERT_DEFAULT_ID, "Default", ALERTLOG_BASE_ID) ;
+ -- Create OSVVM AlertLogID (if it differs from DEFAULT
+ if OSVVM_ALERTLOG_ID /= ALERT_DEFAULT_ID then
+ NewAlertLogRec(OSVVM_ALERTLOG_ID, "OSVVM", ALERTLOG_BASE_ID) ;
+ end if ;
+ end procedure Initialize ;
+
+ ------------------------------------------------------------
+ -- PT Local
+ -- Constructs initial data structure using constant below
+ impure function Initialize return boolean is
+ ------------------------------------------------------------
+ begin
+ Initialize(MIN_NUM_AL_IDS) ;
+ return TRUE ;
+ end function Initialize ;
+
+ constant CONSTRUCT_ALERT_DATA_STRUCTURE : boolean := Initialize ;
+
+ ------------------------------------------------------------
+ procedure Deallocate is
+ ------------------------------------------------------------
+ begin
+ for i in ALERTLOG_BASE_ID to NumAlertLogIDs loop
+ Deallocate(AlertLogPtr(i).Name) ;
+ Deallocate(AlertLogPtr(i)) ;
+ end loop ;
+ deallocate(AlertLogPtr) ;
+ -- Free up space used by protected types within AlertLogPkg
+ AlertPrefixVar.Deallocate ;
+ LogPrefixVar.Deallocate ;
+ ReportPrefixVar.Deallocate ;
+ DoneNameVar.Deallocate ;
+ PassNameVar.Deallocate ;
+ FailNameVar.Deallocate ;
+ -- Restore variables to their initial state
+ NumAlertLogIDs := 0 ;
+ NumAllocatedAlertLogIDs := 0 ;
+ GlobalAlertEnabled := TRUE ; -- Allows turn off and on
+ FailOnWarningVar := TRUE ;
+ FailOnDisabledErrorsVar := TRUE ;
+ ReportHierarchyVar := TRUE ;
+ HierarchyInUseVar := FALSE ;
+ WriteAlertLevelVar := TRUE ;
+ WriteAlertNameVar := TRUE ;
+ WriteAlertTimeVar := TRUE ;
+ WriteLogLevelVar := TRUE ;
+ WriteLogNameVar := TRUE ;
+ WriteLogTimeVar := TRUE ;
+ end procedure Deallocate ;
+
+ ------------------------------------------------------------
+ -- PT Local.
+ procedure GrowAlertStructure (NewNumAlertLogIDs : integer) is
+ ------------------------------------------------------------
+ variable oldAlertLogPtr : AlertLogArrayPtrType ;
+ begin
+ if NumAllocatedAlertLogIDs = 0 then
+ Initialize (NewNumAlertLogIDs) ; -- Construct initial structure
+ else
+ oldAlertLogPtr := AlertLogPtr ;
+ AlertLogPtr := new AlertLogArrayType(ALERTLOG_BASE_ID to NewNumAlertLogIDs) ;
+ AlertLogPtr(ALERTLOG_BASE_ID to NumAlertLogIDs) := oldAlertLogPtr(ALERTLOG_BASE_ID to NumAlertLogIDs) ;
+ deallocate(oldAlertLogPtr) ;
+ end if ;
+ NumAllocatedAlertLogIDs := NewNumAlertLogIDs ;
+ end procedure GrowAlertStructure ;
+
+ ------------------------------------------------------------
+ -- Sets a AlertLogPtr to a particular size
+ -- Use for small bins to save space or large bins to
+ -- suppress the resize and copy as a CovBin autosizes.
+ procedure SetNumAlertLogIDs (NewNumAlertLogIDs : integer) is
+ ------------------------------------------------------------
+ variable oldAlertLogPtr : AlertLogArrayPtrType ;
+ begin
+ if NewNumAlertLogIDs > NumAllocatedAlertLogIDs then
+ GrowAlertStructure(NewNumAlertLogIDs) ;
+ end if;
+ end procedure SetNumAlertLogIDs ;
+
+ ------------------------------------------------------------
+ -- PT Local
+ impure function GetNextAlertLogID return AlertLogIDType is
+ ------------------------------------------------------------
+ variable NormNumAlertLogIDs : AlertLogIDType ;
+ begin
+ NumAlertLogIDs := NumAlertLogIDs + 1 ;
+ if NumAlertLogIDs > NumAllocatedAlertLogIDs then
+ GrowAlertStructure(NumAllocatedAlertLogIDs + MIN_NUM_AL_IDS) ;
+ end if ;
+ return NumAlertLogIDs ;
+ end function GetNextAlertLogID ;
+
+ ------------------------------------------------------------
+ impure function FindAlertLogID(Name : string ) return AlertLogIDType is
+ ------------------------------------------------------------
+ begin
+ for i in ALERTLOG_BASE_ID to NumAlertLogIDs loop
+ if Name = AlertLogPtr(i).Name.all then
+ return i ;
+ end if ;
+ end loop ;
+ return ALERTLOG_ID_NOT_FOUND ; -- not found
+ end function FindAlertLogID ;
+
+ ------------------------------------------------------------
+ impure function FindAlertLogID(Name : string ; ParentID : AlertLogIDType) return AlertLogIDType is
+ ------------------------------------------------------------
+ variable CurParentID : AlertLogIDType ;
+ begin
+ for i in ALERTLOG_BASE_ID to NumAlertLogIDs loop
+ CurParentID := AlertLogPtr(i).ParentID ;
+ if Name = AlertLogPtr(i).Name.all and
+ (CurParentID = ParentID or CurParentID = ALERTLOG_ID_NOT_ASSIGNED or ParentID = ALERTLOG_ID_NOT_ASSIGNED)
+ then
+ return i ;
+ end if ;
+ end loop ;
+ return ALERTLOG_ID_NOT_FOUND ; -- not found
+ end function FindAlertLogID ;
+
+ ------------------------------------------------------------
+ impure function GetAlertLogID(Name : string ; ParentID : AlertLogIDType) return AlertLogIDType is
+ ------------------------------------------------------------
+ variable ResultID : AlertLogIDType ;
+ begin
+ ResultID := FindAlertLogID(Name, ParentID) ;
+ if ResultID /= ALERTLOG_ID_NOT_FOUND then
+ -- found it, set ParentID
+ if AlertLogPtr(ResultID).ParentID = ALERTLOG_ID_NOT_ASSIGNED then
+ AlertLogPtr(ResultID).ParentID := ParentID ;
+ -- else -- do not update as ParentIDs are either same or input ParentID = ALERTLOG_ID_NOT_ASSIGNED
+ end if ;
+ else
+ ResultID := GetNextAlertLogID ;
+ NewAlertLogRec(ResultID, Name, ParentID) ;
+ HierarchyInUseVar := TRUE ;
+ end if ;
+ return ResultID ;
+ end function GetAlertLogID ;
+
+ ------------------------------------------------------------
+ ------------------------------------------------------------
+ -- Accessor Methods
+ ------------------------------------------------------------
+
+ ------------------------------------------------------------
+ procedure SetGlobalAlertEnable (A : boolean := TRUE) is
+ ------------------------------------------------------------
+ begin
+ GlobalAlertEnabled := A ;
+ end procedure SetGlobalAlertEnable ;
+
+ ------------------------------------------------------------
+ -- PT LOCAL
+ procedure SetOneStopCount(
+ ------------------------------------------------------------
+ AlertLogID : AlertLogIDType ;
+ Level : AlertType ;
+ Count : integer
+ ) is
+ begin
+ if AlertLogPtr(AlertLogID).AlertStopCount(Level) = integer'right then
+ AlertLogPtr(AlertLogID).AlertStopCount(Level) := Count ;
+ else
+ AlertLogPtr(AlertLogID).AlertStopCount(Level) :=
+ AlertLogPtr(AlertLogID).AlertStopCount(Level) + Count ;
+ end if ;
+ end procedure SetOneStopCount ;
+
+ ------------------------------------------------------------
+ procedure SetAlertStopCount(AlertLogID : AlertLogIDType ; Level : AlertType ; Count : integer) is
+ ------------------------------------------------------------
+ begin
+ SetOneStopCount(AlertLogID, Level, Count) ;
+ if AlertLogID /= ALERTLOG_BASE_ID then
+ SetAlertStopCount(AlertLogPtr(AlertLogID).ParentID, Level, Count) ;
+ end if ;
+ end procedure SetAlertStopCount ;
+
+ ------------------------------------------------------------
+ procedure SetAlertEnable(Level : AlertType ; Enable : boolean) is
+ ------------------------------------------------------------
+ begin
+ for i in ALERTLOG_BASE_ID to NumAlertLogIDs loop
+ AlertLogPtr(i).AlertEnabled(Level) := Enable ;
+ end loop ;
+ end procedure SetAlertEnable ;
+
+ ------------------------------------------------------------
+ procedure SetAlertEnable(AlertLogID : AlertLogIDType ; Level : AlertType ; Enable : boolean ; DescendHierarchy : boolean := TRUE) is
+ ------------------------------------------------------------
+ begin
+ AlertLogPtr(AlertLogID).AlertEnabled(Level) := Enable ;
+ if DescendHierarchy then
+ for i in AlertLogID+1 to NumAlertLogIDs loop
+ if AlertLogID = AlertLogPtr(i).ParentID then
+ SetAlertEnable(i, Level, Enable, DescendHierarchy) ;
+ end if ;
+ end loop ;
+ end if ;
+ end procedure SetAlertEnable ;
+
+ ------------------------------------------------------------
+ procedure SetLogEnable(Level : LogType ; Enable : boolean) is
+ ------------------------------------------------------------
+ begin
+ for i in ALERTLOG_BASE_ID to NumAlertLogIDs loop
+ AlertLogPtr(i).LogEnabled(Level) := Enable ;
+ end loop ;
+ end procedure SetLogEnable ;
+
+ ------------------------------------------------------------
+ procedure SetLogEnable(AlertLogID : AlertLogIDType ; Level : LogType ; Enable : boolean ; DescendHierarchy : boolean := TRUE) is
+ ------------------------------------------------------------
+ begin
+ AlertLogPtr(AlertLogID).LogEnabled(Level) := Enable ;
+ if DescendHierarchy then
+ for i in AlertLogID+1 to NumAlertLogIDs loop
+ if AlertLogID = AlertLogPtr(i).ParentID then
+ SetLogEnable(i, Level, Enable, DescendHierarchy) ;
+ end if ;
+ end loop ;
+ end if ;
+ end procedure SetLogEnable ;
+
+ ------------------------------------------------------------
+ impure function IsLoggingEnabled(AlertLogID : AlertLogIDType ; Level : LogType) return boolean is
+ ------------------------------------------------------------
+ begin
+ if Level = ALWAYS then
+ return TRUE ;
+ else
+ return AlertLogPtr(AlertLogID).LogEnabled(Level) ;
+ end if ;
+ end function IsLoggingEnabled ;
+
+ ------------------------------------------------------------
+ -- PT Local
+ procedure PrintLogLevels(
+ ------------------------------------------------------------
+ AlertLogID : AlertLogIDType ;
+ Prefix : string ;
+ IndentAmount : integer
+ ) is
+ variable buf : line ;
+ begin
+ write(buf, Prefix & " " & LeftJustify(AlertLogPtr(AlertLogID).Name.all, ReportJustifyAmountVar - IndentAmount)) ;
+ for i in LogIndexType loop
+ if AlertLogPtr(AlertLogID).LogEnabled(i) then
+-- write(buf, " " & to_string(AlertLogPtr(AlertLogID).LogEnabled(i)) ) ;
+ write(buf, " " & to_string(i)) ;
+ end if ;
+ end loop ;
+ WriteLine(buf) ;
+ for i in AlertLogID+1 to NumAlertLogIDs loop
+ if AlertLogID = AlertLogPtr(i).ParentID then
+ PrintLogLevels(
+ AlertLogID => i,
+ Prefix => Prefix & " ",
+ IndentAmount => IndentAmount + 2
+ ) ;
+ end if ;
+ end loop ;
+ end procedure PrintLogLevels ;
+
+ ------------------------------------------------------------
+ procedure ReportLogEnables is
+ ------------------------------------------------------------
+ begin
+ if ReportJustifyAmountVar <= 0 then
+ SetJustify ;
+ end if ;
+ PrintLogLevels(ALERTLOG_BASE_ID, "", 0) ;
+ end procedure ReportLogEnables ;
+
+ ------------------------------------------------------------
+ impure function GetAlertLogName(AlertLogID : AlertLogIDType) return string is
+ ------------------------------------------------------------
+ begin
+ return AlertLogPtr(AlertLogID).Name.all ;
+ end function GetAlertLogName ;
+
+ ------------------------------------------------------------
+ procedure SetAlertLogOptions (
+ ------------------------------------------------------------
+ FailOnWarning : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ FailOnDisabledErrors : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ ReportHierarchy : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertLevel : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertName : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertTime : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogLevel : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogName : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogTime : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ AlertPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ LogPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ ReportPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ DoneName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
+ ) is
+ begin
+ if FailOnWarning /= OPT_INIT_PARM_DETECT then
+ FailOnWarningVar := IsEnabled(FailOnWarning) ;
+ end if ;
+ if FailOnDisabledErrors /= OPT_INIT_PARM_DETECT then
+ FailOnDisabledErrorsVar := IsEnabled(FailOnDisabledErrors) ;
+ end if ;
+ if ReportHierarchy /= OPT_INIT_PARM_DETECT then
+ ReportHierarchyVar := IsEnabled(ReportHierarchy) ;
+ end if ;
+ if WriteAlertLevel /= OPT_INIT_PARM_DETECT then
+ WriteAlertLevelVar := IsEnabled(WriteAlertLevel) ;
+ end if ;
+ if WriteAlertName /= OPT_INIT_PARM_DETECT then
+ WriteAlertNameVar := IsEnabled(WriteAlertName) ;
+ end if ;
+ if WriteAlertTime /= OPT_INIT_PARM_DETECT then
+ WriteAlertTimeVar := IsEnabled(WriteAlertTime) ;
+ end if ;
+ if WriteLogLevel /= OPT_INIT_PARM_DETECT then
+ WriteLogLevelVar := IsEnabled(WriteLogLevel) ;
+ end if ;
+ if WriteLogName /= OPT_INIT_PARM_DETECT then
+ WriteLogNameVar := IsEnabled(WriteLogName) ;
+ end if ;
+ if WriteLogTime /= OPT_INIT_PARM_DETECT then
+ WriteLogTimeVar := IsEnabled(WriteLogTime) ;
+ end if ;
+ if AlertPrefix /= OSVVM_STRING_INIT_PARM_DETECT then
+ AlertPrefixVar.Set(AlertPrefix) ;
+ end if ;
+ if LogPrefix /= OSVVM_STRING_INIT_PARM_DETECT then
+ LogPrefixVar.Set(LogPrefix) ;
+ end if ;
+ if ReportPrefix /= OSVVM_STRING_INIT_PARM_DETECT then
+ ReportPrefixVar.Set(ReportPrefix) ;
+ end if ;
+ if DoneName /= OSVVM_STRING_INIT_PARM_DETECT then
+ DoneNameVar.Set(DoneName) ;
+ end if ;
+ if PassName /= OSVVM_STRING_INIT_PARM_DETECT then
+ PassNameVar.Set(PassName) ;
+ end if ;
+ if FailName /= OSVVM_STRING_INIT_PARM_DETECT then
+ FailNameVar.Set(FailName) ;
+ end if ;
+ end procedure SetAlertLogOptions ;
+
+ ------------------------------------------------------------
+ impure function GetAlertReportPrefix return string is
+ ------------------------------------------------------------
+ begin
+ return ResolveOsvvmWritePrefix(ReportPrefixVar.GetOpt) ;
+ end function GetAlertReportPrefix ;
+
+ ------------------------------------------------------------
+ impure function GetAlertDoneName return string is
+ ------------------------------------------------------------
+ begin
+ return ResolveOsvvmDoneName(DoneNameVar.GetOpt) ;
+ end function GetAlertDoneName ;
+
+ ------------------------------------------------------------
+ impure function GetAlertPassName return string is
+ ------------------------------------------------------------
+ begin
+ return ResolveOsvvmPassName(PassNameVar.GetOpt) ;
+ end function GetAlertPassName ;
+
+ ------------------------------------------------------------
+ impure function GetAlertFailName return string is
+ ------------------------------------------------------------
+ begin
+ return ResolveOsvvmFailName(FailNameVar.GetOpt) ;
+ end function GetAlertFailName ;
+
+ end protected body AlertLogStructPType ;
+
+
+
+ shared variable AlertLogStruct : AlertLogStructPType ;
+
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+
+ ------------------------------------------------------------
+ -- package local
+ procedure EmptyOrCommentLine (
+ -- Better as Function, but not supported in VHDL functions
+ ------------------------------------------------------------
+ variable L : InOut line ;
+ variable Empty : out boolean
+ ) is
+ variable Valid : boolean ;
+ variable Char : character ;
+ constant NBSP : CHARACTER := CHARACTER'val(160); -- space character
+ begin
+ Empty := TRUE ;
+
+ -- if line empty (null or 0 length), Empty = TRUE
+ if L = null or L.all'length = 0 then
+ return ;
+ end if ;
+
+ -- if line starts with '#', empty = TRUE
+ if L.all(1) = '#' then
+ return ;
+ end if ;
+
+ -- if line starts with '--', empty = TRUE
+ if L.all'length >= 2 and L.all(1) = '-' and L.all(2) = '-' then
+ return ;
+ end if ;
+
+ -- Otherwise, remove white space and check for end of line
+ -- Code borrowed from David Bishop, skip_whitespace
+ WhiteSpLoop : while L /= null and L.all'length > 0 loop
+ if (L.all(1) = ' ' or L.all(1) = NBSP or L.all(1) = HT) then
+ read (L, Char, Valid) ;
+ else
+ Empty := FALSE ;
+ exit WhiteSpLoop ;
+ end if ;
+ end loop WhiteSpLoop ;
+ end procedure EmptyOrCommentLine ;
+
+ ------------------------------------------------------------
+ procedure Alert(
+ ------------------------------------------------------------
+ AlertLogID : AlertLogIDType ;
+ Message : string ;
+ Level : AlertType := ERROR
+ ) is
+ begin
+ AlertLogStruct.Alert(AlertLogID, Message, Level) ;
+ end procedure alert ;
+
+ ------------------------------------------------------------
+ procedure Alert( Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID , Message, Level) ;
+ end procedure alert ;
+
+ ------------------------------------------------------------
+ procedure AlertIf( AlertLogID : AlertLogIDType ; condition : boolean ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if condition then
+ AlertLogStruct.Alert(AlertLogID , Message, Level) ;
+ end if ;
+ end procedure AlertIf ;
+
+ ------------------------------------------------------------
+ -- deprecated
+ procedure AlertIf( condition : boolean ; AlertLogID : AlertLogIDType ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ AlertIf( AlertLogID, condition, Message, Level) ;
+ end procedure AlertIf ;
+
+ ------------------------------------------------------------
+ procedure AlertIf( condition : boolean ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if condition then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID , Message, Level) ;
+ end if ;
+ end procedure AlertIf ;
+
+ ------------------------------------------------------------
+ -- useful with exit conditions in a loop: exit when alert( not ReadValid, failure, "Read Failed") ;
+ impure function AlertIf( AlertLogID : AlertLogIDType ; condition : boolean ; Message : string ; Level : AlertType := ERROR ) return boolean is
+ ------------------------------------------------------------
+ begin
+ if condition then
+ AlertLogStruct.Alert(AlertLogID , Message, Level) ;
+ end if ;
+ return condition ;
+ end function AlertIf ;
+
+ ------------------------------------------------------------
+ -- deprecated
+ impure function AlertIf( condition : boolean ; AlertLogID : AlertLogIDType ; Message : string ; Level : AlertType := ERROR ) return boolean is
+ ------------------------------------------------------------
+ begin
+ return AlertIf( AlertLogID, condition, Message, Level) ;
+ end function AlertIf ;
+
+ ------------------------------------------------------------
+ impure function AlertIf( condition : boolean ; Message : string ; Level : AlertType := ERROR ) return boolean is
+ ------------------------------------------------------------
+ begin
+ if condition then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message, Level) ;
+ end if ;
+ return condition ;
+ end function AlertIf ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNot( AlertLogID : AlertLogIDType ; condition : boolean ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if not condition then
+ AlertLogStruct.Alert(AlertLogID, Message, Level) ;
+ end if ;
+ end procedure AlertIfNot ;
+
+ ------------------------------------------------------------
+ -- deprecated
+ procedure AlertIfNot( condition : boolean ; AlertLogID : AlertLogIDType ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ AlertIfNot( AlertLogID, condition, Message, Level) ;
+ end procedure AlertIfNot ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNot( condition : boolean ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if not condition then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message, Level) ;
+ end if ;
+ end procedure AlertIfNot ;
+
+ ------------------------------------------------------------
+ -- useful with exit conditions in a loop: exit when alert( not ReadValid, failure, "Read Failed") ;
+ impure function AlertIfNot( AlertLogID : AlertLogIDType ; condition : boolean ; Message : string ; Level : AlertType := ERROR ) return boolean is
+ ------------------------------------------------------------
+ begin
+ if not condition then
+ AlertLogStruct.Alert(AlertLogID, Message, Level) ;
+ end if ;
+ return not condition ;
+ end function AlertIfNot ;
+
+ ------------------------------------------------------------
+ -- deprecated
+ impure function AlertIfNot( condition : boolean ; AlertLogID : AlertLogIDType ; Message : string ; Level : AlertType := ERROR ) return boolean is
+ ------------------------------------------------------------
+ begin
+ return AlertIfNot( AlertLogID, condition, Message, Level) ;
+ end function AlertIfNot ;
+
+ ------------------------------------------------------------
+ impure function AlertIfNot( condition : boolean ; Message : string ; Level : AlertType := ERROR ) return boolean is
+ ------------------------------------------------------------
+ begin
+ if not condition then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message, Level) ;
+ end if ;
+ return not condition ;
+ end function AlertIfNot ;
+
+ -- With AlertLogID
+ ------------------------------------------------------------
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : std_logic ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?= R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L = R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : std_logic_vector ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?= R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L = R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : unsigned ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?= R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L = R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : signed ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?= R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L = R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : integer ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L = R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L = R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : real ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L = R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L = R, L = " & to_string(L, 4) & " R = " & to_string(R, 4), Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : character ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L = R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L = R, L = " & L & " R = " & R, Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfEqual( AlertLogID : AlertLogIDType ; L, R : string ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L = R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L = R, L = " & L & " R = " & R, Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ -- Without AlertLogID
+ ------------------------------------------------------------
+ procedure AlertIfEqual( L, R : std_logic ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?= R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L = R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfEqual( L, R : std_logic_vector ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?= R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L = R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfEqual( L, R : unsigned ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?= R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L = R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfEqual( L, R : signed ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?= R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L = R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfEqual( L, R : integer ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L = R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L = R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfEqual( L, R : real ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L = R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L = R, L = " & to_string(L, 4) & " R = " & to_string(R, 4), Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfEqual( L, R : character ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L = R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L = R, L = " & L & " R = " & R, Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfEqual( L, R : string ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L = R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L = R, L = " & L & " R = " & R, Level) ;
+ end if ;
+ end procedure AlertIfEqual ;
+
+ -- With AlertLogID
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : std_logic ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?/= R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L /= R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : std_logic_vector ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?/= R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L /= R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : unsigned ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?/= R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L /= R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : signed ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?/= R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L /= R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : integer ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L /= R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L /= R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : real ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L /= R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L /= R, L = " & to_string(L, 4) & " R = " & to_string(R, 4), Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : character ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L /= R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L /= R, L = " & L & " R = " & R, Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( AlertLogID : AlertLogIDType ; L, R : string ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L /= R then
+ AlertLogStruct.Alert(AlertLogID, Message & " L /= R, L = " & L & " R = " & R, Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ -- Without AlertLogID
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( L, R : std_logic ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?/= R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L /= R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( L, R : std_logic_vector ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?/= R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L /= R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( L, R : unsigned ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?/= R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L /= R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( L, R : signed ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L ?/= R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L /= R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( L, R : integer ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L /= R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L /= R, L = " & to_string(L) & " R = " & to_string(R), Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( L, R : real ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L /= R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L /= R, L = " & to_string(L, 4) & " R = " & to_string(R, 4), Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( L, R : character ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L /= R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L /= R, L = " & L & " R = " & R, Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNotEqual( L, R : string ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if L /= R then
+ AlertLogStruct.Alert(ALERT_DEFAULT_ID, Message & " L /= R, L = " & L & " R = " & R, Level) ;
+ end if ;
+ end procedure AlertIfNotEqual ;
+
+ ------------------------------------------------------------
+ procedure AlertIfDiff (AlertLogID : AlertLogIDType ; Name1, Name2 : string; Message : string := "" ; Level : AlertType := ERROR ) is
+ -- Open files and call AlertIfDiff[text, ...]
+ ------------------------------------------------------------
+ file FileID1, FileID2 : text ;
+ variable status1, status2 : file_open_status ;
+ begin
+ file_open(status1, FileID1, Name1, READ_MODE) ;
+ file_open(status2, FileID2, Name2, READ_MODE) ;
+ if status1 = OPEN_OK and status2 = OPEN_OK then
+ AlertIfDiff (AlertLogID, FileID1, FileID2, Message, Level) ;
+ else
+ if status1 /= OPEN_OK then
+ AlertLogStruct.Alert(AlertLogID , Message & " File, " & Name1 & ", did not open", Level) ;
+ end if ;
+ if status2 /= OPEN_OK then
+ AlertLogStruct.Alert(AlertLogID , Message & " File, " & Name2 & ", did not open", Level) ;
+ end if ;
+ end if;
+ end procedure AlertIfDiff ;
+
+ ------------------------------------------------------------
+ procedure AlertIfDiff (Name1, Name2 : string; Message : string := "" ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ AlertIfDiff (ALERT_DEFAULT_ID, Name1, Name2, Message, Level) ;
+ end procedure AlertIfDiff ;
+
+ ------------------------------------------------------------
+ procedure AlertIfDiff (AlertLogID : AlertLogIDType ; file File1, File2 : text; Message : string := "" ; Level : AlertType := ERROR ) is
+ -- Simple diff.
+ ------------------------------------------------------------
+ variable Buf1, Buf2 : line ;
+ variable File1Done, File2Done : boolean ;
+ variable LineCount : integer := 0 ;
+ begin
+ ReadLoop : loop
+ File1Done := EndFile(File1) ;
+ File2Done := EndFile(File2) ;
+ exit ReadLoop when File1Done or File2Done ;
+
+ ReadLine(File1, Buf1) ;
+ ReadLine(File2, Buf2) ;
+ LineCount := LineCount + 1 ;
+
+ if Buf1.all /= Buf2.all then
+ AlertLogStruct.Alert(AlertLogID , Message & " File miscompare on line " & to_string(LineCount), Level) ;
+ exit ReadLoop ;
+ end if ;
+ end loop ReadLoop ;
+ if File1Done /= File2Done then
+ if not File1Done then
+ AlertLogStruct.Alert(AlertLogID , Message & " File1 longer than File2 " & to_string(LineCount), Level) ;
+ end if ;
+ if not File2Done then
+ AlertLogStruct.Alert(AlertLogID , Message & " File2 longer than File1 " & to_string(LineCount), Level) ;
+ end if ;
+ end if;
+ end procedure AlertIfDiff ;
+
+ ------------------------------------------------------------
+ procedure AlertIfDiff (file File1, File2 : text; Message : string := "" ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ AlertIfDiff (ALERT_DEFAULT_ID, File1, File2, Message, Level) ;
+ end procedure AlertIfDiff ;
+
+ ------------------------------------------------------------
+ procedure SetAlertLogJustify is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.SetJustify ;
+ end procedure SetAlertLogJustify ;
+
+ ------------------------------------------------------------
+ procedure ReportAlerts ( Name : String ; AlertCount : AlertCountType ) is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.ReportAlerts(Name, AlertCount) ;
+ end procedure ReportAlerts ;
+
+ ------------------------------------------------------------
+ procedure ReportAlerts ( Name : string := OSVVM_STRING_INIT_PARM_DETECT ; AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID ; ExternalErrors : AlertCountType := (others => 0) ) is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.ReportAlerts(Name, AlertLogID, ExternalErrors, TRUE) ;
+ end procedure ReportAlerts ;
+
+ ------------------------------------------------------------
+ procedure ReportNonZeroAlerts ( Name : string := OSVVM_STRING_INIT_PARM_DETECT ; AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID ; ExternalErrors : AlertCountType := (others => 0) ) is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.ReportAlerts(Name, AlertLogID, ExternalErrors, FALSE) ;
+ end procedure ReportNonZeroAlerts ;
+
+ ------------------------------------------------------------
+ procedure ClearAlerts is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.ClearAlerts ;
+ end procedure ClearAlerts ;
+
+ ------------------------------------------------------------
+ function "+" (L, R : AlertCountType) return AlertCountType is
+ ------------------------------------------------------------
+ variable Result : AlertCountType ;
+ begin
+ Result(FAILURE) := L(FAILURE) + R(FAILURE) ;
+ Result(ERROR) := L(ERROR) + R(ERROR) ;
+ Result(WARNING) := L(WARNING) + R(WARNING) ;
+ return Result ;
+ end function "+" ;
+
+ ------------------------------------------------------------
+ function "-" (L, R : AlertCountType) return AlertCountType is
+ ------------------------------------------------------------
+ variable Result : AlertCountType ;
+ begin
+ Result(FAILURE) := L(FAILURE) - R(FAILURE) ;
+ Result(ERROR) := L(ERROR) - R(ERROR) ;
+ Result(WARNING) := L(WARNING) - R(WARNING) ;
+ return Result ;
+ end function "-" ;
+
+ ------------------------------------------------------------
+ function "-" (R : AlertCountType) return AlertCountType is
+ ------------------------------------------------------------
+ variable Result : AlertCountType ;
+ begin
+ Result(FAILURE) := - R(FAILURE) ;
+ Result(ERROR) := - R(ERROR) ;
+ Result(WARNING) := - R(WARNING) ;
+ return Result ;
+ end function "-" ;
+
+ ------------------------------------------------------------
+ impure function SumAlertCount(AlertCount: AlertCountType) return integer is
+ ------------------------------------------------------------
+ begin
+ return AlertCount(FAILURE) + AlertCount(ERROR) + AlertCount(WARNING) ;
+ end function SumAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return AlertCountType is
+ ------------------------------------------------------------
+ begin
+ return AlertLogStruct.GetAlertCount(AlertLogID) ;
+ end function GetAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return integer is
+ ------------------------------------------------------------
+ begin
+ return SumAlertCount(AlertLogStruct.GetAlertCount(AlertLogID)) ;
+ end function GetAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetEnabledAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return AlertCountType is
+ ------------------------------------------------------------
+ begin
+ return AlertLogStruct.GetEnabledAlertCount(AlertLogID) ;
+ end function GetEnabledAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetEnabledAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return integer is
+ ------------------------------------------------------------
+ begin
+ return SumAlertCount(AlertLogStruct.GetEnabledAlertCount(AlertLogID)) ;
+ end function GetEnabledAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetDisabledAlertCount return AlertCountType is
+ ------------------------------------------------------------
+ begin
+ return AlertLogStruct.GetDisabledAlertCount ;
+ end function GetDisabledAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetDisabledAlertCount return integer is
+ ------------------------------------------------------------
+ begin
+ return SumAlertCount(AlertLogStruct.GetDisabledAlertCount) ;
+ end function GetDisabledAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetDisabledAlertCount(AlertLogID: AlertLogIDType) return AlertCountType is
+ ------------------------------------------------------------
+ begin
+ return AlertLogStruct.GetDisabledAlertCount(AlertLogID) ;
+ end function GetDisabledAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetDisabledAlertCount(AlertLogID: AlertLogIDType) return integer is
+ ------------------------------------------------------------
+ begin
+ return SumAlertCount(AlertLogStruct.GetDisabledAlertCount(AlertLogID)) ;
+ end function GetDisabledAlertCount ;
+
+ ------------------------------------------------------------
+ procedure log(
+ ------------------------------------------------------------
+ AlertLogID : AlertLogIDType ;
+ Message : string ;
+ Level : LogType := ALWAYS
+ ) is
+ begin
+ AlertLogStruct.Log(AlertLogID, Message, Level) ;
+ end procedure log ;
+
+ ------------------------------------------------------------
+ procedure log( Message : string ; Level : LogType := ALWAYS) is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.Log(LOG_DEFAULT_ID, Message, Level) ;
+ end procedure log ;
+
+ ------------------------------------------------------------
+ impure function IsLoggingEnabled(AlertLogID : AlertLogIDType ; Level : LogType) return boolean is
+ ------------------------------------------------------------
+ begin
+ return AlertLogStruct.IsLoggingEnabled(AlertLogID, Level) ;
+ end function IsLoggingEnabled ;
+
+ ------------------------------------------------------------
+ impure function IsLoggingEnabled(Level : LogType) return boolean is
+ ------------------------------------------------------------
+ begin
+ return AlertLogStruct.IsLoggingEnabled(LOG_DEFAULT_ID, Level) ;
+ end function IsLoggingEnabled ;
+
+ ------------------------------------------------------------
+ procedure SetAlertLogName(Name : string ) is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.SetAlertLogName(Name) ;
+ end procedure SetAlertLogName ;
+
+ ------------------------------------------------------------
+ procedure InitializeAlertLogStruct is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.Initialize ;
+ end procedure InitializeAlertLogStruct ;
+
+ ------------------------------------------------------------
+ procedure DeallocateAlertLogStruct is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.Deallocate ;
+ end procedure DeallocateAlertLogStruct ;
+
+ ------------------------------------------------------------
+ impure function FindAlertLogID(Name : string ) return AlertLogIDType is
+ ------------------------------------------------------------
+ begin
+ return AlertLogStruct.FindAlertLogID(Name) ;
+ end function FindAlertLogID ;
+
+ ------------------------------------------------------------
+ impure function FindAlertLogID(Name : string ; ParentID : AlertLogIDType) return AlertLogIDType is
+ ------------------------------------------------------------
+ begin
+ return AlertLogStruct.FindAlertLogID(Name, ParentID) ;
+ end function FindAlertLogID ;
+
+ ------------------------------------------------------------
+ impure function GetAlertLogID(Name : string ; ParentID : AlertLogIDType := ALERTLOG_BASE_ID) return AlertLogIDType is
+ ------------------------------------------------------------
+ begin
+ return AlertLogStruct.GetAlertLogID(Name, ParentID ) ;
+ end function GetAlertLogID ;
+
+ ------------------------------------------------------------
+ procedure SetGlobalAlertEnable (A : boolean := TRUE) is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.SetGlobalAlertEnable(A) ;
+ end procedure SetGlobalAlertEnable ;
+
+ ------------------------------------------------------------
+ -- Set using constant. Set before code runs.
+ impure function SetGlobalAlertEnable (A : boolean := TRUE) return boolean is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.SetGlobalAlertEnable(A) ;
+ return A ;
+ end function SetGlobalAlertEnable ;
+
+ ------------------------------------------------------------
+ procedure SetAlertStopCount(AlertLogID : AlertLogIDType ; Level : AlertType ; Count : integer) is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.SetAlertStopCount(AlertLogID, Level, Count) ;
+ end procedure SetAlertStopCount ;
+
+ ------------------------------------------------------------
+ procedure SetAlertStopCount(Level : AlertType ; Count : integer) is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.SetAlertStopCount(ALERTLOG_BASE_ID, Level, Count) ;
+ end procedure SetAlertStopCount ;
+
+ ------------------------------------------------------------
+ procedure SetAlertEnable(Level : AlertType ; Enable : boolean) is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.SetAlertEnable(Level, Enable) ;
+ end procedure SetAlertEnable ;
+
+ ------------------------------------------------------------
+ procedure SetAlertEnable(AlertLogID : AlertLogIDType ; Level : AlertType ; Enable : boolean ; DescendHierarchy : boolean := TRUE) is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.SetAlertEnable(AlertLogID, Level, Enable, DescendHierarchy) ;
+ end procedure SetAlertEnable ;
+
+ ------------------------------------------------------------
+ procedure SetLogEnable(Level : LogType ; Enable : boolean) is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.SetLogEnable(Level, Enable) ;
+ end procedure SetLogEnable ;
+
+ ------------------------------------------------------------
+ procedure SetLogEnable(AlertLogID : AlertLogIDType ; Level : LogType ; Enable : boolean ; DescendHierarchy : boolean := TRUE) is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.SetLogEnable(AlertLogID, Level, Enable, DescendHierarchy) ;
+ end procedure SetLogEnable ;
+
+ ------------------------------------------------------------
+ procedure ReportLogEnables is
+ ------------------------------------------------------------
+ begin
+ AlertLogStruct.ReportLogEnables ;
+ end ReportLogEnables ;
+
+ ------------------------------------------------------------
+ impure function GetAlertLogName(AlertLogID : AlertLogIDType) return string is
+ ------------------------------------------------------------
+ begin
+ return AlertLogStruct.GetAlertLogName(AlertLogID) ;
+ end GetAlertLogName ;
+
+ ------------------------------------------------------------
+ procedure SetAlertLogOptions (
+ ------------------------------------------------------------
+ FailOnWarning : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ FailOnDisabledErrors : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ ReportHierarchy : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertLevel : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertName : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertTime : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogLevel : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogName : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogTime : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ AlertPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ LogPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ ReportPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ DoneName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
+ ) is
+ begin
+ AlertLogStruct.SetAlertLogOptions (
+ FailOnWarning => FailOnWarning ,
+ FailOnDisabledErrors => FailOnDisabledErrors,
+ ReportHierarchy => ReportHierarchy ,
+ WriteAlertLevel => WriteAlertLevel ,
+ WriteAlertName => WriteAlertName ,
+ WriteAlertTime => WriteAlertTime ,
+ WriteLogLevel => WriteLogLevel ,
+ WriteLogName => WriteLogName ,
+ WriteLogTime => WriteLogTime ,
+ AlertPrefix => AlertPrefix ,
+ LogPrefix => LogPrefix ,
+ ReportPrefix => ReportPrefix ,
+ DoneName => DoneName ,
+ PassName => PassName ,
+ FailName => FailName
+ );
+ end procedure SetAlertLogOptions ;
+
+ ------------------------------------------------------------
+ impure function GetAlertReportPrefix return string is
+ ------------------------------------------------------------
+ begin
+ return AlertLogStruct.GetAlertReportPrefix ;
+ end function GetAlertReportPrefix ;
+
+ ------------------------------------------------------------
+ impure function GetAlertDoneName return string is
+ ------------------------------------------------------------
+ begin
+ return AlertLogStruct.GetAlertDoneName ;
+ end function GetAlertDoneName ;
+
+ ------------------------------------------------------------
+ impure function GetAlertPassName return string is
+ ------------------------------------------------------------
+ begin
+ return AlertLogStruct.GetAlertPassName ;
+ end function GetAlertPassName ;
+
+ ------------------------------------------------------------
+ impure function GetAlertFailName return string is
+ ------------------------------------------------------------
+ begin
+ return AlertLogStruct.GetAlertFailName ;
+ end function GetAlertFailName ;
+
+ ------------------------------------------------------------
+ function IsLogEnableType (Name : String) return boolean is
+ ------------------------------------------------------------
+ -- type LogType is (ALWAYS, DEBUG, FINAL, INFO) ; -- NEVER
+ begin
+ if Name = "DEBUG" then return TRUE ;
+ elsif Name = "FINAL" then return TRUE ;
+ elsif Name = "INFO" then return TRUE ;
+ end if ;
+ return FALSE ;
+ end function IsLogEnableType ;
+
+ ------------------------------------------------------------
+ procedure ReadLogEnables (file AlertLogInitFile : text) is
+ -- Preferred Read format
+ -- Line 1: instance1_name log_enable log_enable log_enable
+ -- Line 2: instance2_name log_enable log_enable log_enable
+ -- when reading multiple log_enables on a line, they must be separated by a space
+ --
+ --- Also supports alternate format from Lyle/....
+ -- Line 1: instance1_name
+ -- Line 2: log enable
+ -- Line 3: instance2_name
+ -- Line 4: log enable
+ --
+ ------------------------------------------------------------
+ type ReadStateType is (GET_ID, GET_ENABLE) ;
+ variable ReadState : ReadStateType := GET_ID ;
+ variable buf : line ;
+ variable Empty : boolean ;
+ variable Name : string(1 to 80) ;
+ variable NameLen : integer ;
+ variable AlertLogID : AlertLogIDType ;
+ variable NumEnableRead : integer ;
+ variable LogLevel : LogType ;
+ begin
+ ReadState := GET_ID ;
+ ReadLineLoop : while not EndFile(AlertLogInitFile) loop
+ ReadLine(AlertLogInitFile, buf) ;
+ EmptyOrCommentLine(buf, Empty) ;
+
+ ReadNameLoop : while not Empty loop
+ case ReadState is
+ when GET_ID =>
+ sread(buf, Name, NameLen) ;
+ exit ReadNameLoop when NameLen = 0 ;
+ AlertLogID := GetAlertLogID(Name(1 to NameLen), ALERTLOG_ID_NOT_ASSIGNED) ;
+ ReadState := GET_ENABLE ;
+ NumEnableRead := 0 ;
+
+ when GET_ENABLE =>
+ sread(buf, Name, NameLen) ;
+ exit ReadNameLoop when NameLen = 0 ;
+ NumEnableRead := NumEnableRead + 1 ;
+ exit ReadNameLoop when not IsLogEnableType(Name(1 to NameLen)) ;
+ LogLevel := LogType'value(Name(1 to NameLen)) ;
+ SetLogEnable(AlertLogID, LogLevel, TRUE) ;
+ end case ;
+ end loop ReadNameLoop ;
+ -- if have read an enable, find next AlertLog Name
+ if NumEnableRead > 0 then
+ ReadState := GET_ID ;
+ end if ;
+ end loop ReadLineLoop ;
+ end procedure ReadLogEnables ;
+
+ ------------------------------------------------------------
+ procedure ReadLogEnables (FileName : string) is
+ ------------------------------------------------------------
+ file AlertLogInitFile : text open READ_MODE is FileName ;
+ begin
+ ReadLogEnables(AlertLogInitFile) ;
+ end procedure ReadLogEnables ;
+
+ ------------------------------------------------------------
+ function PathTail (A : string) return string is
+ ------------------------------------------------------------
+ alias aA : string(1 to A'length) is A ;
+ begin
+ for i in aA'length - 1 downto 1 loop
+ if aA(i) = ':' then
+ return aA(i+1 to aA'length-1) ;
+ end if ;
+ end loop ;
+ return aA ;
+ end function PathTail ;
+
+end package body AlertLogPkg ;
\ No newline at end of file
diff --git a/AlertLogPkg_body_BVUL.vhd b/AlertLogPkg_body_BVUL.vhd
new file mode 100644
index 0000000..38f2bcd
--- /dev/null
+++ b/AlertLogPkg_body_BVUL.vhd
@@ -0,0 +1,491 @@
+--
+-- File Name: AlertLogPkg_body_BVUL.vhd
+-- Design Unit Name: AlertLogPkg
+-- Revision: STANDARD VERSION, revision 2015.01
+--
+-- Maintainer: Jim Lewis email: jim@synthworks.com
+-- Contributor(s):
+-- Jim Lewis jim@synthworks.com
+--
+--
+-- Description:
+-- Alert handling and log filtering (verbosity control)
+-- Alert handling provides a method to count failures, errors, and warnings
+-- To accumlate counts, a data structure is created in a shared variable
+-- It is of type AlertLogStructPType which is defined in AlertLogBasePkg
+-- Log filtering provides verbosity control for logs (display or do not display)
+-- AlertLogPkg provides a simplified interface to the shared variable
+--
+--
+-- Developed for:
+-- SynthWorks Design Inc.
+-- VHDL Training Classes
+-- 11898 SW 128th Ave. Tigard, Or 97223
+-- http://www.SynthWorks.com
+--
+-- Revision History:
+-- Date Version Description
+-- 01/2015: 2015.01 Initial revision
+--
+--
+-- Copyright (c) 2015 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 work.NamePkg.all ;
+
+package body AlertLogPkg is
+
+ -- instead of justify(to_upper(to_string())), just look up the upper case, left justified values
+ type AlertNameType is array(AlertType) of string(1 to 7) ;
+ constant ALERT_NAME : AlertNameType := (WARNING => "WARNING", ERROR => "ERROR ", FAILURE => "FAILURE") ; -- , NEVER => "NEVER "
+ type LogNameType is array(LogType) of string(1 to 7) ;
+ constant LOG_NAME : LogNameType := (DEBUG => "DEBUG ", FINAL => "FINAL ", INFO => "INFO ", ALWAYS => "ALWAYS ") ; -- , NEVER => "NEVER "
+
+ -- Local
+ constant NUM_PREDEFINED_AL_IDS : AlertLogIDType := 2 ; -- Not including base
+
+ type AlertToSeverityType is array (AlertType) of severity_level ;
+ constant ALERT_TO_SEVERITY : AlertToSeverityType := (WARNING => WARNING, ERROR => ERROR, FAILURE => FAILURE) ; -- , NEVER => "NEVER "
+
+
+ ------------------------------------------------------------
+ procedure Alert(
+ ------------------------------------------------------------
+ AlertLogID : AlertLogIDType ;
+ Message : string ;
+ Level : AlertType := ERROR
+ ) is
+ begin
+ report Message & "AlertLogID = " & to_string(AlertLogID) severity ALERT_TO_SEVERITY(Level) ;
+ end procedure alert ;
+
+ ------------------------------------------------------------
+ procedure Alert( Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ Alert(ALERT_DEFAULT_ID , Message, Level) ;
+ end procedure alert ;
+
+ ------------------------------------------------------------
+ procedure AlertIf( condition : boolean ; AlertLogID : AlertLogIDType ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if condition then
+ Alert(AlertLogID , Message, Level) ;
+ end if ;
+ end procedure AlertIf ;
+
+ ------------------------------------------------------------
+ procedure AlertIf( condition : boolean ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if condition then
+ Alert(ALERT_DEFAULT_ID , Message, Level) ;
+ end if ;
+ end procedure AlertIf ;
+
+ ------------------------------------------------------------
+ -- useful with exit conditions in a loop: exit when alert( not ReadValid, failure, "Read Failed") ;
+ impure function AlertIf( condition : boolean ; AlertLogID : AlertLogIDType ; Message : string ; Level : AlertType := ERROR ) return boolean is
+ ------------------------------------------------------------
+ begin
+ if condition then
+ Alert(AlertLogID , Message, Level) ;
+ end if ;
+ return condition ;
+ end function AlertIf ;
+
+ ------------------------------------------------------------
+ impure function AlertIf( condition : boolean ; Message : string ; Level : AlertType := ERROR ) return boolean is
+ ------------------------------------------------------------
+ begin
+ if condition then
+ Alert(ALERT_DEFAULT_ID, Message, Level) ;
+ end if ;
+ return condition ;
+ end function AlertIf ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNot( condition : boolean ; AlertLogID : AlertLogIDType ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if not condition then
+ Alert(AlertLogID, Message, Level) ;
+ end if ;
+ end procedure AlertIfNot ;
+
+ ------------------------------------------------------------
+ procedure AlertIfNot( condition : boolean ; Message : string ; Level : AlertType := ERROR ) is
+ ------------------------------------------------------------
+ begin
+ if not condition then
+ Alert(ALERT_DEFAULT_ID, Message, Level) ;
+ end if ;
+ end procedure AlertIfNot ;
+
+ ------------------------------------------------------------
+ -- useful with exit conditions in a loop: exit when alert( not ReadValid, failure, "Read Failed") ;
+ impure function AlertIfNot( condition : boolean ; AlertLogID : AlertLogIDType ; Message : string ; Level : AlertType := ERROR ) return boolean is
+ ------------------------------------------------------------
+ begin
+ if not condition then
+ Alert(AlertLogID, Message, Level) ;
+ end if ;
+ return not condition ;
+ end function AlertIfNot ;
+
+ ------------------------------------------------------------
+ impure function AlertIfNot( condition : boolean ; Message : string ; Level : AlertType := ERROR ) return boolean is
+ ------------------------------------------------------------
+ begin
+ if not condition then
+ Alert(ALERT_DEFAULT_ID, Message, Level) ;
+ end if ;
+ return not condition ;
+ end function AlertIfNot ;
+
+ ------------------------------------------------------------
+ procedure SetAlertLogJustify is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure SetAlertLogJustify ;
+
+ ------------------------------------------------------------
+ procedure ReportAlerts ( Name : string := OSVVM_STRING_INIT_PARM_DETECT ; AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID ; ExternalErrors : AlertCountType := (others => 0) ) is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure ReportAlerts ;
+
+ ------------------------------------------------------------
+ procedure ReportAlerts ( Name : String ; AlertCount : AlertCountType ) is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure ReportAlerts ;
+
+ ------------------------------------------------------------
+ procedure ClearAlerts is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure ClearAlerts ;
+
+ ------------------------------------------------------------
+ function "+" (L, R : AlertCountType) return AlertCountType is
+ ------------------------------------------------------------
+ variable Result : AlertCountType ;
+ begin
+ Result(FAILURE) := L(FAILURE) + R(FAILURE) ;
+ Result(ERROR) := L(ERROR) + R(ERROR) ;
+ Result(WARNING) := L(WARNING) + R(WARNING) ;
+ return Result ;
+ end function "+" ;
+
+ ------------------------------------------------------------
+ function "-" (L, R : AlertCountType) return AlertCountType is
+ ------------------------------------------------------------
+ variable Result : AlertCountType ;
+ begin
+ Result(FAILURE) := L(FAILURE) - R(FAILURE) ;
+ Result(ERROR) := L(ERROR) - R(ERROR) ;
+ Result(WARNING) := L(WARNING) - R(WARNING) ;
+ return Result ;
+ end function "-" ;
+
+ ------------------------------------------------------------
+ function "-" (R : AlertCountType) return AlertCountType is
+ ------------------------------------------------------------
+ variable Result : AlertCountType ;
+ begin
+ Result(FAILURE) := - R(FAILURE) ;
+ Result(ERROR) := - R(ERROR) ;
+ Result(WARNING) := - R(WARNING) ;
+ return Result ;
+ end function "-" ;
+
+ ------------------------------------------------------------
+ impure function SumAlertCount(AlertCount: AlertCountType) return integer is
+ ------------------------------------------------------------
+ begin
+ return AlertCount(FAILURE) + AlertCount(ERROR) + AlertCount(WARNING) ;
+ end function SumAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return AlertCountType is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return (0, 0, 0) ;
+ end function GetAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return integer is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return 0 ;
+ end function GetAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetEnabledAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return AlertCountType is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return (0, 0, 0) ;
+ end function GetEnabledAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetEnabledAlertCount(AlertLogID : AlertLogIDType := ALERTLOG_BASE_ID) return integer is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return 0 ;
+ end function GetEnabledAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetDisabledAlertCount return AlertCountType is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return (0, 0, 0) ;
+ end function GetDisabledAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetDisabledAlertCount return integer is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return 0 ;
+ end function GetDisabledAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetDisabledAlertCount(AlertLogID: AlertLogIDType) return AlertCountType is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return (0, 0, 0) ;
+ end function GetDisabledAlertCount ;
+
+ ------------------------------------------------------------
+ impure function GetDisabledAlertCount(AlertLogID: AlertLogIDType) return integer is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return 0 ;
+ end function GetDisabledAlertCount ;
+
+ ------------------------------------------------------------
+ procedure log(
+ ------------------------------------------------------------
+ AlertLogID : AlertLogIDType ;
+ Message : string ;
+ Level : LogType := ALWAYS
+ ) is
+ begin
+ report Message & "AlertLogID = " & to_string(AlertLogID) & " Level = " & to_string(Level) ;
+ end procedure log ;
+
+ ------------------------------------------------------------
+ procedure log( Message : string ; Level : LogType := ALWAYS) is
+ ------------------------------------------------------------
+ begin
+ Log(LOG_DEFAULT_ID, Message, Level) ;
+ end procedure log ;
+
+ ------------------------------------------------------------
+ impure function IsLoggingEnabled(AlertLogID : AlertLogIDType ; Level : LogType) return boolean is
+ ------------------------------------------------------------
+ begin
+-- returns true when log level is enabled
+alert("AlertLogPkg: procedure must be implemented", FAILURE) ;
+-- return AlertLogStruct.IsLoggingEnabled(AlertLogID, Level) ;
+ return FALSE ;
+ end function IsLoggingEnabled ;
+
+ ------------------------------------------------------------
+ impure function IsLoggingEnabled(Level : LogType) return boolean is
+ ------------------------------------------------------------
+ begin
+-- returns true when log level is enabled
+alert("AlertLogPkg: procedure must be implemented", FAILURE) ;
+-- return AlertLogStruct.IsLoggingEnabled(LOG_DEFAULT_ID, Level) ;
+ return FALSE ;
+ end function IsLoggingEnabled ;
+
+ ------------------------------------------------------------
+ procedure SetAlertLogName(Name : string ) is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure SetAlertLogName ;
+
+ ------------------------------------------------------------
+ procedure InitializeAlertLogStruct is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure InitializeAlertLogStruct ;
+
+ ------------------------------------------------------------
+ procedure DeallocateAlertLogStruct is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure DeallocateAlertLogStruct ;
+
+ ------------------------------------------------------------
+ impure function FindAlertLogID(Name : string ) return AlertLogIDType is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return 0 ;
+ end function FindAlertLogID ;
+
+ ------------------------------------------------------------
+ impure function GetAlertLogID(Name : string ; ParentID : AlertLogIDType := ALERTLOG_BASE_ID) return AlertLogIDType is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return 0 ;
+ end function GetAlertLogID ;
+
+ ------------------------------------------------------------
+ procedure SetGlobalAlertEnable (A : boolean := TRUE) is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure SetGlobalAlertEnable ;
+
+ ------------------------------------------------------------
+ -- Set using constant. Set before code runs.
+ impure function SetGlobalAlertEnable (A : boolean := TRUE) return boolean is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return A ;
+ end function SetGlobalAlertEnable ;
+
+ ------------------------------------------------------------
+ procedure SetAlertStopCount(AlertLogID : AlertLogIDType ; Level : AlertType ; Count : integer) is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure SetAlertStopCount ;
+
+ ------------------------------------------------------------
+ procedure SetAlertStopCount(Level : AlertType ; Count : integer) is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure SetAlertStopCount ;
+
+ ------------------------------------------------------------
+ procedure SetAlertEnable(Level : AlertType ; Enable : boolean) is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure SetAlertEnable ;
+
+ ------------------------------------------------------------
+ procedure SetAlertEnable(AlertLogID : AlertLogIDType ; Level : AlertType ; Enable : boolean ; DescendHierarchy : boolean := TRUE) is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure SetAlertEnable ;
+
+ ------------------------------------------------------------
+ procedure SetLogEnable(Level : LogType ; Enable : boolean) is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure SetLogEnable ;
+
+ ------------------------------------------------------------
+ procedure SetLogEnable(AlertLogID : AlertLogIDType ; Level : LogType ; Enable : boolean ; DescendHierarchy : boolean := TRUE) is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure SetLogEnable ;
+
+ ------------------------------------------------------------
+ procedure SetAlertLogOptions (
+ ------------------------------------------------------------
+ FailOnWarning : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ FailOnDisabledErrors : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ ReportHierarchy : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertLevel : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertName : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAlertTime : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogLevel : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogName : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteLogTime : AlertLogOptionsType := OPT_INIT_PARM_DETECT ;
+ AlertPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ LogPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ ReportPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ DoneName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
+ ) is
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ end procedure SetAlertLogOptions ;
+
+ ------------------------------------------------------------
+ impure function GetAlertReportPrefix return string is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return "" ;
+ end function GetAlertReportPrefix ;
+
+ ------------------------------------------------------------
+ impure function GetAlertDoneName return string is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return "" ;
+ end function GetAlertDoneName ;
+
+ ------------------------------------------------------------
+ impure function GetAlertPassName return string is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return "" ;
+ end function GetAlertPassName ;
+
+ ------------------------------------------------------------
+ impure function GetAlertFailName return string is
+ ------------------------------------------------------------
+ begin
+ alert("AlertLogPkg: procedure not implemented for BVUL") ;
+ return "" ;
+ end function GetAlertFailName ;
+
+end package body AlertLogPkg ;
\ No newline at end of file
diff --git a/CoveragePkg.vhd b/CoveragePkg.vhd
index b3f899e..3a56983 100644
--- a/CoveragePkg.vhd
+++ b/CoveragePkg.vhd
@@ -1,7 +1,7 @@
--
-- File Name: CoveragePkg.vhd
-- Design Unit Name: CoveragePkg
--- Revision: STANDARD VERSION, revision 2014.07a
+-- Revision: STANDARD VERSION, revision 2015.01
--
-- Maintainer: Jim Lewis email: jim@synthworks.com
-- Contributor(s):
@@ -40,6 +40,7 @@
-- 1/2014 2014.01 Merging of Cov Models, LastIndex
-- 7/2014 2014.07 Bin Naming (for requirements tracking), WriteBin with Pass/Fail, GenBin[integer_vector]
-- 12/2014 2014.07a Fix memory leak in deallocate. Removed initialied pointers which can lead to leaks.
+-- 01/2015 2015.01 Use AlertLogPkg to count assertions and filter log messages
--
-- Development Notes:
-- The coverage procedures are named ICover to avoid conflicts with
@@ -49,7 +50,8 @@
-- In the notes VHDL-2008 notes refers to
-- composites with unconstrained elements
--
--- Copyright (c) 2010 - 2014 by SynthWorks Design Inc. All rights reserved.
+--
+-- Copyright (c) 2010 - 2015 by SynthWorks Design Inc. All rights reserved.
--
-- Verbatim copies of this source file may be used and
-- distributed without restriction.
@@ -87,10 +89,13 @@ use std.textio.all ;
-- library ieee_proposed ; -- remove with VHDL-2008
-- use ieee_proposed.standard_additions.all ; -- remove with VHDL-2008
+use work.TranscriptPkg.all ;
+use work.AlertLogPkg.all ;
use work.RandomBasePkg.all ;
use work.RandomPkg.all ;
use work.NamePkg.all ;
use work.MessagePkg.all ;
+use work.OsvvmGlobalPkg.all ;
package CoveragePkg is
@@ -113,7 +118,12 @@ package CoveragePkg is
constant COV_IGNORE : integer := 0 ;
constant COV_ILLEGAL : integer := -1 ;
- type CovOptionsType is (COV_OPT_DEFAULT, DISABLED, ENABLED) ;
+ -- type OsvvmOptionsType is (OPT_DEFAULT, FALSE, TRUE) ;
+ alias CovOptionsType is work.OsvvmGlobalPkg.OsvvmOptionsType ;
+ constant COV_OPT_INIT_PARM_DETECT : CovOptionsType := work.OsvvmGlobalPkg.OPT_INIT_PARM_DETECT ;
+ -- For backward compatibility. Don't add to other packages.
+ alias DISABLED is work.OsvvmGlobalPkg.DISABLED [return work.OsvvmGlobalPkg.OsvvmOptionsType ];
+ alias ENABLED is work.OsvvmGlobalPkg.ENABLED [return work.OsvvmGlobalPkg.OsvvmOptionsType ];
-- Deprecated
-- Used for easy manual entry. Order: min, max, action
@@ -144,7 +154,6 @@ package CoveragePkg is
type WeightModeType is (AT_LEAST, WEIGHT, REMAIN, REMAIN_EXP, REMAIN_SCALED, REMAIN_WEIGHT ) ;
-
-- In VHDL-2008 CovMatrix?BaseType and CovMatrix?Type will be subsumed
-- by CovBinBaseType and CovBinType with RangeArrayType as an unconstrained array.
type CovMatrix2BaseType is record
@@ -219,8 +228,6 @@ package CoveragePkg is
end record ;
type CovMatrix9Type is array (natural range <>) of CovMatrix9BaseType ;
-
-
------------------------------------------------------------
function ToMinPoint (A : RangeArrayType) return integer ;
function ToMinPoint (A : RangeArrayType) return integer_vector ;
@@ -236,7 +243,6 @@ package CoveragePkg is
variable result : out integer
) ;
-
------------------------------------------------------------
procedure ToRandPoint(
-- BinVal to Random Point
@@ -255,12 +261,17 @@ package CoveragePkg is
type CovPType is protected
procedure FileOpenWriteBin (FileName : string; OpenKind : File_Open_Kind ) ;
procedure FileCloseWriteBin ;
+ procedure SetAlertLogID (A : AlertLogIDType) ;
+ impure function GetAlertLogID return AlertLogIDType ;
+
-- procedure FileOpenWriteCovDb (FileName : string; OpenKind : File_Open_Kind ) ;
-- procedure FileCloseWriteCovDb ;
procedure SetIllegalMode (A : IllegalModeType) ;
procedure SetWeightMode (A : WeightModeType; Scale : real := 1.0) ;
- procedure SetName (NameIn : String) ;
- procedure SetMessage (MessageIn : String) ;
+ procedure SetName (Name : String) ;
+ impure function SetName (Name : String) return string ;
+ impure function GetName return String ;
+ procedure SetMessage (Message : String) ;
procedure DeallocateName ; -- clear name
procedure DeallocateMessage ; -- clear message
procedure SetThresholding(A : boolean := TRUE ) ; -- 2.5
@@ -270,19 +281,20 @@ package CoveragePkg is
procedure SetMerging(A : boolean := TRUE ) ; -- 2.5
procedure SetCountMode (A : CountModeType) ;
procedure InitSeed (S : string ) ;
+ impure function InitSeed (S : string ) return string ;
procedure InitSeed (I : integer ) ;
procedure SetSeed (RandomSeedIn : RandomSeedType ) ;
impure function GetSeed return RandomSeedType ;
------------------------------------------------------------
procedure SetReportOptions (
- WritePassFail : CovOptionsType := COV_OPT_DEFAULT ;
- WriteBinInfo : CovOptionsType := COV_OPT_DEFAULT ;
- WriteCount : CovOptionsType := COV_OPT_DEFAULT ;
- WriteAnyIllegal : CovOptionsType := COV_OPT_DEFAULT ;
- WritePrefix : string := "" ;
- PassName : string := "" ;
- FailName : string := ""
+ WritePassFail : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteBinInfo : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteCount : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteAnyIllegal : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WritePrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
) ;
procedure SetBinSize (NewNumBins : integer) ;
@@ -301,8 +313,6 @@ package CoveragePkg is
procedure AddBins ( AtLeast : integer ; CovBin : CovBinType ) ;
procedure AddBins ( CovBin : CovBinType ) ;
-
-
------------------------------------------------------------
procedure AddCross(
------------------------------------------------------------
@@ -331,7 +341,6 @@ package CoveragePkg is
Bin14, Bin15, Bin16, Bin17, Bin18, Bin19, Bin20 : CovBinType := NULL_BIN
) ;
-
------------------------------------------------------------
procedure AddCross(
AtLeast : integer ;
@@ -425,33 +434,62 @@ package CoveragePkg is
------------------------------------------------------------
procedure WriteBin (
- WritePassFail : CovOptionsType := COV_OPT_DEFAULT ;
- WriteBinInfo : CovOptionsType := COV_OPT_DEFAULT ;
- WriteCount : CovOptionsType := COV_OPT_DEFAULT ;
- WriteAnyIllegal : CovOptionsType := COV_OPT_DEFAULT ;
- WritePrefix : string := "" ;
- PassName : string := "" ;
- FailName : string := ""
+ WritePassFail : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteBinInfo : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteCount : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteAnyIllegal : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WritePrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
+ ) ;
+
+ ------------------------------------------------------------
+ procedure WriteBin ( -- With LogLevel
+ LogLevel : LogType ;
+ WritePassFail : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteBinInfo : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteCount : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteAnyIllegal : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WritePrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
) ;
------------------------------------------------------------
procedure WriteBin (
FileName : string;
OpenKind : File_Open_Kind := APPEND_MODE ;
- WritePassFail : CovOptionsType := COV_OPT_DEFAULT ;
- WriteBinInfo : CovOptionsType := COV_OPT_DEFAULT ;
- WriteCount : CovOptionsType := COV_OPT_DEFAULT ;
- WriteAnyIllegal : CovOptionsType := COV_OPT_DEFAULT ;
- WritePrefix : string := "" ;
- PassName : string := "" ;
- FailName : string := ""
+ WritePassFail : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteBinInfo : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteCount : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteAnyIllegal : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WritePrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
) ;
- procedure WriteCovHoles ;
+ ------------------------------------------------------------
+ procedure WriteBin ( -- With LogLevel
+ LogLevel : LogType ;
+ FileName : string;
+ OpenKind : File_Open_Kind := APPEND_MODE ;
+ WritePassFail : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteBinInfo : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteCount : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteAnyIllegal : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WritePrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
+ ) ;
+
+ procedure WriteCovHoles ( LogLevel : LogType := ALWAYS ) ;
procedure WriteCovHoles ( PercentCov : real ) ;
+ procedure WriteCovHoles ( LogLevel : LogType ; PercentCov : real ) ;
procedure WriteCovHoles ( FileName : string; OpenKind : File_Open_Kind := APPEND_MODE ) ;
+ procedure WriteCovHoles ( LogLevel : LogType ; FileName : string; OpenKind : File_Open_Kind := APPEND_MODE ) ;
procedure WriteCovHoles ( FileName : string; PercentCov : real ; OpenKind : File_Open_Kind := APPEND_MODE ) ;
- procedure DumpBin ; -- Development only
+ procedure WriteCovHoles ( LogLevel : LogType ; FileName : string; PercentCov : real ; OpenKind : File_Open_Kind := APPEND_MODE ) ;
+ procedure DumpBin (LogLevel : LogType := DEBUG) ; -- Development only
procedure ReadCovDb (FileName : string; Merge : boolean := FALSE) ;
procedure WriteCovDb (FileName : string; OpenKind : File_Open_Kind := WRITE_MODE ) ;
@@ -505,7 +543,9 @@ package CoveragePkg is
impure function GetCovHole ( ReqHoleNum : integer ; AtLeast : integer ) return RangeArrayType ;
procedure WriteCovHoles ( AtLeast : integer ) ;
+ procedure WriteCovHoles ( LogLevel : LogType ; AtLeast : integer ) ;
procedure WriteCovHoles ( FileName : string; AtLeast : integer ; OpenKind : File_Open_Kind := APPEND_MODE ) ;
+ procedure WriteCovHoles ( LogLevel : LogType ; FileName : string; AtLeast : integer ; OpenKind : File_Open_Kind := APPEND_MODE ) ;
end protected CovPType ;
------------------------------------------------------------------------------------------
@@ -523,6 +563,13 @@ package CoveragePkg is
variable ErrorCount : inout integer
) ;
+ ------------------------------------------------------------
+ -- Experimental. Intended primarily for development.
+ procedure CompareBins (
+ ------------------------------------------------------------
+ variable Bin1 : inout CovPType ;
+ variable Bin2 : inout CovPType
+ ) ;
--
-- Support for AddBins and AddCross
@@ -563,33 +610,15 @@ package CoveragePkg is
function IllegalBin ( Min, Max : integer ) return CovBinType ;
function IllegalBin ( A : integer ) return CovBinType ;
-
- ----------------------------------------------------------
- -- function IgnoreBin (
- ----------------------------------------------------------
- -- AtLeast : integer ;
- -- Weight : integer ;
- -- Min, Max : integer ;
- -- NumBin : integer
- -- ) return CovBinType ;
- -- function IgnoreBin (AtLeast : integer ; Min, Max, NumBin : integer) return CovBinType ;
-
- -- All items in range in a single CovBin
+
+-- IgnoreBin should never have an AtLeast parameter
------------------------------------------------------------
function IgnoreBin (Min, Max, NumBin : integer) return CovBinType ;
------------------------------------------------------------
- function IgnoreBin (Min, Max : integer) return CovBinType ;
+ function IgnoreBin (Min, Max : integer) return CovBinType ; -- All items in range in a single CovBin
function IgnoreBin (A : integer) return CovBinType ;
--- ------------------------------------------------------------
--- function GenBin (
--- -- Manual entry format for CovBin within lots of extra parens
--- ------------------------------------------------------------
--- ManualBin : CovBinManualType
--- ) return CovBinType ;
-
-
-- With VHDL-2008, there will be one GenCross that returns CovBinType
-- and has inputs initialized to NULL_BIN - see AddCross
------------------------------------------------------------
@@ -707,8 +736,9 @@ package CoveragePkg is
end package CoveragePkg ;
---- //////////////////////////////////////////////////////////////////////////////////////////////
---- //////////////////////////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
package body CoveragePkg is
------------------------------------------------------------
@@ -832,19 +862,6 @@ package body CoveragePkg is
end procedure WriteBinVal ;
- ------------------------------------------------------------
- -- package local
- function failed (InValid : boolean ; Message : string := " ") return boolean is
- -- Move to TextUtilPkg and make visible?
- ------------------------------------------------------------
- begin
- if InValid then
- report Message severity failure ;
- end if ;
- return InValid ;
- end function failed ;
-
-
------------------------------------------------------------
-- package local
procedure EmptyOrCommentLine (
@@ -907,7 +924,6 @@ package body CoveragePkg is
end procedure read ;
-
-- ------------------------------------------------------------
function BinLengths (
-- package local, used by AddCross, GenCross
@@ -1038,7 +1054,7 @@ package body CoveragePkg is
when 18 => result(i) := aBin18(aBinIndex(i)) ;
when 19 => result(i) := aBin19(aBinIndex(i)) ;
when 20 => result(i) := aBin20(aBinIndex(i)) ;
- when others => report "ConcatenateBins: More than 20 bins not supported" severity failure ;
+ when others => Alert(OSVVM_ALERTLOG_ID, "CoveragePkg.AddCross: More than 20 bins not supported", FAILURE) ;
end case ;
end loop ;
return result ;
@@ -1193,8 +1209,8 @@ package body CoveragePkg is
type CovPType is protected body
-- Name Data Structure
- variable Name : NamePType ;
- variable Message : MessagePType ;
+ variable CovNameVar : NamePType ;
+ variable CovMessageVar : MessagePType ;
-- CoverageBin Data Structures
type RangeArrayPtrType is access RangeArrayType ;
@@ -1221,6 +1237,7 @@ package body CoveragePkg is
-- Internal Modes and Names
variable IllegalMode : IllegalModeType := ILLEGAL_ON ;
+ variable IllegalModeLevel : AlertType := ERROR ;
variable WeightMode : WeightModeType := AT_LEAST ;
variable WeightScale : real := 1.0 ;
@@ -1235,24 +1252,23 @@ package body CoveragePkg is
variable RV : RandomPType ;
variable RvSeedInit : boolean := FALSE ;
-
file WriteBinFile : text ;
variable WriteBinFileInit : boolean := FALSE ;
+ variable UsingLocalFile : boolean := FALSE ;
+ variable AlertLogIDVar : AlertLogIDType := OSVVM_ALERTLOG_ID ;
+
-- file WriteCovDbFile : text ;
-- variable WriteCovDbFileInit : boolean := FALSE ;
- -- Report formatting settings, with defaults
- variable WritePassFailVar : CovOptionsType := DISABLED ;
- variable WriteBinInfoVar : CovOptionsType := ENABLED ;
- variable WriteCountVar : CovOptionsType := ENABLED ;
- variable WriteAnyIllegalVar : CovOptionsType := DISABLED ;
+ -- Local WriteBin and WriteCovHoles formatting settings, defaults determined by CoverageGlobals
+ variable WritePassFailVar : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ variable WriteBinInfoVar : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ variable WriteCountVar : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ variable WriteAnyIllegalVar : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
variable WritePrefixVar : NamePType ;
- constant INIT_WRITE_PREFIX : string := "%% " ;
variable PassNameVar : NamePType ;
- constant INIT_PASS_NAME : string := "PASSED" ;
variable FailNameVar : NamePType ;
- constant INIT_FAIL_NAME : string := "FAILED" ;
-
+
------------------------------------------------------------
procedure FileOpenWriteBin (FileName : string; OpenKind : File_Open_Kind ) is
@@ -1270,6 +1286,21 @@ package body CoveragePkg is
file_close( WriteBinFile) ;
end procedure FileCloseWriteBin ;
+ ------------------------------------------------------------
+ procedure SetAlertLogID (A : AlertLogIDType) is
+ ------------------------------------------------------------
+ begin
+ AlertLogIDVar := A ;
+ end procedure SetAlertLogID ;
+
+ ------------------------------------------------------------
+ impure function GetAlertLogID return AlertLogIDType is
+ ------------------------------------------------------------
+ begin
+ return AlertLogIDVar ;
+ end function GetAlertLogID ;
+
+
-- ------------------------------------------------------------
-- procedure FileOpen (FileName : string; OpenKind : File_Open_Kind ) is
-- ------------------------------------------------------------
@@ -1287,82 +1318,84 @@ package body CoveragePkg is
-- end procedure FileCloseWriteCovDb ;
------------------------------------------------------------
- procedure SetIllegalMode (A : IllegalModeType) is
- ------------------------------------------------------------
- begin
- IllegalMode := A ;
- end procedure SetIllegalMode ;
-
- ------------------------------------------------------------
- procedure SetWeightMode (A : WeightModeType; Scale : real := 1.0) is
+ procedure SetName (Name : String) is
------------------------------------------------------------
- variable buf : line ;
begin
- WeightMode := A ;
- WeightScale := Scale ;
-
- if (WeightMode = REMAIN_EXP) and (WeightScale > 2.0) then
- swrite(buf, "%%WARNING: WeightScale > 2.0 and large Counts can cause RandCovPoint to fail due to integer values out of range") ;
- writeline(OUTPUT, buf) ;
+ CovNameVar.Set(Name) ;
+ if not RvSeedInit then -- Init seed if not initialized
+ RV.InitSeed(Name) ;
+ RvSeedInit := TRUE ;
end if ;
- if (WeightScale < 1.0) and (WeightMode = REMAIN_WEIGHT or WeightMode = REMAIN_SCALED) then
- report "WeightScale must be > 1.0 when WeightMode = REMAIN_WEIGHT or WeightMode = REMAIN_SCALED"
- severity failure ;
- WeightScale := 1.0 ;
- end if;
- if WeightScale <= 0.0 then
- report "WeightScale must be > 0.0" severity failure ;
- WeightScale := 1.0 ;
- end if;
- end procedure SetWeightMode ;
+ end procedure SetName ;
------------------------------------------------------------
- procedure SetName (NameIn : String) is
+ impure function SetName (Name : String) return string is
------------------------------------------------------------
begin
- Name.Set(NameIn) ;
+ CovNameVar.Set(Name) ;
if not RvSeedInit then -- Init seed if not initialized
- RV.InitSeed(NameIn) ;
+ RV.InitSeed(Name) ;
RvSeedInit := TRUE ;
end if ;
- end procedure SetName ;
+ return Name ;
+ end function SetName ;
------------------------------------------------------------
impure function GetName return String is
------------------------------------------------------------
begin
- if Name.IsSet then
- return Name.Get ;
- elsif Message.IsSet then
- return GetWord(Message.Get(1)) ;
+ if CovNameVar.IsSet then
+ return CovNameVar.Get ;
+ elsif CovMessageVar.IsSet then
+ return GetWord(string'(CovMessageVar.Get(1))) ;
else
return "" ;
end if ;
end function GetName ;
------------------------------------------------------------
- procedure SetMessage (MessageIn : String) is
+ procedure SetMessage (Message : String) is
------------------------------------------------------------
begin
- Message.Set(MessageIn) ;
+ CovMessageVar.Set(Message) ;
if not RvSeedInit then -- Init seed if not initialized
- RV.InitSeed(MessageIn) ;
+ RV.InitSeed(Message) ;
RvSeedInit := TRUE ;
end if ;
end procedure SetMessage ;
--- ------------------------------------------------------------
--- impure function GetMessage (ItemNumber : integer) return string is
--- ------------------------------------------------------------
--- begin
--- if Message.IsSet then
--- return Message.Get(ItemNumber) ;
--- elsif Name.IsSet then
--- return Name.Get ;
--- else
--- return "" ;
--- end if ;
--- end function GetMessage ;
+ ------------------------------------------------------------
+ procedure SetIllegalMode (A : IllegalModeType) is
+ ------------------------------------------------------------
+ begin
+ IllegalMode := A ;
+ if IllegalMode = ILLEGAL_FAILURE then
+ IllegalModeLevel := FAILURE ;
+ else
+ IllegalModeLevel := ERROR ;
+ end if ;
+ end procedure SetIllegalMode ;
+
+ ------------------------------------------------------------
+ procedure SetWeightMode (A : WeightModeType; Scale : real := 1.0) is
+ ------------------------------------------------------------
+ variable buf : line ;
+ begin
+ WeightMode := A ;
+ WeightScale := Scale ;
+
+ if (WeightMode = REMAIN_EXP) and (WeightScale > 2.0) then
+ Alert(AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.SetWeightMode: WeightScale > 2.0 and large Counts can cause RandCovPoint to fail due to integer values out of range", WARNING) ;
+ end if ;
+ if (WeightScale < 1.0) and (WeightMode = REMAIN_WEIGHT or WeightMode = REMAIN_SCALED) then
+ Alert(AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.SetWeightMode: WeightScale must be > 1.0 when WeightMode = REMAIN_WEIGHT or WeightMode = REMAIN_SCALED", FAILURE) ;
+ WeightScale := 1.0 ;
+ end if;
+ if WeightScale <= 0.0 then
+ Alert(AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.SetWeightMode: WeightScale must be > 0.0", FAILURE) ;
+ WeightScale := 1.0 ;
+ end if;
+ end procedure SetWeightMode ;
------------------------------------------------------------
-- pt local for now -- file formal parameter not allowed with a public method
@@ -1371,18 +1404,18 @@ package body CoveragePkg is
variable MessageCount : integer ;
variable buf : line ;
begin
- MessageCount := Message.GetCount ;
+ MessageCount := CovMessageVar.GetCount ;
if MessageCount = 0 then
if Prefix'length + S'length > 0 then -- everything except WriteCovDb
- write(buf, Prefix & S & Name.Get) ; -- Print name when no message
+ write(buf, Prefix & S & GetName) ; -- Print name when no message
writeline(f, buf) ;
-- write(f, Prefix & S & LF);
end if ;
else
- write(buf, Prefix & S & Message.Get(1)) ;
+ write(buf, Prefix & S & string'(CovMessageVar.Get(1))) ;
writeline(f, buf) ;
for i in 2 to MessageCount loop
- write(buf, Prefix & Message.Get(i)) ;
+ write(buf, Prefix & string'(CovMessageVar.Get(i))) ;
writeline(f, buf) ;
end loop ;
end if ;
@@ -1392,14 +1425,14 @@ package body CoveragePkg is
procedure DeallocateMessage is
------------------------------------------------------------
begin
- Message.Deallocate ;
+ CovMessageVar.Deallocate ;
end procedure DeallocateMessage ;
------------------------------------------------------------
procedure DeallocateName is
------------------------------------------------------------
begin
- Name.Clear ;
+ CovNameVar.Clear ;
end procedure DeallocateName ;
------------------------------------------------------------
@@ -1418,7 +1451,7 @@ package body CoveragePkg is
CovThreshold := Percent + 0.0001 ; -- used in less than
else
CovThreshold := 0.0001 ; -- used in less than
- report "Invalid Threshold Value " & real'image(Percent) severity failure ;
+ Alert(AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.SetCovThreshold: Invalid Threshold Value " & real'image(Percent), FAILURE) ;
end if ;
end procedure SetCovThreshold ;
@@ -1458,6 +1491,15 @@ package body CoveragePkg is
RvSeedInit := TRUE ;
end procedure InitSeed ;
+ ------------------------------------------------------------
+ impure function InitSeed (S : string ) return string is
+ ------------------------------------------------------------
+ begin
+ RV.InitSeed(S) ;
+ RvSeedInit := TRUE ;
+ return S ;
+ end function InitSeed ;
+
------------------------------------------------------------
procedure InitSeed (I : integer ) is
------------------------------------------------------------
@@ -1484,34 +1526,34 @@ package body CoveragePkg is
------------------------------------------------------------
procedure SetReportOptions (
------------------------------------------------------------
- WritePassFail : CovOptionsType := COV_OPT_DEFAULT ;
- WriteBinInfo : CovOptionsType := COV_OPT_DEFAULT ;
- WriteCount : CovOptionsType := COV_OPT_DEFAULT ;
- WriteAnyIllegal : CovOptionsType := COV_OPT_DEFAULT ;
- WritePrefix : string := "" ;
- PassName : string := "" ;
- FailName : string := ""
+ WritePassFail : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteBinInfo : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteCount : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteAnyIllegal : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WritePrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
) is
begin
- if WritePassFail /= COV_OPT_DEFAULT then
+ if WritePassFail /= COV_OPT_INIT_PARM_DETECT then
WritePassFailVar := WritePassFail ;
end if ;
- if WriteBinInfo /= COV_OPT_DEFAULT then
+ if WriteBinInfo /= COV_OPT_INIT_PARM_DETECT then
WriteBinInfoVar := WriteBinInfo ;
end if ;
- if WriteCount /= COV_OPT_DEFAULT then
+ if WriteCount /= COV_OPT_INIT_PARM_DETECT then
WriteCountVar := WriteCount ;
end if ;
- if WriteAnyIllegal /= COV_OPT_DEFAULT then
+ if WriteAnyIllegal /= COV_OPT_INIT_PARM_DETECT then
WriteAnyIllegalVar := WriteAnyIllegal ;
end if ;
- if WritePrefix /= "" then
+ if WritePrefix /= OSVVM_STRING_INIT_PARM_DETECT then
WritePrefixVar.Set(WritePrefix) ;
end if ;
- if PassName /= "" then
+ if PassName /= OSVVM_STRING_INIT_PARM_DETECT then
PassNameVar.Set(PassName) ;
end if ;
- if FailName /= "" then
+ if FailName /= OSVVM_STRING_INIT_PARM_DETECT then
FailNameVar.Set(FailName) ;
end if ;
end procedure SetReportOptions ;
@@ -1543,9 +1585,7 @@ package body CoveragePkg is
if NumBins = 0 then
BinValLength := CurBinValLength ; -- number of points in cross
else
- assert BinValLength = CurBinValLength
- report Caller & ": Cross bins with different sizes prohibited"
- severity failure ;
+ AlertIf(BinValLength /= CurBinValLength, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg." & Caller & ": Cross coverage bins of different dimensions prohibited", FAILURE) ;
end if;
end procedure CheckBinValLength ;
@@ -1693,7 +1733,7 @@ package body CoveragePkg is
if CovBinPtr.all(Position).Action = COV_COUNT then
InsertNewBin(BinVal, Action, Count, AtLeast, Weight, Name, PercentCov) ;
else
- report "InsertBin (AddBins/AddCross): ignore bin dropped. It is a subset of prior bin" severity error ;
+ Alert(AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.InsertBin (AddBins/AddCross): ignore bin dropped. It is a subset of prior bin", ERROR) ;
end if;
elsif Action = COV_ILLEGAL then
@@ -1701,7 +1741,7 @@ package body CoveragePkg is
if CovBinPtr.all(Position).Action = COV_COUNT then
InsertNewBin(BinVal, Action, Count, AtLeast, Weight, Name, PercentCov) ;
else
- report "InsertBin (AddBins/AddCross): illegal bin dropped. It is a subset of prior bin" severity error ;
+ Alert(AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.InsertBin (AddBins/AddCross): illegal bin dropped. It is a subset of prior bin", ERROR) ;
end if;
end if ;
end if ; -- merging enabled
@@ -1925,15 +1965,16 @@ package body CoveragePkg is
MergingEnable := FALSE ;
CountMode := COUNT_FIRST ;
-- RvSeedInit := FALSE ;
- WritePassFailVar := DISABLED ;
- WriteBinInfoVar := ENABLED ;
- WriteCountVar := ENABLED ;
- WriteAnyIllegalVar := DISABLED ;
+ WritePassFailVar := COV_OPT_INIT_PARM_DETECT ;
+ WriteBinInfoVar := COV_OPT_INIT_PARM_DETECT ;
+ WriteCountVar := COV_OPT_INIT_PARM_DETECT ;
+ WriteAnyIllegalVar := COV_OPT_INIT_PARM_DETECT ;
WritePrefixVar.deallocate ;
PassNameVar.deallocate ;
FailNameVar.deallocate ;
end procedure deallocate ;
+
------------------------------------------------------------
-- Local
procedure ICoverIndex( Index : integer ; CovPoint : integer_vector ) is
@@ -1947,18 +1988,14 @@ package body CoveragePkg is
OrderCount := OrderCount + 1 ;
CovBinPtr(Index).OrderCount := OrderCount + CovBinPtr(Index).OrderCount ;
if CovBinPtr(Index).action = COV_ILLEGAL and IllegalMode /= ILLEGAL_OFF then
- write(buf, "%% " & GetName & " Illegal Value: " ) ;
if CovPoint = NULL_INTV then
- swrite(buf, "LastIndex Value") ;
+ alert(AlertLogIDVar, "CoverageModel " & GetName & " Value randomized (ICoverLast) is in an illegal bin.", IllegalModeLevel) ;
else
- write(buf, CovPoint) ;
- end if ;
- write(buf, " is in an illegal Bin. " & "Time: " & time'image(now)) ;
- writeline(OUTPUT, buf) ;
- if IllegalMode = ILLEGAL_FAILURE then
- report GetName & " Illegal Value" severity failure ;
- end if ;
- end if ;
+ write(buf, CovPoint) ;
+ alert(AlertLogIDVar, "CoverageModel " & GetName & " Value " & buf.all & " is in an illegal bin.", IllegalModeLevel) ;
+ deallocate(buf) ;
+ end if ;
+ end if ;
end procedure ICoverIndex ;
@@ -2143,7 +2180,7 @@ package body CoveragePkg is
impure function IsCovered ( PercentCov : real ) return boolean is
------------------------------------------------------------
begin
- -- assert NumBins >= 1 report "IsCovered: Empty Coverage Model" severity failure ;
+ -- AlertIf(NumBins < 1, OSVVM_ALERTLOG_ID, "IsCovered: Empty Coverage Model", failure) ;
return CountCovHoles(PercentCov) = 0 ;
end function IsCovered ;
@@ -2152,7 +2189,7 @@ package body CoveragePkg is
impure function IsCovered return boolean is
------------------------------------------------------------
begin
- -- assert NumBins >= 1 report "IsCovered: Empty Coverage Model" severity failure ;
+ -- AlertIf(NumBins < 1, OSVVM_ALERTLOG_ID, "IsCovered: Empty Coverage Model", failure) ;
return CountCovHoles(CovTarget) = 0 ;
end function IsCovered ;
@@ -2240,10 +2277,10 @@ package body CoveragePkg is
end if ;
end if ;
end loop CovLoop ;
- write(buf, "%%Error GetHoleBinVal did not find hole. " &
+ Alert(AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.GetHoleBinVal did not find hole. " &
"HoleCount = " & integer'image(HoleCount) &
- "ReqHoleNum = " & integer'image(ReqHoleNum) & LF) ;
- writeline(OUTPUT, buf) ;
+ "ReqHoleNum = " & integer'image(ReqHoleNum), ERROR
+ ) ;
return CovBinPtr(NumBins).BinVal.all ;
end function GetHoleBinVal ;
@@ -2673,18 +2710,20 @@ package body CoveragePkg is
variable buf : line ;
begin
if NumBins < 1 then
- swrite(buf, WritePrefix & " ") ;
- swrite(buf, GetName) ;
- swrite(buf, "WriteBin, FATAL, Coverage Model is empty. Nothing to print.") ;
- writeline(f, buf) ;
- report "WriteBin: Coverage model is empty. Nothing to print." severity failure ;
+ if WriteBinFileInit or UsingLocalFile then
+ swrite(buf, WritePrefix & " " & FailName & " ") ;
+ swrite(buf, GetName) ;
+ swrite(buf, "WriteBin: Coverage model is empty. Nothing to print.") ;
+ writeline(f, buf) ;
+ end if ;
+ Alert(AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.WriteBin: Coverage model is empty. Nothing to print.", FAILURE) ;
return ;
end if ;
-- Models with Bins
WriteBinName(f, "WriteBin: ", WritePrefix) ;
for i in 1 to NumBins loop -- CovBinPtr.all'range
if CovBinPtr(i).action = COV_COUNT or
- (CovBinPtr(i).action = COV_ILLEGAL and WriteAnyIllegal = ENABLED) or
+ (CovBinPtr(i).action = COV_ILLEGAL and IsEnabled(WriteAnyIllegal)) or
CovBinPtr(i).count < 0 -- Illegal bin with errors
then
-- WriteBin Info
@@ -2692,7 +2731,7 @@ package body CoveragePkg is
if CovBinPtr(i).Name.all /= "" then
swrite(buf, CovBinPtr(i).Name.all & " ") ;
end if ;
- if WritePassFail = ENABLED then
+ if IsEnabled(WritePassFail) then
-- For illegal bins, AtLeast = 0 and count is negative.
if CovBinPtr(i).count >= CovBinPtr(i).AtLeast then
swrite(buf, PassName & ' ') ;
@@ -2700,7 +2739,7 @@ package body CoveragePkg is
swrite(buf, FailName & ' ') ;
end if ;
end if ;
- if WriteBinInfo = ENABLED then
+ if IsEnabled(WriteBinInfo) then
if CovBinPtr(i).action = COV_COUNT then
swrite(buf, "Bin:") ;
else
@@ -2708,7 +2747,7 @@ package body CoveragePkg is
end if;
write(buf, CovBinPtr(i).BinVal.all) ;
end if ;
- if WriteCount = ENABLED then
+ if IsEnabled(WriteCount) then
write(buf, " Count = " & integer'image(abs(CovBinPtr(i).count))) ;
write(buf, " AtLeast = " & integer'image(CovBinPtr(i).AtLeast)) ;
if WeightMode = WEIGHT or WeightMode = REMAIN_WEIGHT then
@@ -2723,104 +2762,26 @@ package body CoveragePkg is
writeline(f, buf) ;
end procedure WriteBin ;
---=== REMOVE BEFORE RELEASE
--- ------------------------------------------------------------
--- -- pt local for now -- file formal parameter not allowed with method
--- procedure WriteBin ( file f : text ) is
--- ------------------------------------------------------------
--- variable buf : line ;
--- begin
--- WriteBinName(f, "WriteBin: ") ;
--- if NumBins < 1 then
--- swrite(buf, "%%FATAL, Coverage Model is empty. Nothing to print.") ;
--- writeline(f, buf) ;
--- report "Coverage model is empty. Nothing to print." severity failure ;
--- end if ;
--- for i in 1 to NumBins loop -- CovBinPtr.all'range
--- if CovBinPtr(i).count < 0 then
--- if CovBinPtr(i).Name.all = "" then
--- swrite(buf, "%% Illegal Bin:") ;
--- else
--- swrite(buf, "%% " & CovBinPtr(i).Name.all) ;
--- swrite(buf, " Illegal Bin:") ;
--- end if ;
--- write(buf, CovBinPtr(i).BinVal.all) ;
--- write(buf, " Count = " & integer'image(-CovBinPtr(i).count)) ;
--- write(buf, "" & LF) ;
--- elsif CovBinPtr(i).action = COV_COUNT then
--- if CovBinPtr(i).Name.all = "" then
--- swrite(buf, "%% Bin:") ;
--- else
--- swrite(buf, "%% " & CovBinPtr(i).Name.all) ;
--- swrite(buf, " Bin:") ;
--- end if ;
--- write(buf, CovBinPtr(i).BinVal.all) ;
--- write(buf, " Count = " & integer'image(CovBinPtr(i).count)) ;
--- write(buf, " AtLeast = " & integer'image(CovBinPtr(i).AtLeast)) ;
--- if WeightMode = WEIGHT or WeightMode = REMAIN_WEIGHT then
--- -- Print Weight only when it is used
--- write(buf, " Weight = " & integer'image(CovBinPtr(i).Weight)) ;
--- end if ;
--- writeline(f, buf) ;
--- end if ;
--- end loop ;
--- swrite(buf, "") ;
--- writeline(f, buf) ;
--- end procedure WriteBin ;
- ------------------------------------------------------------
- -- PT Local
- function ResolveReportOptions (
- ------------------------------------------------------------
- ParmOption : CovOptionsType ;
- GlobalOption : CovOptionsType
- ) return CovOptionsType is
- begin
- if ParmOption /= COV_OPT_DEFAULT then
- return ParmOption ;
- else
- return GlobalOption ;
- end if ;
- end function ResolveReportOptions ;
-
- ------------------------------------------------------------
- -- PT Local
- function ResolveReportOptions (
- ------------------------------------------------------------
- ParmOption : string ;
- LocalOption : string ;
- GlobalOption : string
- ) return string is
- begin
- if ParmOption /= "" then
- return ParmOption ;
- elsif LocalOption /= "" then
- return LocalOption ;
- else
- return GlobalOption ;
- end if ;
- end function ResolveReportOptions ;
-
-
------------------------------------------------------------
procedure WriteBin (
------------------------------------------------------------
- WritePassFail : CovOptionsType := COV_OPT_DEFAULT ;
- WriteBinInfo : CovOptionsType := COV_OPT_DEFAULT ;
- WriteCount : CovOptionsType := COV_OPT_DEFAULT ;
- WriteAnyIllegal : CovOptionsType := COV_OPT_DEFAULT ;
- WritePrefix : string := "" ;
- PassName : string := "" ;
- FailName : string := ""
+ WritePassFail : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteBinInfo : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteCount : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteAnyIllegal : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WritePrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
) is
- constant rWritePassFail : CovOptionsType := ResolveReportOptions(WritePassFail, WritePassFailVar) ;
- constant rWriteBinInfo : CovOptionsType := ResolveReportOptions(WriteBinInfo, WriteBinInfoVar) ;
- constant rWriteCount : CovOptionsType := ResolveReportOptions(WriteCount, WriteCountVar) ;
- constant rWriteAnyIllegal : CovOptionsType := ResolveReportOptions(WriteAnyIllegal, WriteAnyIllegalVar) ;
- constant rWritePrefix : string := ResolveReportOptions(WritePrefix, WritePrefixVar.Get, INIT_WRITE_PREFIX) ;
- constant rPassName : string := ResolveReportOptions(PassName, PassNameVar.Get, INIT_PASS_NAME) ;
- constant rFailName : string := ResolveReportOptions(FailName, FailNameVar.Get, INIT_FAIL_NAME) ;
- begin
- if WriteBinFileInit then
+ constant rWritePassFail : CovOptionsType := ResolveCovWritePassFail(WritePassFail, WritePassFailVar) ;
+ constant rWriteBinInfo : CovOptionsType := ResolveCovWriteBinInfo(WriteBinInfo, WriteBinInfoVar ) ;
+ constant rWriteCount : CovOptionsType := ResolveCovWriteCount(WriteCount, WriteCountVar ) ;
+ constant rWriteAnyIllegal : CovOptionsType := ResolveCovWriteAnyIllegal(WriteAnyIllegal, WriteAnyIllegalVar) ;
+ constant rWritePrefix : string := ResolveOsvvmWritePrefix(WritePrefix, WritePrefixVar.GetOpt) ;
+ constant rPassName : string := ResolveOsvvmPassName(PassName, PassNameVar.GetOpt ) ;
+ constant rFailName : string := ResolveOsvvmFailName(FailName, FailNameVar.GetOpt ) ;
+ begin
+ if WriteBinFileInit then -- WriteBin File defined Coverage Model (deprecated)
WriteBin (
f => WriteBinFile,
WritePassFail => rWritePassFail,
@@ -2831,6 +2792,17 @@ package body CoveragePkg is
PassName => rPassName,
FailName => rFailName
) ;
+ elsif IsTranscriptEnabled then
+ WriteBin (
+ f => TranscriptFile,
+ WritePassFail => rWritePassFail,
+ WriteBinInfo => rWriteBinInfo,
+ WriteCount => rWriteCount,
+ WriteAnyIllegal => rWriteAnyIllegal,
+ WritePrefix => rWritePrefix,
+ PassName => rPassName,
+ FailName => rFailName
+ ) ;
else
WriteBin (
f => OUTPUT,
@@ -2843,31 +2815,60 @@ package body CoveragePkg is
FailName => rFailName
) ;
end if ;
+
end procedure WriteBin ;
-
+
+ ------------------------------------------------------------
+ procedure WriteBin ( -- With LogLevel
+ ------------------------------------------------------------
+ LogLevel : LogType ;
+ WritePassFail : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteBinInfo : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteCount : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteAnyIllegal : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WritePrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
+ ) is
+ begin
+ if IsLoggingEnabled(AlertLogIDVar, LogLevel) then
+ WriteBin (
+ WritePassFail => WritePassFail,
+ WriteBinInfo => WriteBinInfo,
+ WriteCount => WriteCount,
+ WriteAnyIllegal => WriteAnyIllegal,
+ WritePrefix => WritePrefix,
+ PassName => PassName,
+ FailName => FailName
+ ) ;
+ end if ;
+ end procedure WriteBin ; -- With LogLevel
+
+
------------------------------------------------------------
procedure WriteBin (
------------------------------------------------------------
FileName : string;
OpenKind : File_Open_Kind := APPEND_MODE ;
- WritePassFail : CovOptionsType := COV_OPT_DEFAULT ;
- WriteBinInfo : CovOptionsType := COV_OPT_DEFAULT ;
- WriteCount : CovOptionsType := COV_OPT_DEFAULT ;
- WriteAnyIllegal : CovOptionsType := COV_OPT_DEFAULT ;
- WritePrefix : string := "" ;
- PassName : string := "" ;
- FailName : string := ""
+ WritePassFail : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteBinInfo : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteCount : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteAnyIllegal : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WritePrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
) is
file LocalWriteBinFile : text open OpenKind is FileName ;
- constant rWritePassFail : CovOptionsType := ResolveReportOptions(WritePassFail, WritePassFailVar) ;
- constant rWriteBinInfo : CovOptionsType := ResolveReportOptions(WriteBinInfo, WriteBinInfoVar) ;
- constant rWriteCount : CovOptionsType := ResolveReportOptions(WriteCount, WriteCountVar) ;
- constant rWriteAnyIllegal : CovOptionsType := ResolveReportOptions(WriteAnyIllegal, WriteAnyIllegalVar) ;
- constant rWritePrefix : string := ResolveReportOptions(WritePrefix, WritePrefixVar.Get, INIT_WRITE_PREFIX) ;
- constant rPassName : string := ResolveReportOptions(PassName, PassNameVar.Get, INIT_PASS_NAME) ;
- constant rFailName : string := ResolveReportOptions(FailName, FailNameVar.Get, INIT_FAIL_NAME) ;
- begin
+ constant rWritePassFail : CovOptionsType := ResolveCovWritePassFail(WritePassFail, WritePassFailVar) ;
+ constant rWriteBinInfo : CovOptionsType := ResolveCovWriteBinInfo(WriteBinInfo, WriteBinInfoVar ) ;
+ constant rWriteCount : CovOptionsType := ResolveCovWriteCount(WriteCount, WriteCountVar ) ;
+ constant rWriteAnyIllegal : CovOptionsType := ResolveCovWriteAnyIllegal(WriteAnyIllegal, WriteAnyIllegalVar) ;
+ constant rWritePrefix : string := ResolveOsvvmWritePrefix(WritePrefix, WritePrefixVar.GetOpt) ;
+ constant rPassName : string := ResolveOsvvmPassName(PassName, PassNameVar.GetOpt ) ;
+ constant rFailName : string := ResolveOsvvmFailName(FailName, FailNameVar.GetOpt ) ;
+ begin
+ UsingLocalFile := TRUE ;
WriteBin (
f => LocalWriteBinFile,
WritePassFail => rWritePassFail,
@@ -2877,10 +2878,44 @@ package body CoveragePkg is
WritePrefix => rWritePrefix,
PassName => rPassName,
FailName => rFailName
- ) ;
+ );
+ UsingLocalFile := FALSE ;
end procedure WriteBin ;
+ ------------------------------------------------------------
+ procedure WriteBin ( -- With LogLevel
+ ------------------------------------------------------------
+ LogLevel : LogType ;
+ FileName : string;
+ OpenKind : File_Open_Kind := APPEND_MODE ;
+ WritePassFail : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteBinInfo : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteCount : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WriteAnyIllegal : CovOptionsType := COV_OPT_INIT_PARM_DETECT ;
+ WritePrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
+ ) is
+ begin
+ if IsLoggingEnabled(AlertLogIDVar, LogLevel) then
+ UsingLocalFile := TRUE ;
+ WriteBin (
+ FileName => FileName,
+ OpenKind => OpenKind,
+ WritePassFail => WritePassFail,
+ WriteBinInfo => WriteBinInfo,
+ WriteCount => WriteCount,
+ WriteAnyIllegal => WriteAnyIllegal,
+ WritePrefix => WritePrefix,
+ PassName => PassName,
+ FailName => FailName
+ ) ;
+ UsingLocalFile := FALSE ;
+ end if ;
+ end procedure WriteBin ; -- With LogLevel
+
+
------------------------------------------------------------
-- Development only
-- pt local for now -- file formal parameter not allowed with method
@@ -2921,13 +2956,17 @@ package body CoveragePkg is
------------------------------------------------------------
- procedure DumpBin is
+ procedure DumpBin (LogLevel : LogType := DEBUG) is
------------------------------------------------------------
begin
- if WriteBinFileInit then
- DumpBin(WriteBinFile) ;
- else
- DumpBin(OUTPUT) ;
+ if IsLoggingEnabled(AlertLogIDVar, LogLevel) then
+ if WriteBinFileInit then
+ DumpBin(WriteBinFile) ;
+ elsif IsTranscriptEnabled then
+ DumpBin(TranscriptFile) ;
+ else
+ DumpBin(OUTPUT) ;
+ end if ;
end if ;
end procedure DumpBin ;
@@ -2939,11 +2978,14 @@ package body CoveragePkg is
variable buf : line ;
begin
if NumBins < 1 then
- swrite(buf, "%% ") ;
- swrite(buf, GetName) ;
- swrite(buf, "WriteBin, FATAL, Coverage Model is empty. Nothing to print.") ;
- writeline(f, buf) ;
- report "WriteBin: Coverage model is empty. Nothing to print." severity failure ;
+ if WriteBinFileInit or UsingLocalFile then
+ -- Duplicate Alert in specified file
+ swrite(buf, "%% FAILURE CoverageModel") ;
+ swrite(buf, GetName) ;
+ swrite(buf, "CoveragePkg.WriteCovHoles, FATAL, coverage model empty. Nothing to print.") ;
+ writeline(f, buf) ;
+ end if ;
+ Alert(AlertLogIDVar, "CoverageModel " & GetName & " coverage model empty. Nothing to print. In CoveragePkg.WriteCovHoles", FAILURE) ;
return ;
end if ;
-- Models with Bins
@@ -2971,13 +3013,17 @@ package body CoveragePkg is
------------------------------------------------------------
- procedure WriteCovHoles is
+ procedure WriteCovHoles ( LogLevel : LogType := ALWAYS ) is
------------------------------------------------------------
begin
- if WriteBinFileInit then
- WriteCovHoles(WriteBinFile, CovTarget) ;
- else
- WriteCovHoles(OUTPUT, CovTarget) ;
+ if IsLoggingEnabled(AlertLogIDVar, LogLevel) then
+ if WriteBinFileInit then
+ WriteCovHoles(WriteBinFile, CovTarget) ;
+ elsif IsTranscriptEnabled then
+ WriteCovHoles(TranscriptFile, CovTarget) ;
+ else
+ WriteCovHoles(OUTPUT, CovTarget) ;
+ end if;
end if;
end procedure WriteCovHoles ;
@@ -2988,18 +3034,42 @@ package body CoveragePkg is
begin
if WriteBinFileInit then
WriteCovHoles(WriteBinFile, PercentCov) ;
+ elsif IsTranscriptEnabled then
+ WriteCovHoles(TranscriptFile, PercentCov) ;
else
WriteCovHoles(OUTPUT, PercentCov) ;
end if;
end procedure WriteCovHoles ;
+ ------------------------------------------------------------
+ procedure WriteCovHoles ( LogLevel : LogType ; PercentCov : real ) is
+ ------------------------------------------------------------
+ begin
+ if IsLoggingEnabled(AlertLogIDVar, LogLevel) then
+ WriteCovHoles(PercentCov) ;
+ end if;
+ end procedure WriteCovHoles ;
+
+
------------------------------------------------------------
procedure WriteCovHoles ( FileName : string; OpenKind : File_Open_Kind := APPEND_MODE ) is
------------------------------------------------------------
file CovHoleFile : text open OpenKind is FileName ;
begin
+ UsingLocalFile := TRUE ;
WriteCovHoles(CovHoleFile, CovTarget) ;
+ UsingLocalFile := FALSE ;
+ end procedure WriteCovHoles ;
+
+
+ ------------------------------------------------------------
+ procedure WriteCovHoles ( LogLevel : LogType ; FileName : string; OpenKind : File_Open_Kind := APPEND_MODE ) is
+ ------------------------------------------------------------
+ begin
+ if IsLoggingEnabled(AlertLogIDVar, LogLevel) then
+ WriteCovHoles(FileName, OpenKind) ;
+ end if;
end procedure WriteCovHoles ;
@@ -3008,7 +3078,19 @@ package body CoveragePkg is
------------------------------------------------------------
file CovHoleFile : text open OpenKind is FileName ;
begin
- WriteCovHoles(CovHoleFile, PercentCov) ;
+ UsingLocalFile := TRUE ;
+ WriteCovHoles(CovHoleFile, PercentCov) ;
+ UsingLocalFile := FALSE ;
+ end procedure WriteCovHoles ;
+
+
+ ------------------------------------------------------------
+ procedure WriteCovHoles ( LogLevel : LogType ; FileName : string; PercentCov : real ; OpenKind : File_Open_Kind := APPEND_MODE ) is
+ ------------------------------------------------------------
+ begin
+ if IsLoggingEnabled(AlertLogIDVar, LogLevel) then
+ WriteCovHoles(FileName, PercentCov, OpenKind) ;
+ end if;
end procedure WriteCovHoles ;
@@ -3080,59 +3162,65 @@ package body CoveragePkg is
variable iMergingEnable : boolean ;
begin
- ReadLoop0 : while not EndFile(CovDbFile) loop
+ -- ReadLoop0 : while not EndFile(CovDbFile) loop
+ ReadLoop0 : loop -- allows emulation of "return when"
+ -- ReadLine to Get Coverage Model Name, skip blank and comment lines, fails when file empty
+ exit when AlertIf(EndFile(CovDbFile), AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: No Coverage Data to read", FAILURE) ;
ReadLine(CovDbFile, buf) ;
EmptyOrCommentLine(buf, Empty) ;
next when Empty ;
if buf.all /= "Coverage_Model_Not_Named" then
- Name.Set(buf.all) ;
+ SetName(buf.all) ;
end if ;
exit ReadLoop0 ;
end loop ReadLoop0 ;
- ReadLoop1 : while not EndFile(CovDbFile) loop
+ -- ReadLoop1 : while not EndFile(CovDbFile) loop
+ ReadLoop1 : loop
+ -- ReadLine to Get Variables, skip blank and comment lines, fails when file empty
+ exit when AlertIf(EndFile(CovDbFile), AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Coverage DB File Incomplete", FAILURE) ;
ReadLine(CovDbFile, buf) ;
EmptyOrCommentLine(buf, Empty) ;
next when Empty ;
read(buf, iSeed, ReadValid) ;
- exit ReadLoop1 when failed(not ReadValid, "ReadCovDb: Failed while reading Seed") ;
+ exit when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading Seed", FAILURE) ;
RV.SetSeed( iSeed ) ;
RvSeedInit := TRUE ;
read(buf, iCovThreshold, ReadValid) ;
- exit ReadLoop1 when failed(not ReadValid, "ReadCovDb: Failed while reading CovThreshold") ;
+ exit when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading CovThreshold", FAILURE) ;
CovThreshold := iCovThreshold ;
read(buf, iIllegalMode, ReadValid) ;
- exit ReadLoop1 when failed(not ReadValid, "ReadCovDb: Failed while reading IllegalMode") ;
- IllegalMode := IllegalModeType'val( iIllegalMode ) ;
+ exit when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading IllegalMode", FAILURE) ;
+ SetIllegalMode(IllegalModeType'val( iIllegalMode )) ;
read(buf, iWeightMode, ReadValid) ;
- exit ReadLoop1 when failed(not ReadValid, "ReadCovDb: Failed while reading WeightMode") ;
+ exit when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading WeightMode", FAILURE) ;
WeightMode := WeightModeType'val( iWeightMode ) ;
read(buf, iWeightScale, ReadValid) ;
- exit ReadLoop1 when failed(not ReadValid, "ReadCovDb: Failed while reading WeightScale") ;
+ exit when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading WeightScale", FAILURE) ;
WeightScale := iWeightScale ;
read(buf, iCountMode, ReadValid) ;
- exit ReadLoop1 when failed(not ReadValid, "ReadCovDb: Failed while reading CountMode") ;
+ exit when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading CountMode", FAILURE) ;
CountMode := CountModeType'val( iCountMode ) ;
read(buf, iThresholdingEnable, ReadValid) ;
- exit ReadLoop1 when failed(not ReadValid, "ReadCovDb: Failed while reading CountMode") ;
+ exit when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading CountMode", FAILURE) ;
ThresholdingEnable := iThresholdingEnable ;
read(buf, iCovTarget, ReadValid) ;
- exit ReadLoop1 when failed(not ReadValid, "ReadCovDb: Failed while reading CountMode") ;
+ exit when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading CountMode", FAILURE) ;
CovTarget := iCovTarget ;
read(buf, iMergingEnable, ReadValid) ;
- exit ReadLoop1 when failed(not ReadValid, "ReadCovDb: Failed while reading CountMode") ;
+ exit when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading CountMode", FAILURE) ;
MergingEnable := iMergingEnable ;
exit ReadLoop1 ;
@@ -3140,16 +3228,19 @@ package body CoveragePkg is
GoodLoop1 := ReadValid ;
- ReadLoop2 : while not EndFile(CovDbFile) loop
+ -- ReadLoop2 : while not EndFile(CovDbFile) loop
+ ReadLoop2 : while ReadValid loop
+ -- ReadLine to Coverage Model Header WriteBin Message, skip blank and comment lines, fails when file empty
+ exit when AlertIf(EndFile(CovDbFile), AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Coverage DB File Incomplete", FAILURE) ;
ReadLine(CovDbFile, buf) ;
EmptyOrCommentLine(buf, Empty) ;
next when Empty ;
read(buf, iNumberOfMessages, ReadValid) ;
- exit ReadLoop2 when failed(not ReadValid, "ReadCovDb: Failed while reading NumberOfMessages") ;
+ exit when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading NumberOfMessages", FAILURE) ;
for i in 1 to iNumberOfMessages loop
- exit ReadLoop2 when failed(EndFile(CovDbFile), "ReadCovDb: End of File while reading Messages") ;
+ exit when AlertIf(EndFile(CovDbFile), AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: End of File while reading Messages", FAILURE) ;
ReadLine(CovDbFile, buf) ;
SetMessage(buf.all) ;
end loop ;
@@ -3175,17 +3266,17 @@ package body CoveragePkg is
variable Empty : boolean ;
begin
- ReadLoop : while not EndFile(CovDbFile) loop
+ ReadLoop : loop
+ -- ReadLine to RangeItems NumLines, skip blank and comment lines, fails when file empty
+ exit when AlertIf(EndFile(CovDbFile), AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Coverage DB File Incomplete", FAILURE) ;
ReadLine(CovDbFile, buf) ;
EmptyOrCommentLine(buf, Empty) ;
next when Empty ;
read(buf, NumRangeItems, ReadValid) ;
- exit ReadLoop when failed(not ReadValid, "ReadCovDb: Failed while reading NumRangeItems") ;
+ exit when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading NumRangeItems", FAILURE) ;
read(buf, NumLines, ReadValid) ;
- assert ReadValid
- report "ReadCovDb: Failed while reading NumLines"
- severity failure ;
+ exit when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading NumLines", FAILURE) ;
exit ;
end loop ReadLoop ;
Good := ReadValid ;
@@ -3219,28 +3310,33 @@ package body CoveragePkg is
begin
GrowBins(NumLines) ;
ReadLoop : for i in 1 to NumLines loop
- exit ReadLoop when failed(EndFile(CovDbFile), "ReadCovDb: Did not read specified number of lines") ;
- ReadLine(CovDbFile, buf) ;
- EmptyOrCommentLine(buf, Empty) ;
- next when Empty ; -- replace with EmptyLine(buf)
+
+ GetValidLineLoop: loop
+ exit ReadLoop when AlertIf(EndFile(CovDbFile), AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg..ReadCovDb: Did not read specified number of lines", FAILURE) ;
+ ReadLine(CovDbFile, buf) ;
+ EmptyOrCommentLine(buf, Empty) ;
+ next GetValidLineLoop when Empty ; -- replace with EmptyLine(buf)
+ exit GetValidLineLoop ;
+ end loop ;
read(buf, Action, ReadValid) ;
- exit ReadLoop when failed(not ReadValid, "ReadCovDb: Failed while reading Action") ;
+ exit ReadLoop when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading Action", FAILURE) ;
read(buf, Count, ReadValid) ;
- exit ReadLoop when failed(not ReadValid, "ReadCovDb: Failed while reading Count") ;
+ exit ReadLoop when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading Count", FAILURE) ;
read(buf, AtLeast, ReadValid) ;
- exit ReadLoop when failed(not ReadValid, "ReadCovDb: Failed while reading AtLeast") ;
+ exit ReadLoop when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading AtLeast", FAILURE) ;
read(buf, Weight, ReadValid) ;
- exit ReadLoop when failed(not ReadValid, "ReadCovDb: Failed while reading Weight") ;
+ exit ReadLoop when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading Weight", FAILURE) ;
read(buf, PercentCov, ReadValid) ;
- exit ReadLoop when failed(not ReadValid, "ReadCovDb: Failed while reading PercentCov") ;
+ exit ReadLoop when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading PercentCov", FAILURE) ;
read(buf, BinVal, ReadValid) ;
- exit ReadLoop when failed(not ReadValid, "ReadCovDb: Failed while reading BinVal") ;
+ exit ReadLoop when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading BinVal", FAILURE) ;
read(buf, NameLength, ReadValid) ;
- exit ReadLoop when failed(not ReadValid, "ReadCovDb: Failed while reading Count") ;
+ exit ReadLoop when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading Bin Name Length", FAILURE) ;
read(buf, SkipBlank, ReadValid) ;
- exit ReadLoop when failed(not ReadValid, "ReadCovDb: Failed while reading Count") ;
+ exit ReadLoop when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading Bin Name Length", FAILURE) ;
read(buf, NamePtr, NameLength, ReadValid) ;
+ exit ReadLoop when AlertIfNot(ReadValid, AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.ReadCovDb: Failed while reading Bin Name", FAILURE) ;
index := FindExactBin(Merge, BinVal, Action, AtLeast, Weight, NamePtr.all) ;
if index > 0 then
-- Bin is an exact match so only merge the count values
@@ -3302,8 +3398,8 @@ package body CoveragePkg is
variable buf : line ;
begin
-- write coverage private variables to the file
- if Name.IsSet then
- write(buf, Name.Get) ;
+ if CovNameVar.IsSet then
+ write(buf, GetName) ;
else
swrite(buf, "Coverage_Model_Not_Named") ;
end if ;
@@ -3328,7 +3424,7 @@ package body CoveragePkg is
write(buf, MergingEnable) ; -- boolean
write(buf, ' ') ;
writeline(CovDbFile, buf) ;
- write(buf, Message.GetCount ) ;
+ write(buf, CovMessageVar.GetCount ) ;
writeline(CovDbFile, buf) ;
WriteBinName(CovDbFile, "", "") ;
end procedure WriteCovDbVars ;
@@ -3378,7 +3474,11 @@ package body CoveragePkg is
-- Format: Action Count min1 max1 min2 max2
file CovDbFile : text open OpenKind is FileName ;
begin
- WriteCovDb(CovDbFile) ;
+ if NumBins >= 1 then
+ WriteCovDb(CovDbFile) ;
+ else
+ Alert(AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.WriteCovDb when no bins defined ", FAILURE) ;
+ end if ;
end procedure WriteCovDb ;
@@ -3666,8 +3766,7 @@ package body CoveragePkg is
CovBinPtr(BinIndex).Count ) ;
when others =>
- report "Selected Weight Mode not Supported with depricated RandCovPoint(AtLeast), see RandCovPoint(PercentCov)"
- severity failure ;
+ Alert(AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.CalcWeight Selected Weight Mode not Supported with depricated RandCovPoint(AtLeast), see RandCovPoint(PercentCov)", FAILURE) ;
return MaxAtLeast - CovBinPtr(BinIndex).Count ;
end case ;
@@ -3769,10 +3868,10 @@ package body CoveragePkg is
end if ;
end if ;
end loop CovLoop ;
- write(buf, "%%Error GetHoleBinVal did not find hole. " &
+ Alert(AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.GetHoleBinVal did not find hole. " &
"HoleCount = " & integer'image(HoleCount) &
- "ReqHoleNum = " & integer'image(ReqHoleNum) & LF) ;
- writeline(OUTPUT, buf) ;
+ "ReqHoleNum = " & integer'image(ReqHoleNum), ERROR
+ ) ;
return CovBinPtr(NumBins).BinVal.all ;
end function GetHoleBinVal ;
@@ -3795,9 +3894,14 @@ package body CoveragePkg is
begin
WriteBinName(f, "WriteCovHoles: ") ;
if NumBins < 1 then
- swrite(buf, "%%FATAL, Coverage Model is empty. Nothing to print.") ;
- writeline(f, buf) ;
- report "Coverage model is empty. Nothing to print." severity failure ;
+ if WriteBinFileInit or UsingLocalFile then
+ -- Duplicate Alert in specified file
+ swrite(buf, "%% FAILURE CoverageModel ") ;
+ swrite(buf, GetName) ;
+ swrite(buf, "CoverageModel " & GetName & " CoveragePkg.WriteCovHoles: coverage model is empty. Nothing to print.") ;
+ writeline(f, buf) ;
+ end if ;
+ Alert(AlertLogIDVar, "CoverageModel " & GetName & " CoveragePkg.WriteCovHoles: coverage model is empty. Nothing to print.", FAILURE) ;
end if ;
CovLoop : for i in 1 to NumBins loop
-- minAtLeast := minimum(AtLeast,CovBinPtr(i).AtLeast) ;
@@ -3826,12 +3930,25 @@ package body CoveragePkg is
begin
if WriteBinFileInit then
WriteCovHoles(WriteBinFile, AtLeast) ;
+ elsif IsTranscriptEnabled then
+ WriteCovHoles(TranscriptFile, AtLeast) ;
else
WriteCovHoles(OUTPUT, AtLeast) ;
end if;
end procedure WriteCovHoles ;
+ ------------------------------------------------------------
+ -- Deprecated. New versions use PercentCov.
+ procedure WriteCovHoles ( LogLevel : LogType ; AtLeast : integer ) is
+ ------------------------------------------------------------
+ begin
+ if IsLoggingEnabled(AlertLogIDVar, LogLevel) then
+ WriteCovHoles(AtLeast) ;
+ end if;
+ end procedure WriteCovHoles ;
+
+
------------------------------------------------------------
-- Deprecated. New versions use PercentCov.
procedure WriteCovHoles ( FileName : string; AtLeast : integer ; OpenKind : File_Open_Kind := APPEND_MODE ) is
@@ -3841,6 +3958,16 @@ package body CoveragePkg is
WriteCovHoles(CovHoleFile, AtLeast) ;
end procedure WriteCovHoles ;
+ ------------------------------------------------------------
+ -- Deprecated. New versions use PercentCov.
+ procedure WriteCovHoles ( LogLevel : LogType ; FileName : string; AtLeast : integer ; OpenKind : File_Open_Kind := APPEND_MODE ) is
+ ------------------------------------------------------------
+ begin
+ if IsLoggingEnabled(AlertLogIDVar, LogLevel) then
+ WriteCovHoles(FileName, AtLeast, OpenKind) ;
+ end if;
+ end procedure WriteCovHoles ;
+
end protected body CovPType ;
------------------------------------------------------------------------------------------
@@ -3860,14 +3987,17 @@ package body CoveragePkg is
variable BinInfo1, BinInfo2 : CovBinBaseType ;
variable BinVal1, BinVal2 : RangeArrayType(1 to Bin1.GetBinValLength) ;
variable buf : line ;
+ variable iAlertLogID : AlertLogIDType ;
begin
+ iAlertLogID := Bin1.GetAlertLogID ;
+
NumBins1 := Bin1.GetNumBins ;
NumBins2 := Bin2.GetNumBins ;
if (NumBins1 /= NumBins2) then
- write(buf, "Bins have different lengths" & LF) ;
- writeline(OUTPUT, buf) ;
ErrorCount := ErrorCount + 1 ;
+ print("CoverageModels " & Bin1.GetName & " and " & Bin2.GetName &
+ " CoveragePkg.CompareBins, Bins have different lengths") ;
return ;
end if ;
@@ -3877,27 +4007,46 @@ package body CoveragePkg is
BinVal1 := Bin1.GetBinVal(i) ;
BinVal2 := Bin2.GetBinVal(i) ;
if BinInfo1 /= BinInfo2 or BinVal1 /= BinVal2 then
- ErrorCount := ErrorCount + 1 ;
write(buf, "%% Bin:" & integer'image(i) & " miscompare." & LF) ;
- writeline(OUTPUT, buf) ;
+ -- writeline(OUTPUT, buf) ;
swrite(buf, "%% Bin1: ") ;
write(buf, BinVal1) ;
write(buf, " Action = " & integer'image(BinInfo1.action)) ;
write(buf, " Count = " & integer'image(BinInfo1.count)) ;
write(buf, " AtLeast = " & integer'image(BinInfo1.AtLeast)) ;
- write(buf, " Weight = " & integer'image(BinInfo1.Weight)) ;
- writeline(OUTPUT, buf) ;
+ write(buf, " Weight = " & integer'image(BinInfo1.Weight) & LF ) ;
+ -- writeline(OUTPUT, buf) ;
swrite(buf, "%% Bin2: ") ;
write(buf, BinVal2) ;
write(buf, " Action = " & integer'image(BinInfo2.action)) ;
write(buf, " Count = " & integer'image(BinInfo2.count)) ;
write(buf, " AtLeast = " & integer'image(BinInfo2.AtLeast)) ;
- write(buf, " Weight = " & integer'image(BinInfo2.Weight)) ;
- writeline(OUTPUT, buf) ;
+ write(buf, " Weight = " & integer'image(BinInfo2.Weight) & LF ) ;
+ -- writeline(OUTPUT, buf) ;
+ ErrorCount := ErrorCount + 1 ;
+ writeline(buf) ;
+ -- Alert(iAlertLogID, buf.all, ERROR) ;
+ -- deallocate(buf) ;
end if ;
end loop ;
end procedure CompareBins ;
-
+
+
+ ------------------------------------------------------------
+ -- Experimental. Intended primarily for development.
+ procedure CompareBins (
+ ------------------------------------------------------------
+ variable Bin1 : inout CovPType ;
+ variable Bin2 : inout CovPType
+ ) is
+ variable ErrorCount : integer ;
+ variable iAlertLogID : AlertLogIDType ;
+ begin
+ CompareBins(Bin1, Bin2, ErrorCount) ;
+ iAlertLogID := Bin1.GetAlertLogID ;
+ AlertIf(ErrorCount /= 0, "CoverageModels " & Bin1.GetName & " and " & Bin2.GetName &
+ " miscompared. CoveragePkg.CompareBins") ;
+ end procedure CompareBins ;
------------------------------------------------------------
-- package local, Used by GenBin, IllegalBin, and IgnoreBin
@@ -3914,13 +4063,11 @@ package body CoveragePkg is
variable rMax, rCurMin, rNextMin, rNumItemsInBin, rRemainingBins : real ; -- must be real
begin
if Min > Max then
- report "MakeBin (GenBin, IllegalBin, IgnoreBin): Min must be <= Max"
- severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "CoveragePkg.MakeBin (GenBin, IllegalBin, IgnoreBin): Min must be <= Max", FAILURE) ;
return NULL_BIN ;
elsif NumBin <= 0 then
- report "MakeBin (GenBin, IllegalBin, IgnoreBin): NumBin must be <= 0"
- severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "CoveragePkg.MakeBin (GenBin, IllegalBin, IgnoreBin): NumBin must be <= 0", FAILURE) ;
return NULL_BIN ;
elsif NumBin = 1 then
@@ -3971,8 +4118,7 @@ package body CoveragePkg is
begin
if A'length <= 0 then
- report "MakeBin (GenBin, IllegalBin, IgnoreBin): integer_vector parameter must have values"
- severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "CoveragePkg.MakeBin (GenBin, IllegalBin, IgnoreBin): integer_vector parameter must have values", FAILURE) ;
return NULL_BIN ;
else
@@ -4162,41 +4308,7 @@ package body CoveragePkg is
end function IllegalBin ;
- ----------------------------------------------------------
- -- function IgnoreBin (
- ----------------------------------------------------------
- -- AtLeast : integer ;
- -- Weight : integer ;
- -- Min, Max : integer ;
- -- NumBin : integer
- -- ) return CovBinType is
- -- begin
- -- return MakeBin(
- -- Min => Min,
- -- Max => Max,
- -- NumBin => NumBin,
- -- AtLeast => AtLeast,
- -- Weight => Weight,
- -- Action => COV_IGNORE
- -- ) ;
- -- end function IgnoreBin ;
-
-
- ----------------------------------------------------------
- -- function IgnoreBin (AtLeast : integer ; Min, Max, NumBin : integer) return CovBinType is
- ----------------------------------------------------------
- -- begin
- -- return MakeBin(
- -- Min => Min,
- -- Max => Max,
- -- NumBin => NumBin,
- -- AtLeast => AtLeast,
- -- Weight => 0,
- -- Action => COV_IGNORE
- -- ) ;
- -- end function IgnoreBin ;
-
-
+-- IgnoreBin should never have an AtLeast parameter
------------------------------------------------------------
function IgnoreBin (Min, Max, NumBin : integer) return CovBinType is
------------------------------------------------------------
@@ -4243,22 +4355,6 @@ package body CoveragePkg is
end function IgnoreBin ;
--- ------------------------------------------------------------
--- function GenBin (
--- -- Manual entry format for CovBin within lots of extra parens
--- ------------------------------------------------------------
--- ManualBin : CovBinManualType
--- ) return CovBinType is
--- alias imBin : CovBinManualType (1 to ManualBin'length) is ManualBin ;
--- variable iCovBin : CovBinType(imBin'range) ;
--- begin
--- for i in iCovBin'range loop
--- iCovBin(i) := ( (1 => (imBin(i)(0),imBin(i)(1))), imBin(i)(2), 0, 1, 1) ;
--- end loop ;
--- return iCovBin ;
--- end function GenBin ;
-
-
------------------------------------------------------------
function GenCross( -- 2
-- Cross existing bins
diff --git a/CoveragePkg_user_guide.pdf b/CoveragePkg_user_guide.pdf
deleted file mode 100644
index 99769f9..0000000
Binary files a/CoveragePkg_user_guide.pdf and /dev/null differ
diff --git a/MessagePkg.vhd b/MessagePkg.vhd
index c4c853a..c2b5735 100644
--- a/MessagePkg.vhd
+++ b/MessagePkg.vhd
@@ -1,7 +1,7 @@
--
-- File Name: MessagePkg.vhd
-- Design Unit Name: MessagePkg
--- Revision: STANDARD VERSION, revision 2014.01
+-- Revision: STANDARD VERSION, revision 2015.01
--
-- Maintainer: Jim Lewis email: jim@synthworks.com
-- Contributor(s):
@@ -25,9 +25,10 @@
-- 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.
+-- 01/2015: 2015.01 Removed initialized parameter from Get
--
--
--- Copyright (c) 2010 - 2014 by SynthWorks Design Inc. All rights reserved.
+-- Copyright (c) 2010 - 2015 by SynthWorks Design Inc. All rights reserved.
--
-- Verbatim copies of this source file may be used and
-- distributed without restriction.
@@ -46,6 +47,8 @@
-- If not download it from,
-- http://www.perlfoundation.org/artistic_license_2_0
--
+use work.OsvvmGlobalPkg.all ;
+use work.AlertLogPkg.all ;
library ieee ;
use ieee.std_logic_1164.all ;
@@ -58,7 +61,7 @@ package MessagePkg is
type MessagePType is protected
procedure Set (MessageIn : String) ;
- impure function Get (ItemNumber : integer := 1) return string ;
+ impure function Get (ItemNumber : integer) return string ;
impure function GetCount return integer ;
impure function IsSet return boolean ;
procedure Clear ; -- clear message
@@ -67,6 +70,11 @@ package MessagePkg is
end protected MessagePType ;
end package MessagePkg ;
+
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+
package body MessagePkg is
-- Local Data Structure Types
@@ -102,18 +110,18 @@ package body MessagePkg is
end procedure Set ;
------------------------------------------------------------
- impure function Get (ItemNumber : integer := 1) return string is
+ impure function Get (ItemNumber : integer) return string is
------------------------------------------------------------
begin
if MessageCount > 0 then
if ItemNumber >= 1 and ItemNumber <= MessageCount then
return MessagePtr(ItemNumber).all ;
else
- report LF & "%% MessagePkg:MessagePType.GetMessage input value out of range" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "%% MessagePkg.Get input value out of range", FAILURE) ;
return "" ; -- error if this happens
end if ;
else
- report LF & "%% MessagePkg:MessagePType.GetMessage message is not set" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "%% MessagePkg.Get message is not set", FAILURE) ;
return "" ; -- error if this happens
end if ;
end function Get ;
@@ -153,7 +161,4 @@ package body MessagePkg is
end procedure Clear ;
end protected body MessagePType ;
-
-end package body MessagePkg ;
-
-
+end package body MessagePkg ;
\ No newline at end of file
diff --git a/NamePkg.vhd b/NamePkg.vhd
index 47ae89f..8addae2 100644
--- a/NamePkg.vhd
+++ b/NamePkg.vhd
@@ -25,7 +25,7 @@
-- 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.
+-- 12/2014: 2014.07a Removed initialized pointers which can lead to memory leaks.
--
--
-- Copyright (c) 2010 - 2014 by SynthWorks Design Inc. All rights reserved.
@@ -55,15 +55,19 @@ package NamePkg is
type NamePType is protected
procedure Set (NameIn : String) ;
impure function Get return string ;
+ impure function GetOpt 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
-
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+
+package body NamePkg is
type NamePType is protected body
variable NamePtr : line ;
@@ -87,6 +91,17 @@ package body NamePkg is
end if ;
end function Get ;
+ ------------------------------------------------------------
+ impure function GetOpt return string is
+ ------------------------------------------------------------
+ begin
+ if NamePtr = NULL then
+ return NUL & "" ;
+ else
+ return NamePtr.all ;
+ end if ;
+ end function GetOpt ;
+
------------------------------------------------------------
impure function IsSet return boolean is
------------------------------------------------------------
diff --git a/OsvvmContext.vhd b/OsvvmContext.vhd
new file mode 100644
index 0000000..ab3868b
--- /dev/null
+++ b/OsvvmContext.vhd
@@ -0,0 +1,57 @@
+--
+-- File Name: OsvvmContext.vhd
+-- Design Unit Name: OsvvmContext
+-- Revision: STANDARD VERSION, revision 2015.01
+--
+-- Maintainer: Jim Lewis email: jim@synthworks.com--
+--
+-- Description
+-- Context Declaration for OSVVM packages
+--
+-- Developed by/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: For more details, see CoveragePkg_release_notes.pdf
+-- Date Version Description
+-- 01/2015 2015.01 Initial Revision
+--
+--
+-- Copyright (c) 2015 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
+--
+--
+
+context OsvvmContext is
+ library OSVVM ;
+
+ use OSVVM.NamePkg.all ;
+ use OSVVM.TranscriptPkg.all ;
+ use OSVVM.OsvvmGlobalPkg.all ;
+ use OSVVM.AlertLogPkg.all ;
+ use OSVVM.RandomPkg.all ;
+ use OSVVM.CoveragePkg.all ;
+
+end context OsvvmContext ;
+
diff --git a/OsvvmGlobalPkg.vhd b/OsvvmGlobalPkg.vhd
new file mode 100644
index 0000000..562d99d
--- /dev/null
+++ b/OsvvmGlobalPkg.vhd
@@ -0,0 +1,339 @@
+--
+-- File Name: OsvvmGlobalPkg.vhd
+-- Design Unit Name: OsvvmGlobalPkg
+-- Revision: STANDARD VERSION, revision 2015.01
+--
+-- Maintainer: Jim Lewis email: jim@synthworks.com
+-- Contributor(s):
+-- Jim Lewis jim@synthworks.com
+--
+--
+-- Description:
+-- Global Settings for OSVVM packages
+--
+--
+-- Developed for:
+-- SynthWorks Design Inc.
+-- VHDL Training Classes
+-- 11898 SW 128th Ave. Tigard, Or 97223
+-- http://www.SynthWorks.com
+--
+-- Revision History:
+-- Date Version Description
+-- 01/2014: 2015.01 Initial revision
+--
+--
+-- Copyright (c) 2015 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
+--
+
+library ieee ;
+use std.textio.all ;
+
+use work.NamePkg.all ;
+
+package OsvvmGlobalPkg is
+ -- FILE IO Global File Identifier -- Open using AlertLogPkg.TranscriptOpen
+-- file TranscriptFile : text ;
+
+ -- Shared Options Type used in OSVVM
+ type OsvvmOptionsType is (OPT_INIT_PARM_DETECT, OPT_USE_DEFAULT, DISABLED, FALSE, ENABLED, TRUE) ;
+ function IsEnabled (A : OsvvmOptionsType) return boolean ; -- Requires that TRUE is last and ENABLED is 2nd to last
+
+ -- Defaults for String values
+ constant OSVVM_DEFAULT_ALERT_PREFIX : string := "%% Alert" ;
+ constant OSVVM_DEFAULT_LOG_PREFIX : string := "%% Log " ;
+ constant OSVVM_DEFAULT_WRITE_PREFIX : string := "%% " ;
+ constant OSVVM_DEFAULT_DONE_NAME : string := "DONE" ;
+ constant OSVVM_DEFAULT_PASS_NAME : string := "PASSED" ;
+ constant OSVVM_DEFAULT_FAIL_NAME : string := "FAILED" ;
+ constant OSVVM_STRING_INIT_PARM_DETECT : string := NUL & NUL & NUL ;
+ constant OSVVM_STRING_USE_DEFAULT : string := NUL & "" ;
+
+ -- Coverage Settings
+ constant OSVVM_DEFAULT_WRITE_PASS_FAIL : OsvvmOptionsType := FALSE ;
+ constant OSVVM_DEFAULT_WRITE_BIN_INFO : OsvvmOptionsType := TRUE ;
+ constant OSVVM_DEFAULT_WRITE_COUNT : OsvvmOptionsType := TRUE ;
+ constant OSVVM_DEFAULT_WRITE_ANY_ILLEGAL : OsvvmOptionsType := FALSE ;
+
+ ------------------------------------------------------------
+ procedure SetOsvvmGlobalOptions (
+ ------------------------------------------------------------
+ WritePassFail : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteBinInfo : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteCount : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAnyIllegal : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
+ WritePrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ DoneName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
+ ) ;
+
+ ------------------------------------------------------------
+ -- Accessor Functions
+ function ResolveOsvvmOption(A, B, C : OsvvmOptionsType) return OsvvmOptionsType ;
+ function ResolveOsvvmOption(A, B, C, D : OsvvmOptionsType) return OsvvmOptionsType ;
+ function IsOsvvmStringSet (A : string) return boolean ;
+ function ResolveOsvvmOption(A, B : string) return string ;
+ function ResolveOsvvmOption(A, B, C : string) return string ;
+ function ResolveOsvvmOption(A, B, C, D : string) return string ;
+
+ impure function ResolveOsvvmWritePrefix(A : String) return string ;
+ impure function ResolveOsvvmWritePrefix(A, B : String) return string ;
+ impure function ResolveOsvvmDoneName(A : String) return string ;
+ impure function ResolveOsvvmDoneName(A, B : String) return string ;
+ impure function ResolveOsvvmPassName(A : String) return string ;
+ impure function ResolveOsvvmPassName(A, B : String) return string ;
+ impure function ResolveOsvvmFailName(A : String) return string ;
+ impure function ResolveOsvvmFailName(A, B : String) return string ;
+
+ impure function ResolveCovWritePassFail(A, B : OsvvmOptionsType) return OsvvmOptionsType ; -- Cov
+ impure function ResolveCovWriteBinInfo(A, B : OsvvmOptionsType) return OsvvmOptionsType ; -- Cov
+ impure function ResolveCovWriteCount(A, B : OsvvmOptionsType) return OsvvmOptionsType ; -- Cov
+ impure function ResolveCovWriteAnyIllegal(A, B : OsvvmOptionsType) return OsvvmOptionsType ; -- Cov
+
+ procedure OsvvmDeallocate ;
+
+ type OptionsPType is protected
+ procedure Set (A: OsvvmOptionsType) ;
+ impure function get return OsvvmOptionsType ;
+ end protected OptionsPType ;
+end OsvvmGlobalPkg ;
+
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+
+package body OsvvmGlobalPkg is
+ type OptionsPType is protected body
+ variable GlobalVar : OsvvmOptionsType ;
+ procedure Set (A : OsvvmOptionsType) is
+ begin
+ GlobalVar := A ;
+ end procedure Set ;
+ impure function get return OsvvmOptionsType is
+ begin
+ return GlobalVar ;
+ end function get ;
+ end protected body OptionsPType ;
+
+ shared variable WritePrefixVar : NamePType ;
+ shared variable DoneNameVar : NamePType ;
+ shared variable PassNameVar : NamePType ;
+ shared variable FailNameVar : NamePType ;
+ shared variable WritePassFailVar : OptionsPType ; -- := FALSE ;
+ shared variable WriteBinInfoVar : OptionsPType ; -- := TRUE ;
+ shared variable WriteCountVar : OptionsPType ; -- := TRUE ;
+ shared variable WriteAnyIllegalVar : OptionsPType ; -- := FALSE ;
+
+ function IsEnabled (A : OsvvmOptionsType) return boolean is
+ begin
+ return A >= ENABLED ;
+ end function IsEnabled ;
+
+ ------------------------------------------------------------
+ procedure SetOsvvmGlobalOptions (
+ ------------------------------------------------------------
+ WritePassFail : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteBinInfo : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteCount : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
+ WriteAnyIllegal : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
+ WritePrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ DoneName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ PassName : string := OSVVM_STRING_INIT_PARM_DETECT ;
+ FailName : string := OSVVM_STRING_INIT_PARM_DETECT
+ ) is
+ begin
+ if WritePassFail /= OPT_INIT_PARM_DETECT then
+ WritePassFailVar.Set(WritePassFail) ;
+ end if ;
+ if WriteBinInfo /= OPT_INIT_PARM_DETECT then
+ WriteBinInfoVar.Set(WriteBinInfo) ;
+ end if ;
+ if WriteCount /= OPT_INIT_PARM_DETECT then
+ WriteCountVar.Set(WriteCount) ;
+ end if ;
+ if WriteAnyIllegal /= OPT_INIT_PARM_DETECT then
+ WriteAnyIllegalVar.Set(WriteAnyIllegal) ;
+ end if ;
+ if WritePrefix /= OSVVM_STRING_INIT_PARM_DETECT then
+ WritePrefixVar.Set(WritePrefix) ;
+ end if ;
+ if DoneName /= OSVVM_STRING_INIT_PARM_DETECT then
+ DoneNameVar.Set(DoneName) ;
+ end if ;
+ if PassName /= OSVVM_STRING_INIT_PARM_DETECT then
+ PassNameVar.Set(PassName) ;
+ end if ;
+ if FailName /= OSVVM_STRING_INIT_PARM_DETECT then
+ FailNameVar.Set(FailName) ;
+ end if ;
+ end procedure SetOsvvmGlobalOptions ;
+
+ ------------------------------------------------------------
+ -- Accessor Functions
+ -- Local Function
+ function IsOsvvmOptionSet (A : OsvvmOptionsType) return boolean is
+ begin
+ return A > OPT_USE_DEFAULT ;
+ end function IsOsvvmOptionSet ;
+
+ function ResolveOsvvmOption(A, B, C : OsvvmOptionsType) return OsvvmOptionsType is
+ begin
+ if IsOsvvmOptionSet(A) then
+ return A ;
+ elsif IsOsvvmOptionSet(B) then
+ return B ;
+ else
+ return C ;
+ end if ;
+ end function ResolveOsvvmOption ;
+
+ function ResolveOsvvmOption(A, B, C, D : OsvvmOptionsType) return OsvvmOptionsType is
+ begin
+ if IsOsvvmOptionSet(A) then
+ return A ;
+ elsif IsOsvvmOptionSet(B) then
+ return B ;
+ elsif IsOsvvmOptionSet(C) then
+ return C ;
+ else
+ return D ;
+ end if ;
+ end function ResolveOsvvmOption ;
+
+ -- Local Function
+ function IsOsvvmStringSet (A : string) return boolean is
+ begin
+ if A'length = 0 then -- Null strings permitted
+ return TRUE ;
+ else
+ return A(A'left) /= NUL ;
+ end if;
+ end function IsOsvvmStringSet ;
+
+ function ResolveOsvvmOption(A, B : string) return string is
+ begin
+ if IsOsvvmStringSet(A) then
+ return A ;
+ else
+ return B ;
+ end if ;
+ end function ResolveOsvvmOption ;
+
+ function ResolveOsvvmOption(A, B, C : string) return string is
+ begin
+ if IsOsvvmStringSet(A) then
+ return A ;
+ elsif IsOsvvmStringSet(B) then
+ return B ;
+ else
+ return C ;
+ end if ;
+ end function ResolveOsvvmOption ;
+
+ function ResolveOsvvmOption(A, B, C, D : string) return string is
+ begin
+ if IsOsvvmStringSet(A) then
+ return A ;
+ elsif IsOsvvmStringSet(B) then
+ return B ;
+ elsif IsOsvvmStringSet(C) then
+ return C ;
+ else
+ return D ;
+ end if ;
+ end function ResolveOsvvmOption ;
+
+
+ impure function ResolveOsvvmWritePrefix(A : String) return string is
+ begin
+ return ResolveOsvvmOption(A, WritePrefixVar.GetOpt, OSVVM_DEFAULT_WRITE_PREFIX) ;
+ end function ResolveOsvvmWritePrefix ;
+
+ impure function ResolveOsvvmWritePrefix(A, B : String) return string is
+ begin
+ return ResolveOsvvmOption(A, B, WritePrefixVar.GetOpt, OSVVM_DEFAULT_WRITE_PREFIX) ;
+ end function ResolveOsvvmWritePrefix ;
+
+ impure function ResolveOsvvmDoneName(A : String) return string is
+ begin
+ return ResolveOsvvmOption(A, DoneNameVar.GetOpt, OSVVM_DEFAULT_DONE_NAME) ;
+ end function ResolveOsvvmDoneName ;
+
+ impure function ResolveOsvvmDoneName(A, B : String) return string is
+ begin
+ return ResolveOsvvmOption(A, DoneNameVar.GetOpt, OSVVM_DEFAULT_DONE_NAME) ;
+ end function ResolveOsvvmDoneName ;
+
+ impure function ResolveOsvvmPassName(A : String) return string is
+ begin
+ return ResolveOsvvmOption(A, PassNameVar.GetOpt, OSVVM_DEFAULT_PASS_NAME) ;
+ end function ResolveOsvvmPassName ;
+
+ impure function ResolveOsvvmPassName(A, B : String) return string is
+ begin
+ return ResolveOsvvmOption(A, B, PassNameVar.GetOpt, OSVVM_DEFAULT_PASS_NAME) ;
+ end function ResolveOsvvmPassName ;
+
+ impure function ResolveOsvvmFailName(A : String) return string is
+ begin
+ return ResolveOsvvmOption(A, FailNameVar.GetOpt, OSVVM_DEFAULT_FAIL_NAME) ;
+ end function ResolveOsvvmFailName ;
+
+ impure function ResolveOsvvmFailName(A, B : String) return string is
+ begin
+ return ResolveOsvvmOption(A, B, FailNameVar.GetOpt, OSVVM_DEFAULT_FAIL_NAME) ;
+ end function ResolveOsvvmFailName ;
+
+ impure function ResolveCovWritePassFail(A, B : OsvvmOptionsType) return OsvvmOptionsType is
+ begin
+ return ResolveOsvvmOption(A, B, WritePassFailVar.Get, OSVVM_DEFAULT_WRITE_PASS_FAIL) ;
+ end function ResolveCovWritePassFail ; -- Cov
+
+ impure function ResolveCovWriteBinInfo(A, B : OsvvmOptionsType) return OsvvmOptionsType is
+ begin
+ return ResolveOsvvmOption(A, B, WriteBinInfoVar.Get, OSVVM_DEFAULT_WRITE_BIN_INFO) ;
+ end function ResolveCovWriteBinInfo ; -- Cov
+
+ impure function ResolveCovWriteCount(A, B : OsvvmOptionsType) return OsvvmOptionsType is
+ begin
+ return ResolveOsvvmOption(A, B, WriteCountVar.Get, OSVVM_DEFAULT_WRITE_COUNT) ;
+ end function ResolveCovWriteCount ; -- Cov
+
+ impure function ResolveCovWriteAnyIllegal(A, B : OsvvmOptionsType) return OsvvmOptionsType is
+ begin
+ return ResolveOsvvmOption(A, B, WriteAnyIllegalVar.Get, OSVVM_DEFAULT_WRITE_ANY_ILLEGAL) ;
+ end function ResolveCovWriteAnyIllegal ; -- Cov
+
+ procedure OsvvmDeallocate is
+ begin
+ -- Free up space used by NamePType within OsvvmGlobalPkg
+ WritePrefixVar.Deallocate ;
+ DoneNameVar.Deallocate ;
+ PassNameVar.Deallocate ;
+ FailNameVar.Deallocate ;
+ WritePassFailVar.Set(FALSE) ; -- := FALSE ;
+ WriteBinInfoVar.Set(TRUE ) ; -- := TRUE ;
+ WriteCountVar.Set(TRUE ) ; -- := TRUE ;
+ WriteAnyIllegalVar.Set(FALSE) ; -- := FALSE ;
+
+ end procedure OsvvmDeallocate ;
+
+end package body OsvvmGlobalPkg ;
\ No newline at end of file
diff --git a/README.md b/README.md
index 5505414..fe22de3 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,8 @@ 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
+
+ - 23.03.2015 - **2015.03** OSVVM VHDL sources, release notes, and User’s Guide for RandomPkg, CoveragePkg, AlertLogPkg, TranscriptPkg, and OsvvmGlobalPkg.
- 16.12.2014 - **2014.07a** OSVVM VHDL sources, CoveragePkg User’s Guide, RandomPkg User’s Guide, and release notes.1
- 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 and sample designs2.
diff --git a/RandomBasePkg.vhd b/RandomBasePkg.vhd
index ed13126..528f6c0 100644
--- a/RandomBasePkg.vhd
+++ b/RandomBasePkg.vhd
@@ -1,7 +1,7 @@
--
-- File Name: RandomBasePkg.vhd
-- Design Unit Name: RandomBasePkg
--- Revision: STANDARD VERSION, revision 2013.05
+-- Revision: STANDARD VERSION, revision 2015.01
--
-- Maintainer: Jim Lewis email: jim@synthworks.com
-- Contributor(s):
@@ -38,9 +38,10 @@
-- Fixed abstraction by moving RandomParmType to RandomPkg.vhd
-- 4/2013 2013.04 No Changes
-- 5/2013 2013.05 No Changes
+-- 1/2015 2015.01 Changed Assert/Report to Alert
--
--
--- Copyright (c) 2008 - 2013 by SynthWorks Design Inc. All rights reserved.
+-- Copyright (c) 2008 - 2015 by SynthWorks Design Inc. All rights reserved.
--
-- Verbatim copies of this source file may be used and
-- distributed without restriction.
@@ -64,6 +65,9 @@ library ieee ;
use ieee.math_real.all ;
use std.textio.all ;
+use work.OsvvmGlobalPkg.all ;
+use work.AlertLogPkg.all ;
+
-- comment out following 2 lines with VHDL-2008. Leave in for VHDL-2002
-- library ieee_proposed ; -- remove with VHDL-2008
-- use ieee_proposed.standard_additions.all ; -- remove with VHDL-2008
@@ -93,8 +97,11 @@ package RandomBasePkg is
procedure read (variable L: inout line ; A : out RandomSeedType ) ;
end RandomBasePkg ;
- -----------------------------------------------------------------
- -----------------------------------------------------------------
+
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+
package body RandomBasePkg is
-----------------------------------------------------------------
@@ -134,7 +141,7 @@ package body RandomBasePkg is
constant SEED2_MAX : integer := 2147483398 ;
begin
if iIV'Length <= 0 then -- no seed
- report "%%FATAL: GenRandSeed received NULL integer_vector" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomBasePkg.GenRandSeed received NULL integer_vector", FAILURE) ;
return (3, 17) ; -- if continue seed = (3, 17)
elsif iIV'Length = 1 then -- one seed value
@@ -205,22 +212,22 @@ package body RandomBasePkg is
-----------------------------------------------------------------
procedure read(variable L: inout line ; A : out RandomSeedType ; good : out boolean ) is
- variable iGood : boolean ;
+ variable iReadValid : boolean ;
begin
for i in A'range loop
- read(L, A(i), iGood) ;
- exit when not iGood ;
+ read(L, A(i), iReadValid) ;
+ exit when not iReadValid ;
end loop ;
- good := iGood ;
+ good := iReadValid ;
end procedure read ;
-----------------------------------------------------------------
procedure read(variable L: inout line ; A : out RandomSeedType ) is
- variable good : boolean ;
+ variable ReadValid : boolean ;
begin
- read(L, A, good) ;
- assert good report "read[line, RandomSeedType] failed" severity error ;
+ read(L, A, ReadValid) ;
+ AlertIfNot(ReadValid, OSVVM_ALERTLOG_ID, "RandomBasePkg.read[line, RandomSeedType] failed", FAILURE) ;
end procedure read ;
end RandomBasePkg ;
\ No newline at end of file
diff --git a/RandomPkg.vhd b/RandomPkg.vhd
index e0f2a85..9f4de18 100644
--- a/RandomPkg.vhd
+++ b/RandomPkg.vhd
@@ -1,7 +1,7 @@
--
-- File Name : RandomPkg.vhd
-- Design Unit Name : RandomPkg
--- Revision : STANDARD VERSION, revision 2014.01
+-- Revision : STANDARD VERSION, revision 2015.01
--
-- Maintainer : Jim Lewis email : jim@synthworks.com
-- Contributor(s) :
@@ -28,29 +28,24 @@
-- Revision History :
-- Date Version Description
-- 12/2006 : 0.1 Initial revision
--- Numerous revisions for VHDL Testbenches and Verification
+-- Numerous revisions for SynthWorks' Advanced VHDL Testbenches and Verification
-- 02/2009 : 1.0 First Public Released Version
-- 02/25/2009 1.1 Replaced reference to std_2008 with a reference to
-- ieee_proposed.standard_additions.all ;
-- 06/2010 1.2 Added Normal and Poisson distributions
--- 03/2011 2.0 Major clean-up.
--- Moved RandomParmType and control to here
+-- 03/2011 2.0 Major clean-up. Moved RandomParmType and control to here
-- 07/2011 2.1 Bug fix to convenience functions for slv, unsigned, and signed.
-- 06/2012 2.2 Removed '_' in the name of subprograms FavorBig and FavorSmall
--- to make more consistent with other subprogram names
--- 04/2013 2013.04 Changed DistInt
--- Now returns input array range.
--- For literals, no impact. It still returns 0 to N-1 (the default array range)
--- Impacts named constants, signals, or variables.
--- Added error checking to weight values
+-- 04/2013 2013.04 Changed DistInt. Return array indices now match input
-- Better Min, Max error handling in Uniform, FavorBig, FavorSmall, Normal, Poisson
-- 5/2013 - Removed extra variable declaration in functions RandInt and RandReal
-- 5/2013 2013.05 Big vector randomization added overloading RandUnsigned, RandSlv, and RandSigned
-- Added NULL_RANGE_TYPE to minimize null range warnings
-- 1/2014 2014.01 Added RandTime, RandReal(set), RandIntV, RandRealV, RandTimeV
-- Made sort, revsort from SortListPkg_int visible via aliases
+-- 1/2015 2015.01 Changed Assert/Report to Alert
--
--- Copyright (c) 2006 - 2014 by SynthWorks Design Inc. All rights reserved.
+-- Copyright (c) 2006 - 2015 by SynthWorks Design Inc. All rights reserved.
--
-- Verbatim copies of this source file may be used and
-- distributed without restriction.
@@ -70,6 +65,8 @@
-- http ://www.perlfoundation.org/artistic_license_2_0
--
+use work.OsvvmGlobalPkg.all ;
+use work.AlertLogPkg.all ;
use work.RandomBasePkg.all ;
use work.SortListPkg_int.all ;
@@ -215,7 +212,6 @@ package RandomPkg is
Exclude : integer_vector := NULL_INTV
) return integer ;
-
-- randomization with a range
impure function RandInt (Min, Max : integer) return integer ;
impure function RandReal(Min, Max : Real) return real ;
@@ -229,7 +225,6 @@ package RandomPkg is
impure function RandTimeV (Min, Max : time ; Size : natural ; Unit : time := ns) return time_vector ;
impure function RandTimeV (Min, Max : time ; Unique : natural ; Size : natural ; Unit : time := ns) return time_vector ;
-
-- randomization with a range and exclude vector
impure function RandInt (Min, Max : integer ; Exclude : integer_vector ) return integer ;
impure function RandTime (Min, Max : time ; Exclude : time_vector ; Unit : time := ns) return time ;
@@ -241,7 +236,6 @@ package RandomPkg is
impure function RandTimeV (Min, Max : time ; Exclude : time_vector ; Size : natural ; Unit : in time := ns) return time_vector ;
impure function RandTimeV (Min, Max : time ; Exclude : time_vector ; Unique : natural ; Size : natural ; Unit : in time := ns) return time_vector ;
-
-- Randomly select a value within a set of values
impure function RandInt ( A : integer_vector ) return integer ;
impure function RandReal ( A : real_vector ) return real ;
@@ -256,7 +250,6 @@ package RandomPkg is
impure function RandTimeV (A : time_vector ; Size : natural) return time_vector ;
impure function RandTimeV (A : time_vector ; Unique : natural ; Size : natural) return time_vector ;
-
-- Randomly select a value within a set of values with exclude values (so can skip last or last n)
impure function RandInt ( A, Exclude : integer_vector ) return integer ;
impure function RandReal ( A, Exclude : real_vector ) return real ;
@@ -271,7 +264,6 @@ package RandomPkg is
impure function RandTimeV (A, Exclude : time_vector ; Size : natural) return time_vector ;
impure function RandTimeV (A, Exclude : time_vector ; Unique : natural ; Size : natural) return time_vector ;
-
-- Randomly select between 0 and N-1 based on the specified weight.
-- where N = number values in weight array
impure function DistInt ( Weight : integer_vector ) return integer ;
@@ -279,28 +271,24 @@ package RandomPkg is
impure function DistUnsigned ( Weight : integer_vector ; Size : natural ) return unsigned ;
impure function DistSigned ( Weight : integer_vector ; Size : natural ) return signed ;
-
-- Distribution with just weights and with exclude values
impure function DistInt ( Weight : integer_vector ; Exclude : integer_vector ) return integer ;
impure function DistSlv ( Weight : integer_vector ; Exclude : integer_vector ; Size : natural ) return std_logic_vector ;
impure function DistUnsigned ( Weight : integer_vector ; Exclude : integer_vector ; Size : natural ) return unsigned ;
impure function DistSigned ( Weight : integer_vector ; Exclude : integer_vector ; Size : natural ) return signed ;
-
-- Distribution with weight and value
impure function DistValInt ( A : DistType ) return integer ;
impure function DistValSlv ( A : DistType ; Size : natural) return std_logic_vector ;
impure function DistValUnsigned ( A : DistType ; Size : natural) return unsigned ;
impure function DistValSigned ( A : DistType ; Size : natural) return signed ;
-
-- Distribution with weight and value and with exclude values
impure function DistValInt ( A : DistType ; Exclude : integer_vector ) return integer ;
impure function DistValSlv ( A : DistType ; Exclude : integer_vector ; Size : natural) return std_logic_vector ;
impure function DistValUnsigned ( A : DistType ; Exclude : integer_vector ; Size : natural) return unsigned ;
impure function DistValSigned ( A : DistType ; Exclude : integer_vector ; Size : natural) return signed ;
-
-- Large vector handling.
impure function RandUnsigned (Size : natural) return unsigned ;
impure function RandSlv (Size : natural) return std_logic_vector ;
@@ -312,7 +300,6 @@ package RandomPkg is
impure function RandSlv (Min, Max : std_logic_vector) return std_logic_vector ;
impure function RandSigned (Min, Max : signed) return signed ;
-
-- Convenience Functions
impure function RandReal return real ; -- 0.0 to 1.0
impure function RandReal(Max : Real) return real ; -- 0.0 to Max
@@ -325,8 +312,10 @@ package RandomPkg is
end RandomPkg ;
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+
package body RandomPkg is
-----------------------------------------------------------------
@@ -482,10 +471,10 @@ package body RandomPkg is
-----------------------------------------------------------------
procedure read(variable L : inout line ; A : out RandomDistType ) is
- variable good : boolean ;
+ variable ReadValid : boolean ;
begin
- read(L, A, good) ;
- assert good report "read[line, RandomDistType] failed" severity error ;
+ read(L, A, ReadValid) ;
+ AlertIfNot( ReadValid, OSVVM_ALERTLOG_ID, "RandomPkg.read[line, RandomDistType] failed", FAILURE) ;
end procedure read ;
@@ -529,10 +518,10 @@ package body RandomPkg is
-----------------------------------------------------------------
procedure read(variable L : inout line ; A : out RandomParmType ) is
- variable good : boolean ;
+ variable ReadValid : boolean ;
begin
- read(L, A, good) ;
- assert good report "read[line, RandomParmType] failed" severity error ;
+ read(L, A, ReadValid) ;
+ AlertIfNot( ReadValid, OSVVM_ALERTLOG_ID, "RandomPkg.read[line, RandomParmType] failed", FAILURE) ;
end procedure read ;
@@ -629,7 +618,7 @@ package body RandomPkg is
impure function Uniform (Min, Max : in real) return real is
variable rRandomVal : real ;
begin
- assert (Max >= Min) report "%%RandomPkg Uniform : Max < Min" severity FAILURE ;
+ AlertIf (Max < Min, OSVVM_ALERTLOG_ID, "RandomPkg.Uniform: Max < Min", FAILURE) ;
Uniform(rRandomVal, RandomSeed) ;
return scale(rRandomVal, Min, Max) ;
end function Uniform ;
@@ -637,7 +626,7 @@ package body RandomPkg is
impure function Uniform (Min, Max : integer) return integer is
variable rRandomVal : real ;
begin
- assert (Max >= Min) report "%%RandomPkg Uniform : Max < Min" severity FAILURE ;
+ AlertIf (Max < Min, OSVVM_ALERTLOG_ID, "RandomPkg.Uniform: Max < Min", FAILURE) ;
Uniform(rRandomVal, RandomSeed) ;
return scale(rRandomVal, Min, Max) ;
end function Uniform ;
@@ -668,7 +657,7 @@ package body RandomPkg is
impure function FavorSmall (Min, Max : real) return real is
variable rRandomVal : real ;
begin
- assert (Max >= Min) report "%%RandomPkg FavorSmall : Max < Min" severity FAILURE ;
+ AlertIf (Max < Min, OSVVM_ALERTLOG_ID, "RandomPkg.FavorSmall: Max < Min", FAILURE) ;
Uniform(rRandomVal, RandomSeed) ;
return scale(FavorSmall(rRandomVal), Min, Max) ; -- real
end function FavorSmall ;
@@ -676,7 +665,7 @@ package body RandomPkg is
impure function FavorSmall (Min, Max : integer) return integer is
variable rRandomVal : real ;
begin
- assert (Max >= Min) report "%%RandomPkg FavorSmall : Max < Min" severity FAILURE ;
+ AlertIf (Max < Min, OSVVM_ALERTLOG_ID, "RandomPkg.FavorSmall: Max < Min", FAILURE) ;
Uniform(rRandomVal, RandomSeed) ;
return scale(FavorSmall(rRandomVal), Min, Max) ; -- integer
end function FavorSmall ;
@@ -707,7 +696,7 @@ package body RandomPkg is
impure function FavorBig (Min, Max : real) return real is
variable rRandomVal : real ;
begin
- assert (Max >= Min) report "%%RandomPkg FavorBig : Max < Min" severity FAILURE ;
+ AlertIf (Max < Min, OSVVM_ALERTLOG_ID, "RandomPkg.FavorBig: Max < Min", FAILURE) ;
Uniform(rRandomVal, RandomSeed) ;
return scale(FavorBig(rRandomVal), Min, Max) ; -- real
end function FavorBig ;
@@ -715,7 +704,7 @@ package body RandomPkg is
impure function FavorBig (Min, Max : integer) return integer is
variable rRandomVal : real ;
begin
- assert (Max >= Min) report "%%RandomPkg FavorBig : Max < Min" severity FAILURE ;
+ AlertIf (Max < Min, OSVVM_ALERTLOG_ID, "RandomPkg.FavorBig: Max < Min", FAILURE) ;
Uniform(rRandomVal, RandomSeed) ;
return scale(FavorBig(rRandomVal), Min, Max) ; -- integer
end function FavorBig ;
@@ -754,7 +743,7 @@ package body RandomPkg is
begin
-- add this check to set parameters?
if StdDeviation < 0.0 then
- report "standard deviation must be >= 0.0" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.Normal: Standard deviation must be >= 0.0", FAILURE) ;
return -1.0 ;
end if ;
@@ -789,7 +778,7 @@ package body RandomPkg is
variable rRandomVal : real ;
begin
if Max < Min then
- report "%%RandomPkg Normal : Max < Min" severity FAILURE ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.Normal: Max < Min", FAILURE) ;
else
loop
rRandomVal := Normal (Mean, StdDeviation) ;
@@ -810,7 +799,7 @@ package body RandomPkg is
variable iRandomVal : integer ;
begin
if Max < Min then
- report "%%RandomPkg Normal : Max < Min" severity FAILURE ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.Normal: Max < Min", FAILURE) ;
else
loop
iRandomVal := integer(round( Normal(Mean, StdDeviation) )) ;
@@ -841,7 +830,7 @@ package body RandomPkg is
-- add this check to set parameters?
if Mean <= 0.0 or Bound <= 0.0 then
- report "Poisson : Mean < 0 or too large. Mean = " & real'image(Mean) severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.Poisson: Mean < 0 or too large. Mean = " & real'image(Mean), FAILURE) ;
return -1.0 ;
end if ;
@@ -858,7 +847,7 @@ package body RandomPkg is
variable rRandomVal : real ;
begin
if Max < Min then
- report "%%RandomPkg Poisson : Max < Min" severity FAILURE ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.Poisson: Max < Min", FAILURE) ;
else
loop
rRandomVal := Poisson (Mean) ;
@@ -877,7 +866,7 @@ package body RandomPkg is
variable iRandomVal : integer ;
begin
if Max < Min then
- report "%%RandomPkg Poisson : Max < Min" severity FAILURE ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.Poisson: Max < Min", FAILURE) ;
else
loop
iRandomVal := integer(round( Poisson (Mean) )) ;
@@ -902,7 +891,7 @@ package body RandomPkg is
when NORMAL => return Normal(RandomParm.Mean, RandomParm.StdDeviation, Min, Max) ;
when POISSON => return Poisson(RandomParm.Mean, Min, Max) ;
when others =>
- report "RandomPkg : distribution not implemented" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.RandInt: RandomParm.Distribution not implemented", FAILURE) ;
return integer'low ;
end case ;
end function RandInt ;
@@ -920,7 +909,7 @@ package body RandomPkg is
when NORMAL => return Normal(RandomParm.Mean, RandomParm.StdDeviation, Min, Max) ;
when POISSON => return Poisson(RandomParm.Mean, Min, Max) ;
when others =>
- report "RandomPkg : distribution not implemented" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.RandReal: Specified RandomParm.Distribution not implemented", FAILURE) ;
return real(integer'low) ;
end case ;
end function RandReal ;
@@ -964,7 +953,7 @@ package body RandomPkg is
-- if Unique = 0, it is more efficient to call RandIntV(Min, Max, Size)
iUnique := Unique ;
if Max-Min+1 < Unique then
- report "RandIntV / RandRealV / RandTimeV: Unique > number of values available" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.(RandIntV | RandRealV | RandTimeV): Unique > number of values available", FAILURE) ;
iUnique := Max-Min+1 ;
end if ;
for i in result'range loop
@@ -1011,7 +1000,7 @@ package body RandomPkg is
when NORMAL => return Normal(RandomParm.Mean, RandomParm.StdDeviation, Min, Max, Exclude) ;
when POISSON => return Poisson(RandomParm.Mean, Min, Max, Exclude) ;
when others =>
- report "RandomPkg : distribution not implemented" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.RandInt: Specified RandomParm.Distribution not implemented", FAILURE) ;
return integer'low ;
end case ;
end function RandInt ;
@@ -1125,7 +1114,7 @@ package body RandomPkg is
-- require A'length >= Unique
iUnique := Unique ;
if A'length < Unique then
- report "RandIntV: Unique > length of set of values" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.RandIntV: Unique > length of set of values", FAILURE) ;
iUnique := A'length ;
end if ;
for i in result'range loop
@@ -1256,7 +1245,7 @@ package body RandomPkg is
-- Require NewALength >= Unique
iUnique := Unique ;
if NewALength < Unique then
- report "RandIntV: Unique > Length of Set A - Exclude" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.RandIntV: Unique > Length of Set A - Exclude", FAILURE) ;
iUnique := NewALength ;
end if ;
-- Randomize using exclude list of Unique # of newly generated values
@@ -1291,7 +1280,7 @@ package body RandomPkg is
-- Require NewALength >= Unique
iUnique := Unique ;
if NewALength < Unique then
- report "RandRealV: Unique > Length of Set A - Exclude" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.RandRealV: Unique > Length of Set A - Exclude", FAILURE) ;
iUnique := NewALength ;
end if ;
-- Randomize using exclude list of Unique # of newly generated values
@@ -1326,7 +1315,7 @@ package body RandomPkg is
-- Require NewALength >= Unique
iUnique := Unique ;
if NewALength < Unique then
- report "RandTimeV: Unique > Length of Set A - Exclude" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.RandTimeV: Unique > Length of Set A - Exclude", FAILURE) ;
iUnique := NewALength ;
end if ;
-- Randomize using exclude list of Unique # of newly generated values
@@ -1351,8 +1340,7 @@ package body RandomPkg is
for i in DistArray'range loop
DistArray(i) := DistArray(i) + sum ;
if DistArray(i) < sum then
- report "DistInt failed : negative weight or sum > 31 bits"
- severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.DistInt: negative weight or sum > 31 bits", FAILURE) ;
return DistArray'low ; -- allows debugging vs integer'left, out of range
end if ;
sum := DistArray(i) ;
@@ -1364,9 +1352,9 @@ package body RandomPkg is
return i ;
end if ;
end loop ;
- report "DistInt : randomization failed" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.DistInt: randomization failed", FAILURE) ;
else
- report "DistInt : No randomizatoin weights" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.DistInt: No randomization weights", FAILURE) ;
end if ;
return DistArray'low ; -- allows debugging vs integer'left, out of range
end function DistInt ;
@@ -1554,7 +1542,7 @@ package body RandomPkg is
impure function RandSigned (Max : signed) return signed is
begin
if max'length > 0 then
- assert (Max >= 0) report "%%RandomPkg RandSigned : Max < 0" severity FAILURE ;
+ AlertIf (Max < 0, OSVVM_ALERTLOG_ID, "RandomPkg.RandSigned: Max < 0", FAILURE) ;
return signed(RandUnsigned( unsigned(Max))) ;
else
return NULL_SV ; -- Null Array
@@ -1569,7 +1557,7 @@ package body RandomPkg is
return RandUnsigned(Max-Min) + Min ;
else
if Len > 0 then
- report "%%RandomPkg RandUnsigned : Max < Min" severity FAILURE ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.RandUnsigned: Max < Min", FAILURE) ;
end if ;
return NULL_UV ;
end if ;
@@ -1583,7 +1571,7 @@ package body RandomPkg is
return RandSlv(Max-Min) + Min ;
else
if Len > 0 then
- report "%%RandomPkg RandSlv : Max < Min" severity FAILURE ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.RandSlv: Max < Min", FAILURE) ;
end if ;
return NULL_SlV ;
end if ;
@@ -1597,7 +1585,7 @@ package body RandomPkg is
return resize(RandSigned(resize(Max,LEN+1) - resize(Min,LEN+1)) + Min, LEN) ;
else
if Len > 0 then
- report "%%RandomPkg RandSigned : Max < Min" severity FAILURE ;
+ Alert(OSVVM_ALERTLOG_ID, "RandomPkg.RandSigned: Max < Min", FAILURE) ;
end if ;
return NULL_SV ;
end if ;
@@ -1615,8 +1603,6 @@ package body RandomPkg is
impure function RandReal(Max : Real) return real is -- 0.0 to Max
begin
return RandReal(0.0, Max) ;
- -- assert Max >= 0.0 report "RandReal : Range Error" severity FAILURE ;
- -- return RandReal * Max ;
end function RandReal ;
impure function RandInt (Max : integer) return integer is
diff --git a/RandomPkg_user_guide.pdf b/RandomPkg_user_guide.pdf
deleted file mode 100644
index f5a0a28..0000000
Binary files a/RandomPkg_user_guide.pdf and /dev/null differ
diff --git a/SortListPkg_int.vhd b/SortListPkg_int.vhd
index 5d62fa2..c624cc8 100644
--- a/SortListPkg_int.vhd
+++ b/SortListPkg_int.vhd
@@ -1,7 +1,7 @@
--
-- File Name: SortListPkg_int.vhd
-- Design Unit Name: SortListPkg_int
--- Revision: STANDARD VERSION, revision 2014.01
+-- Revision: STANDARD VERSION, revision 2015.01
--
-- Maintainer: Jim Lewis email: jim@synthworks.com
-- Contributor(s):
@@ -31,10 +31,11 @@
-- 5/2013 2013.05 No changes of substance.
-- Deleted extra variable declaration in procedure remove
-- 1/2014 2014.01 Added RevSort. Added AllowDuplicate paramter to Add procedure
+-- 1/2015 2015.01 Changed Assert/Report to Alert
--
--
--
--- Copyright (c) 2008 - 2014 by SynthWorks Design Inc. All rights reserved.
+-- Copyright (c) 2008 - 2015 by SynthWorks Design Inc. All rights reserved.
--
-- Verbatim copies of this source file may be used and
-- distributed without restriction.
@@ -54,7 +55,9 @@
-- http://www.perlfoundation.org/artistic_license_2_0
--
- use std.textio.all ;
+use work.OsvvmGlobalPkg.all ;
+use work.AlertLogPkg.all ;
+use std.textio.all ;
library ieee ;
use ieee.std_logic_1164.all ;
@@ -101,8 +104,11 @@ package SortListPkg_int is
end protected SortListPType ;
end SortListPkg_int ;
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+
package body SortListPkg_int is
function inside (constant E : ElementType; constant A : in ArrayofElementType) return boolean is
@@ -264,7 +270,7 @@ package body SortListPkg_int is
variable CurPtr : ListPointerType ;
begin
if index > Count then
- report "%%FAILURE: SortListPType index out of range" severity failure ;
+ Alert(OSVVM_ALERTLOG_ID, "SortLIstPkg_int.get index out of range", FAILURE) ;
return ElementType'left ;
elsif HeadPointer = NULL then
return ElementType'left ;
diff --git a/TranscriptPkg.vhd b/TranscriptPkg.vhd
new file mode 100644
index 0000000..e690ac3
--- /dev/null
+++ b/TranscriptPkg.vhd
@@ -0,0 +1,180 @@
+--
+-- File Name: TranscriptPkg.vhd
+-- Design Unit Name: TranscriptPkg
+-- Revision: STANDARD VERSION, revision 2015.01
+--
+-- Maintainer: Jim Lewis email: jim@synthworks.com
+-- Contributor(s):
+-- Jim Lewis jim@synthworks.com
+--
+--
+-- Description:
+-- Define file identifier TranscriptFile
+-- provide subprograms to open, close, and print to it.
+--
+--
+-- Developed for:
+-- SynthWorks Design Inc.
+-- VHDL Training Classes
+-- 11898 SW 128th Ave. Tigard, Or 97223
+-- http://www.SynthWorks.com
+--
+-- Revision History:
+-- Date Version Description
+-- 01/2015: 2015.01 Initial revision
+--
+--
+-- Copyright (c) 2015 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 TranscriptPkg is
+
+ -- File Identifier to facilitate usage of one transcript file
+ file TranscriptFile : text ;
+
+ -- Cause compile errors if READ_MODE is passed to TranscriptOpen
+ subtype WRITE_APPEND_OPEN_KIND is FILE_OPEN_KIND range WRITE_MODE to APPEND_MODE ;
+
+ -- Open and close TranscriptFile. Function allows declarative opens
+ procedure TranscriptOpen (Status: out FILE_OPEN_STATUS; ExternalName: STRING; OpenKind: WRITE_APPEND_OPEN_KIND := WRITE_MODE) ;
+ procedure TranscriptOpen (ExternalName: STRING; OpenKind: WRITE_APPEND_OPEN_KIND := WRITE_MODE) ;
+ impure function TranscriptOpen (ExternalName: STRING; OpenKind: WRITE_APPEND_OPEN_KIND := WRITE_MODE) return FILE_OPEN_STATUS ;
+ procedure TranscriptClose ;
+ impure function IsTranscriptOpen return boolean ;
+ alias IsTranscriptEnabled is IsTranscriptOpen [return boolean] ;
+
+ -- Mirroring. When using TranscriptPkw WriteLine and Print, uses both TranscriptFile and OUTPUT
+ procedure SetTranscriptMirror (A : boolean := TRUE) ;
+ impure function IsTranscriptMirrored return boolean ;
+ alias GetTranscriptMirror is IsTranscriptMirrored [return boolean] ;
+
+ -- Write to TranscriptFile when open. Write to OUTPUT when not open or IsTranscriptMirrored
+ procedure WriteLine(buf : inout line) ;
+ procedure Print(s : string) ;
+
+end TranscriptPkg ;
+
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+--- ///////////////////////////////////////////////////////////////////////////
+
+package body TranscriptPkg is
+ ------------------------------------------------------------
+ type LocalBooleanPType is protected
+ procedure Set (A : boolean) ;
+ impure function get return boolean ;
+ end protected LocalBooleanPType ;
+ type LocalBooleanPType is protected body
+ variable GlobalVar : boolean := FALSE ;
+ procedure Set (A : boolean) is
+ begin
+ GlobalVar := A ;
+ end procedure Set ;
+ impure function get return boolean is
+ begin
+ return GlobalVar ;
+ end function get ;
+ end protected body LocalBooleanPType ;
+
+ ------------------------------------------------------------
+ shared variable TranscriptEnable : LocalBooleanPType ;
+ shared variable TranscriptMirror : LocalBooleanPType ;
+
+ ------------------------------------------------------------
+ procedure TranscriptOpen (Status: out FILE_OPEN_STATUS; ExternalName: STRING; OpenKind: WRITE_APPEND_OPEN_KIND := WRITE_MODE) is
+ ------------------------------------------------------------
+ begin
+ file_open(Status, TranscriptFile, ExternalName, OpenKind) ;
+ TranscriptEnable.Set(TRUE) ;
+ end procedure TranscriptOpen ;
+
+ ------------------------------------------------------------
+ procedure TranscriptOpen (ExternalName: STRING; OpenKind: WRITE_APPEND_OPEN_KIND := WRITE_MODE) is
+ ------------------------------------------------------------
+ begin
+ file_open(TranscriptFile, ExternalName, OpenKind) ;
+ TranscriptEnable.Set(TRUE) ;
+ end procedure TranscriptOpen ;
+
+ ------------------------------------------------------------
+ impure function TranscriptOpen (ExternalName: STRING; OpenKind: WRITE_APPEND_OPEN_KIND := WRITE_MODE) return FILE_OPEN_STATUS is
+ ------------------------------------------------------------
+ variable Status : FILE_OPEN_STATUS ;
+ begin
+ file_open(Status, TranscriptFile, ExternalName, OpenKind) ;
+ TranscriptEnable.Set(TRUE) ;
+ return status ;
+ end function TranscriptOpen ;
+
+ ------------------------------------------------------------
+ procedure TranscriptClose is
+ ------------------------------------------------------------
+ begin
+ if TranscriptEnable.Get then
+ file_close(TranscriptFile) ;
+ end if ;
+ TranscriptEnable.Set(FALSE) ;
+ end procedure TranscriptClose ;
+
+ ------------------------------------------------------------
+ impure function IsTranscriptOpen return boolean is
+ ------------------------------------------------------------
+ begin
+ return TranscriptEnable.Get ;
+ end function IsTranscriptOpen ;
+
+ ------------------------------------------------------------
+ procedure SetTranscriptMirror (A : boolean := TRUE) is
+ ------------------------------------------------------------
+ begin
+ TranscriptMirror.Set(A) ;
+ end procedure SetTranscriptMirror ;
+
+ ------------------------------------------------------------
+ impure function IsTranscriptMirrored return boolean is
+ ------------------------------------------------------------
+ begin
+ return TranscriptMirror.Get ;
+ end function IsTranscriptMirrored ;
+
+ ------------------------------------------------------------
+ procedure WriteLine(buf : inout line) is
+ ------------------------------------------------------------
+ begin
+ if not TranscriptEnable.Get then
+ WriteLine(OUTPUT, buf) ;
+ elsif TranscriptMirror.Get then
+ TEE(TranscriptFile, buf) ;
+ else
+ WriteLine(TranscriptFile, buf) ;
+ end if ;
+ end procedure WriteLine ;
+
+ ------------------------------------------------------------
+ procedure Print(s : string) is
+ ------------------------------------------------------------
+ variable buf : line ;
+ begin
+ write(buf, s) ;
+ WriteLine(buf) ;
+ end procedure Print ;
+
+end package body TranscriptPkg ;
\ No newline at end of file
diff --git a/demo/AlertLog_Demo_Global.vhd b/demo/AlertLog_Demo_Global.vhd
new file mode 100644
index 0000000..61b92d3
--- /dev/null
+++ b/demo/AlertLog_Demo_Global.vhd
@@ -0,0 +1,215 @@
+--
+-- File Name: AlertLog_Demo_Global.vhd
+-- Design Unit Name: AlertLog_Demo_Global
+-- Revision: STANDARD VERSION, 2015.01
+--
+-- Copyright (c) 2015 by SynthWorks Design Inc. All rights reserved.
+--
+--
+-- Maintainer: Jim Lewis email: jim@synthworks.com
+-- Contributor(s):
+-- Jim Lewis email: jim@synthworks.com
+--
+-- Description:
+-- Demo showing use of the global counter in AlertLogPkg
+--
+-- Developed for:
+-- SynthWorks Design Inc.
+-- Training Courses
+-- 11898 SW 128th Ave.
+-- Tigard, Or 97223
+-- http://www.SynthWorks.com
+--
+--
+-- Revision History:
+-- Date Version Description
+-- 01/2015 2015.01 Refining tests
+--
+--
+-- Copyright (c) 2015 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
+--
+
+library IEEE ;
+ use ieee.std_logic_1164.all ;
+ use ieee.numeric_std.all ;
+
+ use std.textio.all ;
+ use ieee.std_logic_textio.all ;
+
+library osvvm ;
+ use osvvm.OsvvmGlobalPkg.all ;
+ use osvvm.TranscriptPkg.all ;
+ use osvvm.AlertLogPkg.all ;
+
+entity AlertLog_Demo_Global is
+end AlertLog_Demo_Global ;
+architecture hierarchy of AlertLog_Demo_Global is
+ signal Clk : std_logic := '0';
+
+begin
+
+ Clk <= not Clk after 10 ns ;
+
+
+ -- /////////////////////////////////////////////////////////////
+ -- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+ Testbench_1 : block
+ begin
+
+ TbP0 : process
+ variable ClkNum : integer := 0 ;
+ begin
+ wait until Clk = '1' ;
+ ClkNum := ClkNum + 1 ;
+ print(LF & "Clock Number " & to_string(ClkNum)) ;
+ end process TbP0 ;
+
+ ------------------------------------------------------------
+ TbP1 : process
+ begin
+-- Uncomment this line to use a log file rather than OUTPUT
+ -- TranscriptOpen("./Demo_Global.txt") ;
+-- Uncomment this line and the simulation will stop after 15 errors
+ -- SetAlertStopCount(ERROR, 15) ;
+ SetAlertLogName("AlertLog_Demo_Global") ;
+ wait for 0 ns ; -- make sure all processes have elaborated
+ SetLogEnable(DEBUG, TRUE) ; -- Enable DEBUG Messages for all levels of the hierarchy
+
+-- Uncomment this line to justify alert and log reports
+ -- SetAlertLogJustify ;
+ for i in 1 to 5 loop
+ wait until Clk = '1' ;
+ if i = 4 then SetLogEnable(DEBUG, FALSE) ; end if ; -- DEBUG Mode OFF
+ wait for 1 ns ;
+ Alert("Tb.P1.E alert " & to_string(i) & " of 5") ; -- ERROR by default
+ Log ("Tb.P1.D log " & to_string(i) & " of 5", DEBUG) ;
+ end loop ;
+ wait until Clk = '1' ;
+ wait until Clk = '1' ;
+ wait for 1 ns ;
+ ReportAlerts ;
+ print("") ;
+ -- Report Alerts with expected errors expressed as a negative ExternalErrors value
+ ReportAlerts(Name => "AlertLog_Demo_Hierarchy with expected errors", ExternalErrors => -(FAILURE => 0, ERROR => 20, WARNING => 15)) ;
+ TranscriptClose ;
+ print(LF & "The following is brought to you by std.env.stop:") ;
+ std.env.stop ;
+ wait ;
+ end process TbP1 ;
+
+ ------------------------------------------------------------
+ TbP2 : process
+ begin
+ for i in 1 to 5 loop
+ wait until Clk = '1' ;
+ wait for 2 ns ;
+ Alert("Tb.P2.E alert " & to_string(i) & " of 5", ERROR) ;
+ -- example of a log that is not enabled, so it does not print
+ Log ("Tb.P2.I log " & to_string(i) & " of 5", INFO) ;
+ end loop ;
+ wait until Clk = '1' ;
+ wait for 2 ns ;
+-- Uncomment this line to and the simulation will stop here
+ -- Alert("Tb.P2.F Message 1 of 1", FAILURE) ;
+ wait ;
+ end process TbP2 ;
+
+ ------------------------------------------------------------
+ TbP3 : process
+ begin
+ for i in 1 to 5 loop
+ wait until Clk = '1' ;
+ wait for 3 ns ;
+ Alert("Tb.P3.W alert " & to_string(i) & " of 5", WARNING) ;
+ end loop ;
+ wait ;
+ end process TbP3 ;
+ end block Testbench_1 ;
+
+
+ -- /////////////////////////////////////////////////////////////
+ -- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+ Cpu_1 : block
+ begin
+
+ ------------------------------------------------------------
+ CpuP1 : process
+ begin
+ for i in 1 to 5 loop
+ wait until Clk = '1' ;
+ wait for 5 ns ;
+ Alert("Cpu.P1.E Message " & to_string(i) & " of 5", ERROR) ;
+ Log ("Cpu.P1.D log " & to_string(i) & " of 5", DEBUG) ;
+ Log ("Cpu.P1.F log " & to_string(i) & " of 5", FINAL) ; -- enabled by Uart_1
+ end loop ;
+ wait ;
+ end process CpuP1 ;
+
+ ------------------------------------------------------------
+ CpuP2 : process
+ begin
+ for i in 1 to 5 loop
+ wait until Clk = '1' ;
+ wait for 6 ns ;
+ Alert("Cpu.P2.W Message " & to_string(i) & " of 5", WARNING) ;
+ Log ("Cpu.P2.I log " & to_string(i) & " of 5", INFO) ;
+ end loop ;
+ wait ;
+ end process CpuP2 ;
+ end block Cpu_1 ;
+
+
+ -- /////////////////////////////////////////////////////////////
+ -- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+ Uart_1 : block
+ begin
+ -- Enable FINAL logs for every level
+ -- Note it is expected that most control of alerts will occur only in the testbench block
+ -- Note that this also turns on FINAL messages for CPU - see hierarchy for better control
+ SetLogEnable(FINAL, TRUE) ; -- Runs once at initialization time
+
+ ------------------------------------------------------------
+ UartP1 : process
+ begin
+ for i in 1 to 5 loop
+ wait until Clk = '1' ;
+ wait for 10 ns ;
+ Alert("Uart.P1.E alert " & to_string(i) & " of 5") ; -- ERROR by default
+ Log ("UART.P1.D log " & to_string(i) & " of 5", DEBUG) ;
+ end loop ;
+ wait ;
+ end process UartP1 ;
+
+ ------------------------------------------------------------
+ UartP2 : process
+ begin
+ for i in 1 to 5 loop
+ wait until Clk = '1' ;
+ wait for 11 ns ;
+ Alert("Uart.P2.W alert " & to_string(i) & " of 5", WARNING) ;
+ -- Info not enabled
+ Log ("UART.P2.I log " & to_string(i) & " of 5", INFO) ;
+ Log ("UART.P2.F log " & to_string(i) & " of 5", FINAL) ;
+ end loop ;
+ wait ;
+ end process UartP2 ;
+ end block Uart_1 ;
+
+end hierarchy ;
\ No newline at end of file
diff --git a/demo/AlertLog_Demo_Hierarchy.vhd b/demo/AlertLog_Demo_Hierarchy.vhd
new file mode 100644
index 0000000..456f15f
--- /dev/null
+++ b/demo/AlertLog_Demo_Hierarchy.vhd
@@ -0,0 +1,231 @@
+--
+-- File Name: AlertLog_Demo_Hierarchy.vhd
+-- Design Unit Name: AlertLog_Demo_Hierarchy
+-- Revision: STANDARD VERSION, 2015.01
+--
+-- Copyright (c) 2015 by SynthWorks Design Inc. All rights reserved.
+--
+--
+-- Maintainer: Jim Lewis email: jim@synthworks.com
+-- Contributor(s):
+-- Jim Lewis email: jim@synthworks.com
+--
+-- Description:
+-- Demo showing use of hierarchy in AlertLogPkg
+-- Both TB and CPU use sublevels of hierarchy
+-- UART does not use sublevels of hierarchy
+-- Usage of block statements emulates a separate entity/architecture
+--
+-- Developed for:
+-- SynthWorks Design Inc.
+-- Training Courses
+-- 11898 SW 128th Ave.
+-- Tigard, Or 97223
+-- http://www.SynthWorks.com
+--
+--
+-- Revision History:
+-- Date Version Description
+-- 01/2015 2015.01 Refining tests
+--
+--
+-- Copyright (c) 2015 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
+--
+
+library IEEE ;
+ use ieee.std_logic_1164.all ;
+ use ieee.numeric_std.all ;
+
+ use std.textio.all ;
+ use ieee.std_logic_textio.all ;
+
+library osvvm ;
+ use osvvm.OsvvmGlobalPkg.all ;
+ use osvvm.TranscriptPkg.all ;
+ use osvvm.AlertLogPkg.all ;
+
+entity AlertLog_Demo_Hierarchy is
+end AlertLog_Demo_Hierarchy ;
+architecture hierarchy of AlertLog_Demo_Hierarchy is
+ signal Clk : std_logic := '0';
+
+begin
+
+ Clk <= not Clk after 10 ns ;
+
+
+ -- /////////////////////////////////////////////////////////////
+ -- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+ Testbench_1 : block
+ constant TB_AlertLogID : AlertLogIDType := GetAlertLogID("Testbench_1") ;
+ begin
+
+ TbP0 : process
+ variable ClkNum : integer := 0 ;
+ begin
+ wait until Clk = '1' ;
+ ClkNum := ClkNum + 1 ;
+ print(LF & "Clock Number " & to_string(ClkNum)) ;
+ end process TbP0 ;
+
+ ------------------------------------------------------------
+ TbP1 : process
+ constant TB_P1_ID : AlertLogIDType := GetAlertLogID("TB P1", TB_AlertLogID) ;
+ variable TempID : AlertLogIDType ;
+ begin
+-- Uncomment this line to use a log file rather than OUTPUT
+ -- TranscriptOpen("./Demo_Hierarchy.txt") ;
+-- Uncomment this line and the simulation will stop after 15 errors
+ -- SetAlertStopCount(ERROR, 15) ;
+ SetAlertLogName("AlertLog_Demo_Hierarchy") ;
+ wait for 0 ns ; -- make sure all processes have elaborated
+ SetLogEnable(DEBUG, TRUE) ; -- Enable DEBUG Messages for all levels of the hierarchy
+ TempID := GetAlertLogID("CPU_1") ; -- Get The CPU AlertLogID
+ SetLogEnable(TempID, DEBUG, FALSE) ; -- turn off DEBUG messages in CPU
+ SetLogEnable(TempID, INFO, TRUE) ; -- turn on INFO messages in CPU
+
+-- Uncomment this line to justify alert and log reports
+ -- SetAlertLogJustify ;
+ for i in 1 to 5 loop
+ wait until Clk = '1' ;
+ if i = 4 then SetLogEnable(DEBUG, FALSE) ; end if ; -- DEBUG Mode OFF
+ wait for 1 ns ;
+ Alert(TB_P1_ID, "Tb.P1.E alert " & to_string(i) & " of 5") ; -- ERROR by default
+ Log (TB_P1_ID, "Tb.P1.D log " & to_string(i) & " of 5", DEBUG) ;
+ end loop ;
+ wait until Clk = '1' ;
+ wait until Clk = '1' ;
+ wait for 1 ns ;
+ -- Report Alerts without expected errors
+ ReportAlerts ;
+ print("") ;
+ -- Report Alerts with expected errors expressed as a negative ExternalErrors value
+ ReportAlerts(Name => "AlertLog_Demo_Hierarchy with expected errors", ExternalErrors => -(FAILURE => 0, ERROR => 20, WARNING => 15)) ;
+ TranscriptClose ;
+ print(LF & "The following is brought to you by std.env.stop:") ;
+ std.env.stop ;
+ wait ;
+ end process TbP1 ;
+
+ ------------------------------------------------------------
+ TbP2 : process
+ constant TB_P2_ID : AlertLogIDType := GetAlertLogID("TB P2", TB_AlertLogID) ;
+ begin
+ for i in 1 to 5 loop
+ wait until Clk = '1' ;
+ wait for 2 ns ;
+ Alert(TB_P2_ID, "Tb.P2.E alert " & to_string(i) & " of 5", ERROR) ;
+ -- example of a log that is not enabled, so it does not print
+ Log (TB_P2_ID, "Tb.P2.I log " & to_string(i) & " of 5", INFO) ;
+ end loop ;
+ wait until Clk = '1' ;
+ wait for 2 ns ;
+-- Uncomment this line to and the simulation will stop here
+ -- Alert(TB_P2_ID, "Tb.P2.F Message 1 of 1", FAILURE) ;
+ wait ;
+ end process TbP2 ;
+
+ ------------------------------------------------------------
+ TbP3 : process
+ constant TB_P3_ID : AlertLogIDType := GetAlertLogID("TB P3", TB_AlertLogID) ;
+ begin
+ for i in 1 to 5 loop
+ wait until Clk = '1' ;
+ wait for 3 ns ;
+ Alert(TB_P3_ID, "Tb.P3.W alert " & to_string(i) & " of 5", WARNING) ;
+ end loop ;
+ wait ;
+ end process TbP3 ;
+ end block Testbench_1 ;
+
+
+ -- /////////////////////////////////////////////////////////////
+ -- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+ Cpu_1 : block
+ constant CPU_AlertLogID : AlertLogIDType := GetAlertLogID("CPU_1") ;
+ begin
+
+ ------------------------------------------------------------
+ CpuP1 : process
+ constant CPU_P1_ID : AlertLogIDType := GetAlertLogID("CPU P1", CPU_AlertLogID) ;
+ begin
+ for i in 1 to 5 loop
+ wait until Clk = '1' ;
+ wait for 5 ns ;
+ Alert(CPU_P1_ID, "Cpu.P1.E Message " & to_string(i) & " of 5", ERROR) ;
+ Log (CPU_P1_ID, "Cpu.P1.D log " & to_string(i) & " of 5", DEBUG) ;
+ Log (CPU_P1_ID, "Cpu.P1.F log " & to_string(i) & " of 5", FINAL) ; -- disabled
+ end loop ;
+ wait ;
+ end process CpuP1 ;
+
+ ------------------------------------------------------------
+ CpuP2 : process
+ constant CPU_P2_ID : AlertLogIDType := GetAlertLogID("CPU P2", CPU_AlertLogID) ;
+ begin
+ for i in 1 to 5 loop
+ wait until Clk = '1' ;
+ wait for 6 ns ;
+ Alert(CPU_P2_ID, "Cpu.P2.W Message " & to_string(i) & " of 5", WARNING) ;
+ Log (CPU_P2_ID, "Cpu.P2.I log " & to_string(i) & " of 5", INFO) ;
+ end loop ;
+ wait ;
+ end process CpuP2 ;
+ end block Cpu_1 ;
+
+
+ -- /////////////////////////////////////////////////////////////
+ -- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+ Uart_1 : block
+ constant UART_AlertLogID : AlertLogIDType := GetAlertLogID("UART_1") ;
+ begin
+ -- Enable FINAL logs for every level
+ -- Note it is expected that most control of alerts will occur only in the testbench block
+ -- Note that this does not turn on FINAL messages for CPU - see global for settings that impact CPU
+ SetLogEnable(UART_AlertLogID, FINAL, TRUE) ; -- Runs once at initialization time
+
+ ------------------------------------------------------------
+ UartP1 : process
+ begin
+ for i in 1 to 5 loop
+ wait until Clk = '1' ;
+ wait for 10 ns ;
+ Alert(UART_AlertLogID, "Uart.P1.E alert " & to_string(i) & " of 5") ; -- ERROR by default
+ Log (UART_AlertLogID, "UART.P1.D log " & to_string(i) & " of 5", DEBUG) ;
+ end loop ;
+ wait ;
+ end process UartP1 ;
+
+ ------------------------------------------------------------
+ UartP2 : process
+ begin
+ for i in 1 to 5 loop
+ wait until Clk = '1' ;
+ wait for 11 ns ;
+ Alert(UART_AlertLogID, "Uart.P2.W alert " & to_string(i) & " of 5", WARNING) ;
+ -- Info not enabled
+ Log (UART_AlertLogID, "UART.P2.I log " & to_string(i) & " of 5", INFO) ;
+ Log (UART_AlertLogID, "UART.P2.F log " & to_string(i) & " of 5", FINAL) ;
+ end loop ;
+ wait ;
+ end process UartP2 ;
+ end block Uart_1 ;
+
+end hierarchy ;
\ No newline at end of file
diff --git a/demo/Demo_Rand.vhd b/demo/Demo_Rand.vhd
new file mode 100644
index 0000000..edf6901
--- /dev/null
+++ b/demo/Demo_Rand.vhd
@@ -0,0 +1,282 @@
+--
+-- File Name: Demo_Rand.vhd
+-- Design Unit Name: Demo_Rand
+-- Revision: STANDARD VERSION, revision 2015.03
+--
+-- Maintainer: Jim Lewis email: jim@synthworks.com
+-- Contributor(s):
+-- Jim Lewis email: jim@synthworks.com
+--
+-- Description:
+-- Demonstration program for RandomPkg.vhd
+--
+-- Developed for:
+-- SynthWorks Design Inc.
+-- VHDL Training Classes
+-- 11898 SW 128th Ave. Tigard, Or 97223
+-- http://www.SynthWorks.com
+--
+-- Revision History:
+-- Date Version Description
+-- 02/2009: 1.0 Initial revision and First Public Released Version
+-- 03/2009 1.1 Minor tweek to printing
+-- 03/2015 2015.03 Updated FAVOR_BIG to FavorBig and FAVOR_SMALL to FavorSmall
+--
+-- Copyright (c) 2009 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
+--
+library IEEE ;
+ use ieee.std_logic_1164.all ;
+ use std.textio.all ;
+ use ieee.std_logic_textio.all ;
+
+Package TestSupportPkg is
+ type integer_array is array (integer range <>) of integer ;
+
+ procedure TestInit (TestName : string ; variable Results : inout integer_array ) ;
+ procedure TestInit (TestName : string ; variable Results : inout integer_array ; variable Count : inout natural ) ;
+ procedure AccumulateResults (IntVal : integer ; Num : integer ; variable Results : inout integer_array) ;
+ procedure PrintResults (Results : integer_array) ;
+
+end TestSupportPkg ;
+Package body TestSupportPkg is
+ procedure TestInit (TestName : string ; variable Results : inout integer_array ) is
+ begin
+ write(OUTPUT, LF&LF & TestName & LF ) ;
+ Results := (Results'range => 0) ;
+ write(OUTPUT, "1st 20 values = ") ;
+ end ;
+
+ procedure TestInit (TestName : string ; variable Results : inout integer_array ; variable Count : inout natural ) is
+ begin
+ Count := Count + 1 ;
+ write(OUTPUT, LF&LF & "Test " & integer'image(Count) & ": " & TestName & LF ) ;
+ Results := (Results'range => 0) ;
+ write(OUTPUT, "1st 20 values = ") ;
+ end ;
+
+ procedure AccumulateResults (IntVal : integer ; Num : integer ; variable Results : inout integer_array) is
+ begin
+ Results(IntVal) :=Results(IntVal) + 1 ;
+ if Num < 20 then
+ write(OUTPUT, integer'image(IntVal) & " ") ;
+ end if ;
+ end ;
+
+ procedure PrintResults (Results : integer_array) is
+ begin
+ write(OUTPUT, LF & "Accumulated Results. Expecting approximately 1000 of each per weight." & LF) ;
+ for i in Results'range loop
+ if Results(i) > 0 then
+ write(OUTPUT, "** ") ;
+ write(OUTPUT, integer'image(i) & " : " & integer'image(Results(i)) & LF) ;
+ end if ;
+ end loop ;
+ end ;
+end TestSupportPkg ;
+
+library IEEE ;
+ use ieee.std_logic_1164.all ;
+ use ieee.numeric_std.all ;
+
+ use std.textio.all ;
+ use ieee.std_logic_textio.all ;
+
+library SynthWorks ;
+ use SynthWorks.RandomBasePkg.all ;
+ use SynthWorks.RandomPkg.all ;
+
+use work.TestSupportPkg.all ;
+
+entity Demo_Rand is
+end Demo_Rand ;
+architecture test of Demo_Rand is
+begin
+
+
+ RandomGenProc : process
+ variable RV : RandomPType ;
+
+ variable DataInt : integer ;
+ variable DataSlv : std_logic_vector(3 downto 0) ;
+ variable DataUnsigned : unsigned(3 downto 0) ;
+ variable DataSigned : signed(4 downto 0) ;
+
+ -- Statistics
+ variable TestNum : integer := 0 ;
+ variable Results : integer_array (-100 to 100) := (others => 0) ;
+ variable writebuf : line ;
+
+ begin
+
+ RV.InitSeed(RV'instance_name) ; -- Initialize Seed. Typically done one time
+
+
+write(OUTPUT, LF&LF& "Random Range Tests") ;
+ TestInit("RandInt(0, 7) Range 0-7", Results, TestNum) ; -- 1
+ for i in 1 to 8000 loop -- Loop 1000x per value
+ DataInt := RV.RandInt(0, 7);
+ AccumulateResults(DataInt, i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ TestInit("RandInt(1, 13, (3, 7, 11) Range 1-13, Exclude 3,7,11", Results, TestNum) ; -- 2
+ for i in 1 to 10000 loop -- Loop 1000x per value
+ DataInt := RV.RandInt(1, 13, (3, 7, 11));
+ AccumulateResults(DataInt, i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ TestInit("RandSlv(0, 4, 4) Range 0-4", Results, TestNum) ; -- 3
+ for i in 1 to 5000 loop -- Loop 1000x per value
+ DataSlv := RV.RandSlv(0, 4, 4);
+ AccumulateResults(to_integer(unsigned(DataSlv)), i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ TestInit("RandUnsigned(4, 9, (0 => 7), 4) Range 4-9, Exclude 7", Results, TestNum) ; -- 4
+ for i in 1 to 5000 loop -- Loop 1000x per value
+ DataUnsigned := RV.RandUnsigned(4, 9, (0 => 7), 4); -- only 1 exclude element
+ AccumulateResults(to_integer(DataUnsigned), i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ TestInit("RandSigned(-4, 3, 5)", Results, TestNum) ; -- 5
+ for i in 1 to 8000 loop -- Loop 1000x per value
+ DataSigned := RV.RandSigned(-4, 3, 5);
+ AccumulateResults(to_integer(DataSigned), i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+
+write(OUTPUT, LF&LF& "Random Set Tests") ;
+ TestNum := 0 ;
+ TestInit("RandInt( (-50, -22, -14, -7, -2, 0, 3, 7, 9, 27, 49, 89, 99)). Set: (-50, -22, -14, -7, -2, 0, 3, 7, 9, 27, 49, 89, 99)", Results, TestNum) ; -- 1
+ for i in 1 to 13000 loop -- Loop 1000x per value
+ DataInt := RV.RandInt( (-50, -22, -14, -7, -2, 0, 3, 7, 9, 27, 49, 89, 99));
+ AccumulateResults(DataInt, i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ TestInit("RandInt( (-5, -1, 3, 7, 11), (-1, 7) ) Set (-5, -1, 3, 7, 11), Exclude (-1, 7)", Results, TestNum) ; -- 2
+ for i in 1 to 3000 loop -- Loop 1000x per value
+ DataInt := RV.RandInt( (-5, -1, 3, 7, 11), (-1, 7) );
+ AccumulateResults(DataInt, i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ TestInit("RandSlv( (1, 2, 3, 7, 11), 4)", Results, TestNum) ; -- 3
+ for i in 1 to 5000 loop -- Loop 1000x per value
+ DataSlv := RV.RandSlv( (1, 2, 3, 7, 11), 4);
+ AccumulateResults(to_integer(unsigned(DataSlv)), i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ TestInit("RandUnsigned( (1, 2, 3, 11), (1 => 3), 4)", Results, TestNum) ; -- 4
+ for i in 1 to 3000 loop -- Loop 1000x per value
+ DataUnsigned := RV.RandUnsigned( (1, 2, 3, 11), (1 => 3), 4); -- 1 element middle
+ AccumulateResults(to_integer(DataUnsigned), i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ TestInit("RandSigned( (-5, -1, 3, 7, 11), 5)", Results, TestNum) ; -- 5
+ for i in 1 to 5000 loop -- Loop 1000x per value
+ DataSigned := RV.RandSigned( (-5, -1, 3, 7, 11), 5);
+ AccumulateResults(to_integer(DataSigned), i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+
+write(OUTPUT, LF&LF& "Weighted Distribution Tests") ;
+ TestNum := 0 ;
+ -- There is also DistSlv, DistUnsigned, DistSigned
+ TestInit("RV.DistInt( (7, 2, 1) ) ", Results, TestNum) ;
+ for i in 1 to 10000 loop -- Loop 1000x per distribute weight
+ DataInt := RV.DistInt( (7, 2, 1) ) ;
+ AccumulateResults(DataInt, i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ TestInit("RV.DistInt( (0, 2, 0, 4, 0, 6, 0, 8, 0, 10), (3,9) );", Results, TestNum) ;
+ for i in 1 to 16000 loop -- Loop 1000x per distribute weight
+ DataInt := RV.DistInt( (0, 2, 0, 4, 0, 6, 0, 8, 0, 10), (3,9) ) ;
+ AccumulateResults(DataInt, i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+
+write(OUTPUT, LF&LF& "Weighted Distribution with Value") ;
+ TestNum := 0 ;
+ -- There is also DistValSlv, DistValUnsigned, DistValSigned
+ TestInit("RV.DistValInt( ((1, 7), (3, 2), (5, 1)) ) ", Results, TestNum) ;
+ for i in 1 to 10000 loop -- Loop 1000x per distribute weight
+ DataInt := RV.DistValInt( ((1, 7), (3, 2), (5, 1)) ) ;
+ AccumulateResults(DataInt, i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ TestInit("RV.DistValInt( ((1, 7), (3, 2), (5, 1)), (1=>3) ) Exclude 3", Results, TestNum) ;
+ for i in 1 to 8000 loop -- Loop 1000x per distribute weight
+ DataInt := RV.DistValInt( ((1, 7), (3, 2), (5, 1)), (1=>3) ) ;
+ AccumulateResults(DataInt, i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+write(OUTPUT, LF&LF& "Mode Direct Tests") ;
+ -- There are also real return values
+ TestNum := 0 ;
+ TestInit("Integer Uniform: Integer Range (0 to 9)", Results, TestNum) ;
+ for i in 1 to 10000 loop -- Loop 1000x per value
+ DataInt := RV.uniform(0,9);
+ AccumulateResults(DataInt, i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ TestInit("Integer FavorSmall: Integer Range (0 to 9)", Results, TestNum) ;
+ for i in 1 to 10000 loop -- Loop 1000x per value
+ DataInt := RV.FavorSmall(0,9);
+ AccumulateResults(DataInt, i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ TestInit("Integer FavorBig: Integer Range (0 to 9)", Results, TestNum) ;
+ for i in 1 to 10000 loop -- Loop 1000x per value
+ DataInt := RV.FavorBig(0,9);
+ AccumulateResults(DataInt, i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ TestInit("Integer NORMAL, 50.0, 5.0 range -100 to 100", Results, TestNum) ;
+ for i in 1 to 100000 loop -- Loop 1000x per value
+ DataInt := RV.Normal(50.0, 5.0, -100, 100);
+ AccumulateResults(DataInt, i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ TestInit("Integer Poisson, 10.0, -100, 100", Results, TestNum) ;
+ for i in 1 to 10000 loop -- Loop 1000x per value
+ DataInt := RV.Poisson(10.0, -100, 100) ;
+ AccumulateResults(DataInt, i, Results) ;
+ end loop ;
+ PrintResults (Results) ;
+
+ wait ;
+ end process RandomGenProc ;
+
+end test ;
\ No newline at end of file
diff --git a/doc/AlertLogPkg_interface_guide.pdf b/doc/AlertLogPkg_interface_guide.pdf
new file mode 100644
index 0000000..7eaec9d
Binary files /dev/null and b/doc/AlertLogPkg_interface_guide.pdf differ
diff --git a/doc/AlertLogPkg_user_guide.pdf b/doc/AlertLogPkg_user_guide.pdf
new file mode 100644
index 0000000..9a7c59f
Binary files /dev/null and b/doc/AlertLogPkg_user_guide.pdf differ
diff --git a/doc/CoveragePkg_user_guide.pdf b/doc/CoveragePkg_user_guide.pdf
new file mode 100644
index 0000000..384e4ce
Binary files /dev/null and b/doc/CoveragePkg_user_guide.pdf differ
diff --git a/doc/OsvvmGlobalPkg_user_guide.pdf b/doc/OsvvmGlobalPkg_user_guide.pdf
new file mode 100644
index 0000000..22b2b2f
Binary files /dev/null and b/doc/OsvvmGlobalPkg_user_guide.pdf differ
diff --git a/doc/RandomPkg_user_guide.pdf b/doc/RandomPkg_user_guide.pdf
new file mode 100644
index 0000000..64a2f2e
Binary files /dev/null and b/doc/RandomPkg_user_guide.pdf differ
diff --git a/doc/TranscriptPkg_user_guide.pdf b/doc/TranscriptPkg_user_guide.pdf
new file mode 100644
index 0000000..34049dd
Binary files /dev/null and b/doc/TranscriptPkg_user_guide.pdf differ
diff --git a/doc/osvvm_release_notes.pdf b/doc/osvvm_release_notes.pdf
new file mode 100644
index 0000000..c96ac12
Binary files /dev/null and b/doc/osvvm_release_notes.pdf differ
diff --git a/osvvm_release_notes.pdf b/osvvm_release_notes.pdf
deleted file mode 100644
index 308b479..0000000
Binary files a/osvvm_release_notes.pdf and /dev/null differ