21
21
-- Revision History:
22
22
-- Date Version Description
23
23
-- 01/2015: 2015.05 Initial revision
24
+ -- 01/2016: 2016.01 Update for L.all(L'left)
24
25
--
25
26
--
26
27
-- Copyright (c) 2015 by SynthWorks Design Inc. All rights reserved.
@@ -147,7 +148,7 @@ package body TextUtilPkg is
147
148
begin
148
149
Empty := TRUE ;
149
150
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
151
152
read (L, Char, Valid) ;
152
153
exit when not Valid ;
153
154
else
@@ -176,19 +177,18 @@ package body TextUtilPkg is
176
177
variable MultiLineComment : inout boolean
177
178
) is
178
179
variable Valid : boolean ;
179
- variable Str : string ( 1 to 2 ) ;
180
+ variable Char : character ;
180
181
begin
181
182
MultiLineComment := TRUE ;
182
183
Empty := TRUE ;
183
184
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) ;
186
188
Empty := FALSE ;
187
189
MultiLineComment := FALSE ;
188
190
exit FindEndOfCommentLoop ;
189
- else
190
- read (L, Str(1 ), Valid) ; -- remove one character and repeat
191
- end if ;
191
+ end if ;
192
192
end loop ;
193
193
end procedure FindCommentEnd ;
194
194
@@ -200,7 +200,7 @@ package body TextUtilPkg is
200
200
variable MultiLineComment : inout boolean
201
201
) is
202
202
variable Valid : boolean ;
203
- variable Char : character ;
203
+ variable Next2Char : string ( 1 to 2 ) ;
204
204
constant NBSP : CHARACTER := CHARACTER 'val (160 ); -- space character
205
205
begin
206
206
if MultiLineComment then
@@ -213,13 +213,18 @@ package body TextUtilPkg is
213
213
214
214
Empty := TRUE ;
215
215
216
- exit when L.all (1 ) = ' #' ; -- shell style comment
216
+ exit when L.all (L 'left ) = ' #' ; -- shell style comment
217
217
218
218
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
221
226
222
- if L. all ( 1 to 2 ) = " /*" then -- C style multi line comment
227
+ if Next2Char = " /*" then -- C style multi line comment
223
228
FindCommentEnd(L, Empty, MultiLineComment) ;
224
229
exit when Empty ;
225
230
next EmptyCheckLoop ; -- Found end of comment, restart processing line
@@ -252,7 +257,7 @@ package body TextUtilPkg is
252
257
CharCount := 0 ;
253
258
254
259
ReadLoop : while L /= null and L.all 'length > 0 loop
255
- NextChar := L.all (1 ) ;
260
+ NextChar := L.all (L 'left ) ;
256
261
if ishex(NextChar) or NextChar = 'X' or NextChar = 'Z' then
257
262
hread(L, ReadVal, ReadValid) ;
258
263
ReturnVal := ReturnVal(ResultNormLen- 5 downto 0 ) & ReadVal ;
@@ -293,7 +298,7 @@ package body TextUtilPkg is
293
298
CharCount := 0 ;
294
299
295
300
ReadLoop : while L /= null and L.all 'length > 0 loop
296
- NextChar := L.all (1 ) ;
301
+ NextChar := L.all (L 'left ) ;
297
302
if isstd_logic(NextChar) then
298
303
read (L, ReadVal, ReadValid) ;
299
304
ReturnVal := ReturnVal(Result'length - 2 downto 0 ) & ReadVal ;
0 commit comments