Skip to content

Commit

Permalink
Merge branch 'master' into paebbels/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Lehmann authored and Patrick Lehmann committed Nov 14, 2016
2 parents 6843a48 + c3f8221 commit 0588e96
Show file tree
Hide file tree
Showing 7 changed files with 1,741 additions and 18 deletions.
41 changes: 24 additions & 17 deletions AlertLogPkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
-- ReportNonZeroAlerts, ReadLogEnables
-- 05/2015 2015.06 Added IncAlertCount, AffirmIf
-- 07/2015 2016.01 Fixed AlertLogID issue with > 32 IDs
--
-- 02/2016 2016.02 Fixed IsLogEnableType (for PASSED), AffirmIf (to pass AlertLevel)
-- Created LocalInitialize
--
-- Copyright (c) 2015 - 2016 by SynthWorks Design Inc. All rights reserved.
--
Expand Down Expand Up @@ -69,7 +70,7 @@ package AlertLogPkg is
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, PASSED) ; -- NEVER
type LogType is (ALWAYS, DEBUG, FINAL, INFO, PASSED) ; -- NEVER -- See function IsLogEnableType
subtype LogIndexType is LogType range DEBUG to PASSED ;
type LogEnableType is array (LogIndexType) of boolean ;

Expand Down Expand Up @@ -958,10 +959,11 @@ package body AlertLogPkg is
-- LogEnabled => LogEnabled
-- ) ;
end procedure NewAlertLogRec ;

------------------------------------------------------------
-- PT Local
-- Construct initial data structure
procedure Initialize(NewNumAlertLogIDs : integer := MIN_NUM_AL_IDS) is
procedure LocalInitialize(NewNumAlertLogIDs : integer := MIN_NUM_AL_IDS) is
------------------------------------------------------------
begin
if NumAllocatedAlertLogIDsVar /= 0 then
Expand All @@ -971,12 +973,9 @@ package body AlertLogPkg is
-- Initialize Pointer
AlertLogPtr := new AlertLogArrayType(ALERTLOG_BASE_ID to ALERTLOG_BASE_ID + NewNumAlertLogIDs) ;
NumAllocatedAlertLogIDsVar := NewNumAlertLogIDs ;
--xx NumAlertLogIDsVar := 0 ;
--xx NumAlertLogIDsVar := 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) ;
--xx NumAlertLogIDsVar := NumAlertLogIDsVar + 1 ;
end if ;
-- Create DEFAULT AlertLogID
NewAlertLogRec(ALERT_DEFAULT_ID, "Default", ALERTLOG_BASE_ID) ;
Expand All @@ -990,20 +989,27 @@ package body AlertLogPkg is
NewAlertLogRec(OSVVM_SCOREBOARD_ALERTLOG_ID, "OSVVM Scoreboard", ALERTLOG_BASE_ID) ;
NumAlertLogIDsVar := NumAlertLogIDsVar + 1 ;
end if ;
--xx NumPredefinedAlIDsVar := NumAlertLogIDsVar ;
end procedure Initialize ;

end procedure LocalInitialize ;

------------------------------------------------------------
-- Construct initial data structure
procedure Initialize(NewNumAlertLogIDs : integer := MIN_NUM_AL_IDS) is
------------------------------------------------------------
begin
LocalInitialize(NewNumAlertLogIDs) ;
end procedure Initialize ;

------------------------------------------------------------
-- PT Local
-- Constructs initial data structure using constant below
impure function Initialize return boolean is
impure function LocalInitialize return boolean is
------------------------------------------------------------
begin
Initialize(MIN_NUM_AL_IDS) ;
LocalInitialize(MIN_NUM_AL_IDS) ;
return TRUE ;
end function Initialize ;
end function LocalInitialize ;

constant CONSTRUCT_ALERT_DATA_STRUCTURE : boolean := Initialize ;
constant CONSTRUCT_ALERT_DATA_STRUCTURE : boolean := LocalInitialize ;

------------------------------------------------------------
procedure Deallocate is
Expand Down Expand Up @@ -2078,7 +2084,7 @@ package body AlertLogPkg is
AlertLogStruct.Log(AlertLogID, Message, LogLevel) ; -- call log
-- AlertLogStruct.IncAffirmPassCount ; -- increment pass & check count
else
AlertLogStruct.Alert(AlertLogID, Message, ERROR) ; -- signal failure
AlertLogStruct.Alert(AlertLogID, Message, AlertLevel) ; -- signal failure
end if ;
end procedure AffirmIf ;

Expand Down Expand Up @@ -2630,9 +2636,10 @@ package body AlertLogPkg is
------------------------------------------------------------
function IsLogEnableType (Name : String) return boolean is
------------------------------------------------------------
-- type LogType is (ALWAYS, DEBUG, FINAL, INFO) ; -- NEVER
-- type LogType is (ALWAYS, DEBUG, FINAL, INFO, PASSED) ; -- NEVER
begin
if Name = "DEBUG" then return TRUE ;
if Name = "PASSED" then return TRUE ;
elsif Name = "DEBUG" then return TRUE ;
elsif Name = "FINAL" then return TRUE ;
elsif Name = "INFO" then return TRUE ;
end if ;
Expand Down
15 changes: 14 additions & 1 deletion CoveragePkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-- Jim Lewis SynthWorks
-- Matthias Alles Creonic. Inspired GetMinBinVal, GetMinPoint, GetCov
-- Jerry Kaczynski Aldec. Inspired GetBin function
--
-- Sebastian Dunst Inspired GetBinName function
--
-- Package Defines
-- Functional coverage modeling utilities and data structure
Expand Down Expand Up @@ -43,6 +43,7 @@
-- 01/2015 2015.01 Use AlertLogPkg to count assertions and filter log messages
-- 06/2015 2015.06 AddCross[CovMatrix?Type], Mirroring for WriteBin
-- 01/2016 2016.01 Fixes for pure functions. Added bounds checking on ICover
-- 03/2016 2016.03 Added GetBinName(Index) to retrieve a bin's name
--
-- Development Notes:
-- The coverage procedures are named ICover to avoid conflicts with
Expand Down Expand Up @@ -436,6 +437,7 @@ package CoveragePkg is
impure function GetBin ( BinIndex : integer ) return CovMatrix7BaseType ;
impure function GetBin ( BinIndex : integer ) return CovMatrix8BaseType ;
impure function GetBin ( BinIndex : integer ) return CovMatrix9BaseType ;
impure function GetBinName ( BinIndex : integer; DefaultName : string := "" ) return string ;

------------------------------------------------------------
procedure WriteBin (
Expand Down Expand Up @@ -2716,6 +2718,17 @@ package body CoveragePkg is
result.Weight := CovBinPtr(BinIndex).Weight;
return result ;
end function GetBin ;

-- ------------------------------------------------------------
impure function GetBinName ( BinIndex : integer; DefaultName : string := "" ) return string is
-- ------------------------------------------------------------
begin
if CovBinPtr(BinIndex).Name.all /= "" then
return CovBinPtr(BinIndex).Name.all ;
else
return DefaultName ;
end if;
end function GetBinName;

------------------------------------------------------------
-- pt local for now -- file formal parameter not allowed with method
Expand Down
Loading

0 comments on commit 0588e96

Please sign in to comment.