Skip to content

Commit 1332432

Browse files
committed
Use integer'low rather than 'left and integer'high rather than 'right. Easier to understand.
1 parent 60ab7ee commit 1332432

19 files changed

+87
-87
lines changed

AlertLogPkg.vhd

+11-11
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ package AlertLogPkg is
157157
constant ALERT_DEFAULT_ID : AlertLogIDType := ALERTLOG_DEFAULT_ID ;
158158
constant LOG_DEFAULT_ID : AlertLogIDType := ALERTLOG_DEFAULT_ID ;
159159

160-
constant ALERTLOG_ID_NOT_FOUND : AlertLogIDType := -1 ; -- alternately integer'right
160+
constant ALERTLOG_ID_NOT_FOUND : AlertLogIDType := -1 ; -- alternately integer'high
161161
constant ALERTLOG_ID_NOT_ASSIGNED : AlertLogIDType := -1 ;
162162
constant MIN_NUM_AL_IDS : AlertLogIDType := 32 ; -- Number IDs initially allocated
163163

@@ -604,7 +604,7 @@ package AlertLogPkg is
604604
PrintDisabledAlerts : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
605605
PrintRequirements : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
606606
PrintIfHaveRequirements : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
607-
DefaultPassedGoal : integer := integer'left ;
607+
DefaultPassedGoal : integer := integer'low ;
608608
AlertPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
609609
LogPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
610610
ReportPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
@@ -613,7 +613,7 @@ package AlertLogPkg is
613613
FailName : string := OSVVM_STRING_INIT_PARM_DETECT ;
614614
IdSeparator : string := OSVVM_STRING_INIT_PARM_DETECT ;
615615
WriteTimeLast : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
616-
TimeJustifyAmount : integer := integer'left
616+
TimeJustifyAmount : integer := integer'low
617617
) ;
618618

619619
procedure ReportAlertLogOptions ;
@@ -2975,10 +2975,10 @@ package body AlertLogPkg is
29752975
procedure ClearAlertStopCounts is
29762976
------------------------------------------------------------
29772977
begin
2978-
AlertLogPtr(ALERTLOG_BASE_ID).AlertStopCount := (FAILURE => 0, ERROR => integer'right, WARNING => integer'right) ;
2978+
AlertLogPtr(ALERTLOG_BASE_ID).AlertStopCount := (FAILURE => 0, ERROR => integer'high, WARNING => integer'high) ;
29792979

29802980
for i in ALERTLOG_BASE_ID + 1 to NumAlertLogIDsVar loop
2981-
AlertLogPtr(i).AlertStopCount := (FAILURE => integer'right, ERROR => integer'right, WARNING => integer'right) ;
2981+
AlertLogPtr(i).AlertStopCount := (FAILURE => integer'high, ERROR => integer'high, WARNING => integer'high) ;
29822982
end loop ;
29832983
end procedure ClearAlertStopCounts ;
29842984

@@ -3122,7 +3122,7 @@ package body AlertLogPkg is
31223122
if AlertLogID = ALERTLOG_BASE_ID then
31233123
AlertEnabled := (TRUE, TRUE, TRUE) ;
31243124
LogEnabled := (others => FALSE) ;
3125-
AlertStopCount := (FAILURE => 0, ERROR => integer'right, WARNING => integer'right) ;
3125+
AlertStopCount := (FAILURE => 0, ERROR => integer'high, WARNING => integer'high) ;
31263126
HierarchyLevel := 0 ;
31273127
EnQueueID(AlertLogID, ALERTLOG_BASE_ID, TRUE) ;
31283128
else
@@ -3135,7 +3135,7 @@ package body AlertLogPkg is
31353135
LogEnabled := AlertLogPtr(ParentID).LogEnabled ;
31363136
EnQueueID(AlertLogID, ParentID, ParentIdSet) ;
31373137
end if ;
3138-
AlertStopCount := (FAILURE | ERROR | WARNING => integer'right) ;
3138+
AlertStopCount := (FAILURE | ERROR | WARNING => integer'high) ;
31393139
end if ;
31403140
AlertLogPtr(AlertLogID).Name := new string'(iName) ;
31413141
AlertLogPtr(AlertLogID).NameLower := new string'(to_lower(iName)) ;
@@ -3146,7 +3146,7 @@ package body AlertLogPkg is
31463146
AlertLogPtr(AlertLogID).PassedGoal := 0 ;
31473147
AlertLogPtr(AlertLogID).AlertEnabled := AlertEnabled ;
31483148
AlertLogPtr(AlertLogID).AlertStopCount := AlertStopCount ;
3149-
AlertLogPtr(AlertLogID).AlertPrintCount := (FAILURE | ERROR | WARNING => integer'right) ;
3149+
AlertLogPtr(AlertLogID).AlertPrintCount := (FAILURE | ERROR | WARNING => integer'high) ;
31503150
AlertLogPtr(AlertLogID).LogEnabled := LogEnabled ;
31513151
AlertLogPtr(AlertLogID).ReportMode := ReportMode ;
31523152
AlertLogPtr(AlertLogID).HierarchyLevel := HierarchyLevel ;
@@ -3742,7 +3742,7 @@ package body AlertLogPkg is
37423742
Count : integer
37433743
) is
37443744
begin
3745-
if AlertLogPtr(AlertLogID).AlertStopCount(Level) = integer'right then
3745+
if AlertLogPtr(AlertLogID).AlertStopCount(Level) = integer'high then
37463746
AlertLogPtr(AlertLogID).AlertStopCount(Level) := Count ;
37473747
else
37483748
AlertLogPtr(AlertLogID).AlertStopCount(Level) :=
@@ -7102,7 +7102,7 @@ package body AlertLogPkg is
71027102
PrintDisabledAlerts : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
71037103
PrintRequirements : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
71047104
PrintIfHaveRequirements : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
7105-
DefaultPassedGoal : integer := integer'left ;
7105+
DefaultPassedGoal : integer := integer'low ;
71067106
AlertPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
71077107
LogPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
71087108
ReportPrefix : string := OSVVM_STRING_INIT_PARM_DETECT ;
@@ -7111,7 +7111,7 @@ package body AlertLogPkg is
71117111
FailName : string := OSVVM_STRING_INIT_PARM_DETECT ;
71127112
IdSeparator : string := OSVVM_STRING_INIT_PARM_DETECT ;
71137113
WriteTimeLast : OsvvmOptionsType := OPT_INIT_PARM_DETECT ;
7114-
TimeJustifyAmount : integer := integer'left
7114+
TimeJustifyAmount : integer := integer'low
71157115
) is
71167116
begin
71177117
-- synthesis translate_off

CoveragePkg.vhd

+5-5
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ package CoveragePkg is
142142
ID : integer_max ;
143143
end record CoverageIDType ;
144144

145-
constant COVERAGE_ID_UNINITIALZED : CoverageIdType := (ID => integer'left) ;
145+
constant COVERAGE_ID_UNINITIALZED : CoverageIdType := (ID => integer'low) ;
146146

147147
type CoverageIDArrayType is array (integer range <>) of CoverageIDType ;
148148

@@ -156,7 +156,7 @@ package CoveragePkg is
156156
max : integer ;
157157
end record ;
158158
type RangeArrayType is array (integer range <>) of RangeType ;
159-
constant ALL_RANGE : RangeArrayType := (1=>(Integer'left, Integer'right)) ;
159+
constant ALL_RANGE : RangeArrayType := (1=>(integer'low, integer'high)) ;
160160

161161
--!! procedure write ( file f : text ; BinVal : RangeArrayType ) ;
162162
procedure write ( variable buf : inout line ; constant BinVal : in RangeArrayType) ;
@@ -1804,7 +1804,7 @@ package body CoveragePkg is
18041804
--!! for i in BinVal'range loop
18051805
--!! if BinVal(i).min = BinVal(i).max then
18061806
--!! write(f, "(" & to_string_max(BinVal(i).min) & ") " ) ;
1807-
--!! elsif (BinVal(i).min = integer'left) and (BinVal(i).max = integer'right) then
1807+
--!! elsif (BinVal(i).min = integer'low) and (BinVal(i).max = integer'high) then
18081808
--!! write(f, "(ALL) " ) ;
18091809
--!! else
18101810
--!! write(f, "(" & to_string_max(BinVal(i).min) & " to " &
@@ -3508,7 +3508,7 @@ package body CoveragePkg is
35083508
------------------------------------------------------------
35093509
impure function GetMinCount (ID : CoverageIDType) return integer is
35103510
------------------------------------------------------------
3511-
variable MinCount : integer := integer'right ; -- big number
3511+
variable MinCount : integer := integer'high ; -- big number
35123512
begin
35133513
CovLoop : for i in 1 to CovStructPtr(ID.ID).NumBins loop
35143514
if CovStructPtr(ID.ID).CovBinPtr(i).action = COV_COUNT and CovStructPtr(ID.ID).CovBinPtr(i).Count < MinCount then
@@ -6239,7 +6239,7 @@ package body CoveragePkg is
62396239
AdjAtLeast := AtLeast ; -- Valid
62406240
else
62416241
-- Done, Enable all bins
6242-
-- AdjAtLeast := integer'right ; -- Get All
6242+
-- AdjAtLeast := integer'high ; -- Get All
62436243
AdjAtLeast := GetMaxCount(ID) + 1 ; -- Get All
62446244
end if ;
62456245
end if;

DelayCoveragePkg.vhd

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ package DelayCoveragePkg is
6363
end record DelayCoverageIDType ;
6464
type DelayCoverageIDArrayType is array (integer range <>) of DelayCoverageIDType ;
6565

66-
constant DELAYCOVERAGE_ID_UNINITIALZED : DelayCoverageIDType := (ID => integer'left, others => COVERAGE_ID_UNINITIALZED) ;
66+
constant DELAYCOVERAGE_ID_UNINITIALZED : DelayCoverageIDType := (ID => integer'low, others => COVERAGE_ID_UNINITIALZED) ;
6767

6868
------------------------------------------------------------
6969
--- ///////////////////////////////////////////////////////////////////////////

MemoryGenericPkg.vhd

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ package MemoryGenericPkg is
8181
ID : integer_max ;
8282
end record MemoryIDType ;
8383

84-
constant MEMORY_ID_UNINITIALZED : MemoryIdType := (ID => integer'left) ;
84+
constant MEMORY_ID_UNINITIALZED : MemoryIdType := (ID => integer'low) ;
8585

8686
type MemoryIDArrayType is array (integer range <>) of MemoryIDType ;
8787

@@ -574,7 +574,7 @@ package body MemoryGenericPkg is
574574
) return boolean is
575575
begin
576576
if ID < MIN_INDEX or ID > MemStructPtr'High then
577-
if ID = integer'left then
577+
if ID = integer'low then
578578
Alert(OSVVM_MEMORY_ALERTLOG_ID, "MemoryPkg." & Name & " ID not initialized yet. " &
579579
"Either a call to NewID or wait for 0 ns (to allow for signal update) is needed. ",
580580
FAILURE ) ;

MemorySupportPkg.vhd

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ package body MemorySupportPkg is
275275
function InitMemoryBaseType_orig(Size : integer) return integer_vector is
276276
------------------------------------------------------------
277277
begin
278-
return (1 => integer'left) ;
278+
return (1 => integer'low) ;
279279
end function InitMemoryBaseType_orig ;
280280

281281
end MemorySupportPkg ;

NameStorePkg.vhd

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ package NameStorePkg is
5757
type NameIDArrayType is array (integer range <>) of NameIDType ;
5858
type NameSearchType is (PRIVATE_NAME, NAME, NAME_AND_PARENT, NAME_AND_PARENT_ELSE_PRIVATE) ;
5959
constant ID_NOT_FOUND : NameIDType := (ID => -1) ;
60-
constant NAME_ID_UNINITIALZED : NameIdType := (ID => integer'left) ;
60+
constant NAME_ID_UNINITIALZED : NameIdType := (ID => integer'low) ;
6161

6262
------------------------------------------------------------
6363
impure function NewID (

RandomBasePkg.vhd

+1-1
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ package body RandomBasePkg is
591591
--!! ValRange := rMax - rMin ;
592592
--!! return integer(round(A * ValRange + rMin)) ;
593593
--!! else
594-
--!! return integer'left ;
594+
--!! return integer'low ;
595595
--!! end if ;
596596
end function Scale ;
597597

RandomPkg.vhd

+2-2
Original file line numberDiff line numberDiff line change
@@ -1667,7 +1667,7 @@ package body RandomPkg is
16671667
DistArray(i) := DistArray(i) + sum ;
16681668
if DistArray(i) < sum then
16691669
Alert(OSVVM_RANDOM_ALERTLOG_ID, "RandomPkg.DistInt: negative weight or sum > 31 bits", FAILURE) ;
1670-
return DistArray'low ; -- allows debugging vs integer'left, out of range
1670+
return DistArray'low ; -- allows debugging vs integer'low, out of range
16711671
end if ;
16721672
sum := DistArray(i) ;
16731673
end loop ;
@@ -1682,7 +1682,7 @@ package body RandomPkg is
16821682
else
16831683
Alert(OSVVM_RANDOM_ALERTLOG_ID, "RandomPkg.DistInt: No randomization weights", FAILURE) ;
16841684
end if ;
1685-
return DistArray'low ; -- allows debugging vs integer'left, out of range
1685+
return DistArray'low ; -- allows debugging vs integer'low, out of range
16861686
end function DistInt ;
16871687

16881688
------------------------------------------------------------

RandomPkg2019.vhd

+2-2
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ package body RandomPkg2019 is
16431643
DistArray(i) := DistArray(i) + sum ;
16441644
if DistArray(i) < sum then
16451645
Alert(OSVVM_RANDOM_ALERTLOG_ID, "RandomPkg2019.DistInt: negative weight or sum > 31 bits", FAILURE) ;
1646-
return DistArray'low ; -- allows debugging vs integer'left, out of range
1646+
return DistArray'low ; -- allows debugging vs integer'low, out of range
16471647
end if ;
16481648
sum := DistArray(i) ;
16491649
end loop ;
@@ -1658,7 +1658,7 @@ package body RandomPkg2019 is
16581658
else
16591659
Alert(OSVVM_RANDOM_ALERTLOG_ID, "RandomPkg2019.DistInt: No randomization weights", FAILURE) ;
16601660
end if ;
1661-
return DistArray'low ; -- allows debugging vs integer'left, out of range
1661+
return DistArray'low ; -- allows debugging vs integer'low, out of range
16621662
end function DistInt ;
16631663

16641664
------------------------------------------------------------

RandomProcedurePkg.vhd

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ package body RandomProcedurePkg is
149149
DistArray(i) := DistArray(i) + sum ;
150150
if DistArray(i) < sum then
151151
Alert(OSVVM_RANDOM_ALERTLOG_ID, "RandomPkg.DistInt: negative weight or sum > 31 bits", FAILURE) ;
152-
R := DistArray'low ; -- allows debugging vs integer'left, out of range
152+
R := DistArray'low ; -- allows debugging vs integer'low, out of range
153153
end if ;
154154
sum := DistArray(i) ;
155155
end loop ;
@@ -165,7 +165,7 @@ package body RandomProcedurePkg is
165165
else
166166
Alert(OSVVM_RANDOM_ALERTLOG_ID, "RandomPkg.DistInt: No randomization weights", FAILURE) ;
167167
end if ;
168-
R := DistArray'low ; -- allows debugging vs integer'left, out of range
168+
R := DistArray'low ; -- allows debugging vs integer'low, out of range
169169
end procedure DistInt ;
170170

171171
end RandomProcedurePkg ;

ResolutionPkg.vhd

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ package body ResolutionPkg is
226226
variable result : integer := 0 ;
227227
begin
228228
for i in s'RANGE loop
229-
if s(i) /= integer'left then
229+
if s(i) /= integer'low then
230230
result := s(i) + result;
231231
end if ;
232232
end loop ;

ScoreboardGenericPkg.vhd

+11-11
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ package ScoreboardGenericPkg is
122122
type ScoreboardIdArrayType is array (integer range <>) of ScoreboardIdType ;
123123
type ScoreboardIdMatrixType is array (integer range <>, integer range <>) of ScoreboardIdType ;
124124

125-
constant SCOREBOARD_ID_UNINITIALZED : ScoreboardIdType := (ID => integer'left) ;
125+
constant SCOREBOARD_ID_UNINITIALZED : ScoreboardIdType := (ID => integer'low) ;
126126

127127
-- Preparation for refactoring - if that ever happens.
128128
subtype FifoIdType is ScoreboardIdType ;
@@ -364,7 +364,7 @@ package ScoreboardGenericPkg is
364364

365365
------------------------------------------------------------
366366
-- Find - Returns the ItemNumber for a value and tag (if applicable) in a scoreboard.
367-
-- Find returns integer'left if no match found
367+
-- Find returns integer'low if no match found
368368
-- Also See Flush. Flush will drop items up through the ItemNumber
369369

370370
-- Simple Scoreboard
@@ -665,7 +665,7 @@ package ScoreboardGenericPkg is
665665

666666
------------------------------------------------------------
667667
-- Find - Returns the ItemNumber for a value and tag (if applicable) in a scoreboard.
668-
-- Find returns integer'left if no match found
668+
-- Find returns integer'low if no match found
669669
-- Also See Flush. Flush will drop items up through the ItemNumber
670670
-- Scoreboard no tag
671671
impure function Find (
@@ -856,7 +856,7 @@ package ScoreboardGenericPkg is
856856

857857
------------------------------------------------------------
858858
-- Find - Returns the ItemNumber for a value and tag (if applicable) in a scoreboard.
859-
-- Find returns integer'left if no match found
859+
-- Find returns integer'low if no match found
860860
-- Also See Flush. Flush will drop items up through the ItemNumber
861861
-- Simple Scoreboard
862862
impure function Find (
@@ -1975,7 +1975,7 @@ package body ScoreboardGenericPkg is
19751975
------------------------------------------------------------
19761976
-- Tagged Scoreboards
19771977
-- Find Element with Matching Tag and ActualData
1978-
-- Returns integer'left if no match found
1978+
-- Returns integer'low if no match found
19791979
impure function Find (
19801980
------------------------------------------------------------
19811981
constant Index : in integer ;
@@ -1986,7 +1986,7 @@ package body ScoreboardGenericPkg is
19861986
variable FindParentPtr : ListPtrType ;
19871987
begin
19881988
--!! if LocalOutOfRange(Index, "Find") then
1989-
--!! return integer'left ; -- error reporting in LocalOutOfRange
1989+
--!! return integer'low ; -- error reporting in LocalOutOfRange
19901990
--!! end if ;
19911991
--!! CurPtr := SbPtr(Index).HeadPtr ;
19921992
--!! loop
@@ -2002,8 +2002,8 @@ package body ScoreboardGenericPkg is
20022002
--!! GetName & " Did not find Actual Data: " & actual_to_string(ActualData),
20032003
--!! ERROR ) ;
20042004
--!! end if ;
2005-
--!! -- return integer'left ;
2006-
--!! LocalItemNumber := integer'left ;
2005+
--!! -- return integer'low ;
2006+
--!! LocalItemNumber := integer'low ;
20072007
--!! exit ;
20082008
--!!
20092009
--!! elsif CurPtr.TagPtr.all = Tag and
@@ -2192,7 +2192,7 @@ package body ScoreboardGenericPkg is
21922192
------------------------------------------------------------
21932193
-- Scoreboard no tag
21942194
-- Find Element with Matching Tag and ActualData
2195-
-- Returns integer'left if no match found
2195+
-- Returns integer'low if no match found
21962196
procedure FindAndDelete (
21972197
------------------------------------------------------------
21982198
constant Index : in integer ;
@@ -2264,7 +2264,7 @@ package body ScoreboardGenericPkg is
22642264
------------------------------------------------------------
22652265
-- Scoreboard no tag
22662266
-- Find Element with Matching Tag and ActualData
2267-
-- Returns integer'left if no match found
2267+
-- Returns integer'low if no match found
22682268
procedure FindAndFlush (
22692269
------------------------------------------------------------
22702270
constant Index : in integer ;
@@ -3508,7 +3508,7 @@ package body ScoreboardGenericPkg is
35083508

35093509
------------------------------------------------------------
35103510
-- Find - Returns the ItemNumber for a value and tag (if applicable) in a scoreboard.
3511-
-- Find returns integer'left if no match found
3511+
-- Find returns integer'low if no match found
35123512
-- Also See Flush. Flush will drop items up through the ItemNumber
35133513

35143514
-- Simple Scoreboard

deprecated/MemoryPkg_c.vhd

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ package MemoryPkg is
8585
ID : integer_max ;
8686
end record MemoryIDType ;
8787

88-
constant MEMORY_ID_UNINITIALZED : MemoryIdType := (ID => integer'left) ;
88+
constant MEMORY_ID_UNINITIALZED : MemoryIdType := (ID => integer'low) ;
8989

9090
type MemoryIDArrayType is array (integer range <>) of MemoryIDType ;
9191

deprecated/MemoryPkg_orig_c.vhd

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ package MemoryPkg_orig is
8585
ID : integer_max ;
8686
end record MemoryIDType ;
8787

88-
constant MEMORY_ID_UNINITIALZED : MemoryIdType := (ID => integer'left) ;
88+
constant MEMORY_ID_UNINITIALZED : MemoryIdType := (ID => integer'low) ;
8989

9090
type MemoryIDArrayType is array (integer range <>) of MemoryIDType ;
9191

0 commit comments

Comments
 (0)