Skip to content

Commit 3adfb8d

Browse files
committed
Made AlertLogType a type rather than a subtype
1 parent 93d2318 commit 3adfb8d

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

AlertLogPkg.vhd

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ use ieee.numeric_std.all ;
6969

7070
package AlertLogPkg is
7171

72-
subtype AlertLogIDType is integer ;
72+
type AlertLogIDType is range integer'low to integer'high ;
73+
type AlertLogIDVectorType is array (integer range <>) of AlertLogIDType ;
7374
type AlertType is (FAILURE, ERROR, WARNING) ; -- NEVER
7475
subtype AlertIndexType is AlertType range FAILURE to WARNING ;
7576
type AlertCountType is array (AlertIndexType) of integer ;
@@ -458,12 +459,12 @@ package body AlertLogPkg is
458459

459460
------------------------------------------------------------
460461
procedure SetAlertLogName(Name : string ) ;
461-
procedure SetNumAlertLogIDs (NewNumAlertLogIDs : integer) ;
462+
procedure SetNumAlertLogIDs (NewNumAlertLogIDs : AlertLogIDType) ;
462463
impure function FindAlertLogID(Name : string ) return AlertLogIDType ;
463464
impure function FindAlertLogID(Name : string ; ParentID : AlertLogIDType) return AlertLogIDType ;
464465
impure function GetAlertLogID(Name : string ; ParentID : AlertLogIDType ; CreateHierarchy : Boolean) return AlertLogIDType ;
465466
impure function GetAlertLogParentID(AlertLogID : AlertLogIDType) return AlertLogIDType ;
466-
procedure Initialize(NewNumAlertLogIDs : integer := MIN_NUM_AL_IDS) ;
467+
procedure Initialize(NewNumAlertLogIDs : AlertLogIDType := MIN_NUM_AL_IDS) ;
467468
procedure Deallocate ;
468469

469470
------------------------------------------------------------
@@ -1061,7 +1062,7 @@ package body AlertLogPkg is
10611062
------------------------------------------------------------
10621063
-- PT Local
10631064
-- Construct initial data structure
1064-
procedure LocalInitialize(NewNumAlertLogIDs : integer := MIN_NUM_AL_IDS) is
1065+
procedure LocalInitialize(NewNumAlertLogIDs : AlertLogIDType := MIN_NUM_AL_IDS) is
10651066
------------------------------------------------------------
10661067
begin
10671068
if NumAllocatedAlertLogIDsVar /= 0 then
@@ -1091,7 +1092,7 @@ package body AlertLogPkg is
10911092

10921093
------------------------------------------------------------
10931094
-- Construct initial data structure
1094-
procedure Initialize(NewNumAlertLogIDs : integer := MIN_NUM_AL_IDS) is
1095+
procedure Initialize(NewNumAlertLogIDs : AlertLogIDType := MIN_NUM_AL_IDS) is
10951096
------------------------------------------------------------
10961097
begin
10971098
LocalInitialize(NewNumAlertLogIDs) ;
@@ -1146,7 +1147,7 @@ package body AlertLogPkg is
11461147

11471148
------------------------------------------------------------
11481149
-- PT Local.
1149-
procedure GrowAlertStructure (NewNumAlertLogIDs : integer) is
1150+
procedure GrowAlertStructure (NewNumAlertLogIDs : AlertLogIDType) is
11501151
------------------------------------------------------------
11511152
variable oldAlertLogPtr : AlertLogArrayPtrType ;
11521153
begin
@@ -1165,7 +1166,7 @@ package body AlertLogPkg is
11651166
-- Sets a AlertLogPtr to a particular size
11661167
-- Use for small bins to save space or large bins to
11671168
-- suppress the resize and copy as a CovBin autosizes.
1168-
procedure SetNumAlertLogIDs (NewNumAlertLogIDs : integer) is
1169+
procedure SetNumAlertLogIDs (NewNumAlertLogIDs : AlertLogIDType) is
11691170
------------------------------------------------------------
11701171
variable oldAlertLogPtr : AlertLogArrayPtrType ;
11711172
begin

ScoreboardGenericPkg.vhd

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,12 +448,15 @@ package body ScoreboardGenericPkg is
448448

449449
type IntegerArrayType is array (integer range <>) of Integer ;
450450
type IntegerArrayPointerType is access IntegerArrayType ;
451+
type AlertLogIDArrayType is array (integer range <>) of AlertLogIDType ;
452+
type AlertLogIDArrayPointerType is access AlertLogIDArrayType ;
453+
451454

452455
variable ErrCntVar : IntegerArrayPointerType := new IntegerArrayType'(1 => 0) ;
453456
variable DropCountVar : IntegerArrayPointerType := new IntegerArrayType'(1 => 0) ;
454457
variable ItemNumberVar : IntegerArrayPointerType := new IntegerArrayType'(1 => 0) ;
455458
variable CheckCountVar : IntegerArrayPointerType := new IntegerArrayType'(1 => 0) ;
456-
variable AlertLogIDVar : IntegerArrayPointerType := new IntegerArrayType'(1 => OSVVM_SCOREBOARD_ALERTLOG_ID) ;
459+
variable AlertLogIDVar : AlertLogIDArrayPointerType := new AlertLogIDArrayType'(1 => OSVVM_SCOREBOARD_ALERTLOG_ID) ;
457460

458461
variable NameVar : NamePType ;
459462
variable ReportModeVar : ScoreboardReportType ;
@@ -509,7 +512,8 @@ package body ScoreboardGenericPkg is
509512
procedure SetArrayIndex(L, R : integer) is
510513
------------------------------------------------------------
511514
variable OldHeadPointer, OldTailPointer, OldPopListPointer : ListArrayPointerType ;
512-
variable OldErrCnt, OldDropCount, OldItemNumber, OldCheckCount, OldAlertLogIDVar : IntegerArrayPointerType ;
515+
variable OldErrCnt, OldDropCount, OldItemNumber, OldCheckCount : IntegerArrayPointerType ;
516+
variable OldAlertLogIDVar : AlertLogIDArrayPointerType ;
513517
variable Min, Max, Len, OldLen, OldMax : integer ;
514518
begin
515519
Min := minimum(L, R) ;
@@ -571,7 +575,7 @@ package body ScoreboardGenericPkg is
571575
end if ;
572576

573577
OldAlertLogIDVar := AlertLogIDVar ;
574-
AlertLogIDVar := new IntegerArrayType'(Min to Max => OSVVM_SCOREBOARD_ALERTLOG_ID) ;
578+
AlertLogIDVar := new AlertLogIDArrayType'(Min to Max => OSVVM_SCOREBOARD_ALERTLOG_ID) ;
575579
if OldAlertLogIDVar /= NULL then
576580
AlertLogIDVar(Min to OldMax) := OldAlertLogIDVar.all ;
577581
Deallocate(OldAlertLogIDVar) ;

0 commit comments

Comments
 (0)