Skip to content

Commit e16704a

Browse files
committed
Update for L.all(L'left). GHDL does not default objects of type line to have L'left = 1.
1 parent f59f38f commit e16704a

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

MemoryPkg.vhd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
--
2020
-- Revision History:
2121
-- Date Version Description
22+
-- 05/2005: 0.1 Initial revision
2223
-- 06/2015: 2015.06 Updated for Alerts, ...
2324
-- Numerous revisions for VHDL Testbenches and Verification
24-
-- 05/2005: 0.1 Initial revision
25+
-- 01/2016: 2016.01 Update for buf.all(buf'left)
2526
--
2627
--
2728
-- Copyright (c) 2005 - 2015 by SynthWorks Design Inc. All rights reserved.
@@ -385,7 +386,7 @@ package body MemoryPkg is
385386
EmptyOrCommentLine(buf, Empty, MultiLineComment) ;
386387
exit ItemLoop when Empty ;
387388
ItemNum := ItemNum + 1 ;
388-
NextChar := buf.all(1) ;
389+
NextChar := buf.all(buf'left) ;
389390

390391
if (NextChar = '@') then
391392
-- Get Address

TextUtilPkg.vhd

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
-- Revision History:
2222
-- Date Version Description
2323
-- 01/2015: 2015.05 Initial revision
24+
-- 01/2016: 2016.01 Update for L.all(L'left)
2425
--
2526
--
2627
-- Copyright (c) 2015 by SynthWorks Design Inc. All rights reserved.
@@ -147,7 +148,7 @@ package body TextUtilPkg is
147148
begin
148149
Empty := TRUE ;
149150
WhiteSpLoop : while L /= null and L.all'length > 0 loop
150-
if (L.all(1) = ' ' or L.all(1) = NBSP or L.all(1) = HT) then
151+
if (L.all(L'left) = ' ' or L.all(L'left) = NBSP or L.all(L'left) = HT) then
151152
read (L, Char, Valid) ;
152153
exit when not Valid ;
153154
else
@@ -176,19 +177,18 @@ package body TextUtilPkg is
176177
variable MultiLineComment : inout boolean
177178
) is
178179
variable Valid : boolean ;
179-
variable Str : string(1 to 2) ;
180+
variable Char : character ;
180181
begin
181182
MultiLineComment := TRUE ;
182183
Empty := TRUE ;
183184
FindEndOfCommentLoop : while L /= null and L.all'length > 1 loop
184-
if L.all(1) = '*' and L.all(2) = '/' then
185-
read(L, Str, Valid) ;
185+
read(L, Char, Valid) ;
186+
if Char = '*' and L.all(L'left) = '/' then
187+
read(L, Char, Valid) ;
186188
Empty := FALSE ;
187189
MultiLineComment := FALSE ;
188190
exit FindEndOfCommentLoop ;
189-
else
190-
read(L, Str(1), Valid) ; -- remove one character and repeat
191-
end if;
191+
end if ;
192192
end loop ;
193193
end procedure FindCommentEnd ;
194194

@@ -200,7 +200,7 @@ package body TextUtilPkg is
200200
variable MultiLineComment : inout boolean
201201
) is
202202
variable Valid : boolean ;
203-
variable Char : character ;
203+
variable Next2Char : string(1 to 2) ;
204204
constant NBSP : CHARACTER := CHARACTER'val(160); -- space character
205205
begin
206206
if MultiLineComment then
@@ -213,13 +213,18 @@ package body TextUtilPkg is
213213

214214
Empty := TRUE ;
215215

216-
exit when L.all(1) = '#' ; -- shell style comment
216+
exit when L.all(L'left) = '#' ; -- shell style comment
217217

218218
if L.all'length >= 2 then
219-
exit when L.all(1 to 2) = "//" ; -- C style comment
220-
exit when L.all(1 to 2) = "--" ; -- VHDL style comment
219+
if L'ascending then
220+
Next2Char := L.all(L'left to L'left+1) ;
221+
else
222+
Next2Char := L.all(L'left to L'left-1) ;
223+
end if;
224+
exit when Next2Char = "//" ; -- C style comment
225+
exit when Next2Char = "--" ; -- VHDL style comment
221226

222-
if L.all(1 to 2) = "/*" then -- C style multi line comment
227+
if Next2Char = "/*" then -- C style multi line comment
223228
FindCommentEnd(L, Empty, MultiLineComment) ;
224229
exit when Empty ;
225230
next EmptyCheckLoop ; -- Found end of comment, restart processing line
@@ -252,7 +257,7 @@ package body TextUtilPkg is
252257
CharCount := 0 ;
253258

254259
ReadLoop : while L /= null and L.all'length > 0 loop
255-
NextChar := L.all(1) ;
260+
NextChar := L.all(L'left) ;
256261
if ishex(NextChar) or NextChar = 'X' or NextChar = 'Z' then
257262
hread(L, ReadVal, ReadValid) ;
258263
ReturnVal := ReturnVal(ResultNormLen-5 downto 0) & ReadVal ;
@@ -293,7 +298,7 @@ package body TextUtilPkg is
293298
CharCount := 0 ;
294299

295300
ReadLoop : while L /= null and L.all'length > 0 loop
296-
NextChar := L.all(1) ;
301+
NextChar := L.all(L'left) ;
297302
if isstd_logic(NextChar) then
298303
read(L, ReadVal, ReadValid) ;
299304
ReturnVal := ReturnVal(Result'length-2 downto 0) & ReadVal ;

0 commit comments

Comments
 (0)