OpenCores
URL https://opencores.org/ocsvn/pltbutils/pltbutils/trunk

Subversion Repositories pltbutils

[/] [pltbutils/] [trunk/] [src/] [vhdl/] [txt_util.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 pela
----------------------------------------------------------------------
2
----                                                              ----
3
---- txt_util.vhd                                                 ----
4
----                                                              ----
5
---- This file is part of the PlTbUtils project                   ----
6
---- http://opencores.org/project,pltbutils                       ----
7
----                                                              ----
8
---- Description:                                                 ----
9
---- PlTbUtils is a collection of functions, procedures and       ----
10
---- components for easily creating stimuli and checking response ----
11
---- in automatic self-checking testbenches.                      ----
12
----                                                              ----
13
---- This file defines useful functions an procedures for text    ----
14
---- handling text in VHDL.                                       ----
15
----                                                              ----
16
---- To Do:                                                       ----
17
---- -                                                            ----
18
----                                                              ----
19
---- Source:                                                      ----
20
---- http://www.mrc.uidaho.edu/mrc/people/jff/vhdl_info/txt_util.vhd -
21
---- Thanks to Stefan Doll and James F. Frenzel.                  ----                                                              ----
22
----------------------------------------------------------------------
23
--  
24
--  Disclaimer: Derived from txt_util.vhd on www.stefanvhdl.com
25
--  
26
--  Revision History:
27
--  
28
--  1.0 URL: http://www.stefanvhdl.com/vhdl/vhdl/txt_util.vhd
29
--  
30
--  1.1 Modified str_read() to prevent extra character (JFF)
31
--  
32
--  1.2 Added is_whitespace() and strip_whitespace() (JFF)
33
--  
34
--  1.3 Added first_string() and chomp() (JFF)
35
--  
36
--  1.4 Added hex string and integer string conversion (JFF)
37
--  
38
----------------------------------------------------------------
39
 
40
library ieee;
41
use ieee.std_logic_1164.all;
42
use std.textio.all;
43
 
44
package txt_util is
45
 
46
    -- prints a message to the screen
47
    procedure print(text: string);
48
 
49
    -- prints the message when active
50
    -- useful for debug switches
51
    procedure print(active: boolean; text: string);
52
 
53
    -- converts std_logic into a character
54
    function chr(sl: std_logic) return character;
55
 
56
    -- converts std_logic into a string (1 to 1)
57
    function str(sl: std_logic) return string;
58
 
59
    -- converts std_logic_vector into a string (binary base)
60
    function str(slv: std_logic_vector) return string;
61
 
62
    -- converts boolean into a string
63
    function str(b: boolean) return string;
64
 
65
    -- converts an integer into a single character
66
    -- (can also be used for hex conversion and other bases)
67
    function chr(int: integer) return character;
68
 
69
    -- converts integer into string using specified base
70
    function str(int: integer; base: integer) return string;
71
 
72
    -- converts integer to string, using base 10
73
    function str(int: integer) return string;
74
 
75
    -- convert std_logic_vector into a string in hex format
76
    function hstr(slv: std_logic_vector) return string;
77
 
78
 
79
    -- functions to manipulate strings
80
    -----------------------------------
81
 
82
    -- convert a character to upper case
83
    function to_upper(c: character) return character;
84
 
85
    -- convert a character to lower case
86
    function to_lower(c: character) return character;
87
 
88
    -- convert a string to upper case
89
    function to_upper(s: string) return string;
90
 
91
    -- convert a string to lower case
92
    function to_lower(s: string) return string;
93
 
94
         -- checks if whitespace (JFF)
95
         function is_whitespace(c: character) return boolean;
96
 
97
         -- remove leading whitespace (JFF)
98
         function strip_whitespace(s: string) return string;
99
 
100
         -- return first nonwhitespace substring (JFF)
101
         function first_string(s: string) return string;
102
 
103
    -- finds the first non-whitespace substring in a string and (JFF)  
104
         -- returns both the substring and the original with the substring removed 
105
         procedure chomp(variable s: inout string; variable shead: out string);
106
 
107
 
108
 
109
 
110
    -- functions to convert strings into other formats
111
    --------------------------------------------------
112
 
113
    -- converts a character into std_logic
114
    function to_std_logic(c: character) return std_logic;
115
 
116
    -- converts a hex character into std_logic_vector (JFF)
117
    function chr_to_slv(c: character) return std_logic_vector;
118
 
119
    -- converts a character into int (JFF)
120
    function chr_to_int(c: character) return integer;
121
 
122
    -- converts a binary string into std_logic_vector
123
    function to_std_logic_vector(s: string) return std_logic_vector;
124
 
125
    -- converts a hex string into std_logic_vector (JFF)
126
    function hstr_to_slv(s: string) return std_logic_vector;
127
 
128
    -- converts a decimal string into an integer (JFF)
129
    function str_to_int(s: string) return integer;
130
 
131
 
132
 
133
    -- file I/O
134
    -----------
135
 
136
    -- read variable length string from input file
137
    procedure str_read(file in_file: TEXT;
138
                       res_string: out string);
139
 
140
    -- print string to a file and start new line
141
    procedure print(file out_file: TEXT;
142
                    new_string: in  string);
143
 
144
    -- print character to a file and start new line
145
    procedure print(file out_file: TEXT;
146
                    char:       in  character);
147
 
148
end txt_util;
149
 
150
 
151
 
152
 
153
package body txt_util is
154
 
155
 
156
 
157
 
158
   -- prints text to the screen
159
 
160
   procedure print(text: string) is
161
     variable msg_line: line;
162
     begin
163
       write(msg_line, text);
164
       writeline(output, msg_line);
165
   end print;
166
 
167
 
168
 
169
 
170
   -- prints text to the screen when active
171
 
172
   procedure print(active: boolean; text: string)  is
173
     begin
174
      if active then
175
         print(text);
176
      end if;
177
   end print;
178
 
179
 
180
   -- converts std_logic into a character
181
 
182
   function chr(sl: std_logic) return character is
183
    variable c: character;
184
    begin
185
      case sl is
186
         when 'U' => c:= 'U';
187
         when 'X' => c:= 'X';
188
         when '0' => c:= '0';
189
         when '1' => c:= '1';
190
         when 'Z' => c:= 'Z';
191
         when 'W' => c:= 'W';
192
         when 'L' => c:= 'L';
193
         when 'H' => c:= 'H';
194
         when '-' => c:= '-';
195
      end case;
196
    return c;
197
   end chr;
198
 
199
 
200
 
201
   -- converts std_logic into a string (1 to 1)
202
 
203
   function str(sl: std_logic) return string is
204
    variable s: string(1 to 1);
205
    begin
206
        s(1) := chr(sl);
207
        return s;
208
   end str;
209
 
210
 
211
 
212
   -- converts std_logic_vector into a string (binary base)
213
   -- (this also takes care of the fact that the range of
214
   --  a string is natural while a std_logic_vector may
215
   --  have an integer range)
216
 
217
   function str(slv: std_logic_vector) return string is
218
     variable result : string (1 to slv'length);
219
     variable r : integer;
220
   begin
221
     r := 1;
222
     for i in slv'range loop
223
        result(r) := chr(slv(i));
224
        r := r + 1;
225
     end loop;
226
     return result;
227
   end str;
228
 
229
 
230
   function str(b: boolean) return string is
231
 
232
    begin
233
       if b then
234
          return "true";
235
      else
236
        return "false";
237
       end if;
238
    end str;
239
 
240
 
241
   -- converts an integer into a character
242
   -- for 0 to 9 the obvious mapping is used, higher
243
   -- values are mapped to the characters A-Z
244
   -- (this is usefull for systems with base > 10)
245
   -- (adapted from Steve Vogwell's posting in comp.lang.vhdl)
246
 
247
   function chr(int: integer) return character is
248
    variable c: character;
249
   begin
250
        case int is
251
          when  0 => c := '0';
252
          when  1 => c := '1';
253
          when  2 => c := '2';
254
          when  3 => c := '3';
255
          when  4 => c := '4';
256
          when  5 => c := '5';
257
          when  6 => c := '6';
258
          when  7 => c := '7';
259
          when  8 => c := '8';
260
          when  9 => c := '9';
261
          when 10 => c := 'A';
262
          when 11 => c := 'B';
263
          when 12 => c := 'C';
264
          when 13 => c := 'D';
265
          when 14 => c := 'E';
266
          when 15 => c := 'F';
267
          when 16 => c := 'G';
268
          when 17 => c := 'H';
269
          when 18 => c := 'I';
270
          when 19 => c := 'J';
271
          when 20 => c := 'K';
272
          when 21 => c := 'L';
273
          when 22 => c := 'M';
274
          when 23 => c := 'N';
275
          when 24 => c := 'O';
276
          when 25 => c := 'P';
277
          when 26 => c := 'Q';
278
          when 27 => c := 'R';
279
          when 28 => c := 'S';
280
          when 29 => c := 'T';
281
          when 30 => c := 'U';
282
          when 31 => c := 'V';
283
          when 32 => c := 'W';
284
          when 33 => c := 'X';
285
          when 34 => c := 'Y';
286
          when 35 => c := 'Z';
287
          when others => c := '?';
288
        end case;
289
        return c;
290
    end chr;
291
 
292
 
293
 
294
   -- convert integer to string using specified base
295
   -- (adapted from Steve Vogwell's posting in comp.lang.vhdl)
296
 
297
   function str(int: integer; base: integer) return string is
298
 
299
    variable temp:      string(1 to 10);
300
    variable num:       integer;
301
    variable abs_int:   integer;
302
    variable len:       integer := 1;
303
    variable power:     integer := 1;
304
 
305
   begin
306
 
307
    -- bug fix for negative numbers
308
    abs_int := abs(int);
309
 
310
    num     := abs_int;
311
 
312
    while num >= base loop                     -- Determine how many
313
      len := len + 1;                          -- characters required
314
      num := num / base;                       -- to represent the
315
    end loop ;                                 -- number.
316
 
317
    for i in len downto 1 loop                 -- Convert the number to
318
      temp(i) := chr(abs_int/power mod base);  -- a string starting
319
      power := power * base;                   -- with the right hand
320
    end loop ;                                 -- side.
321
 
322
    -- return result and add sign if required
323
    if int < 0 then
324
       return '-'& temp(1 to len);
325
     else
326
       return temp(1 to len);
327
    end if;
328
 
329
   end str;
330
 
331
 
332
  -- convert integer to string, using base 10
333
  function str(int: integer) return string is
334
 
335
   begin
336
 
337
    return str(int, 10) ;
338
 
339
   end str;
340
 
341
 
342
 
343
   -- converts a std_logic_vector into a hex string.
344
   function hstr(slv: std_logic_vector) return string is
345
       variable hexlen: integer;
346
       variable longslv : std_logic_vector(67 downto 0) := (others => '0');
347
       variable hex : string(1 to 16);
348
       variable fourbit : std_logic_vector(3 downto 0);
349
     begin
350
       hexlen := (slv'left+1)/4;
351
       if (slv'left+1) mod 4 /= 0 then
352
         hexlen := hexlen + 1;
353
       end if;
354
       longslv(slv'left downto 0) := slv;
355
       for i in (hexlen -1) downto 0 loop
356
         fourbit := longslv(((i*4)+3) downto (i*4));
357
         case fourbit is
358
           when "0000" => hex(hexlen -I) := '0';
359
           when "0001" => hex(hexlen -I) := '1';
360
           when "0010" => hex(hexlen -I) := '2';
361
           when "0011" => hex(hexlen -I) := '3';
362
           when "0100" => hex(hexlen -I) := '4';
363
           when "0101" => hex(hexlen -I) := '5';
364
           when "0110" => hex(hexlen -I) := '6';
365
           when "0111" => hex(hexlen -I) := '7';
366
           when "1000" => hex(hexlen -I) := '8';
367
           when "1001" => hex(hexlen -I) := '9';
368
           when "1010" => hex(hexlen -I) := 'A';
369
           when "1011" => hex(hexlen -I) := 'B';
370
           when "1100" => hex(hexlen -I) := 'C';
371
           when "1101" => hex(hexlen -I) := 'D';
372
           when "1110" => hex(hexlen -I) := 'E';
373
           when "1111" => hex(hexlen -I) := 'F';
374
           when "ZZZZ" => hex(hexlen -I) := 'z';
375
           when "UUUU" => hex(hexlen -I) := 'u';
376
           when "XXXX" => hex(hexlen -I) := 'x';
377
           when others => hex(hexlen -I) := '?';
378
         end case;
379
       end loop;
380
       return hex(1 to hexlen);
381
     end hstr;
382
 
383
 
384
 
385
   -- functions to manipulate strings
386
   -----------------------------------
387
 
388
 
389
   -- convert a character to upper case
390
 
391
   function to_upper(c: character) return character is
392
 
393
      variable u: character;
394
 
395
    begin
396
 
397
       case c is
398
        when 'a' => u := 'A';
399
        when 'b' => u := 'B';
400
        when 'c' => u := 'C';
401
        when 'd' => u := 'D';
402
        when 'e' => u := 'E';
403
        when 'f' => u := 'F';
404
        when 'g' => u := 'G';
405
        when 'h' => u := 'H';
406
        when 'i' => u := 'I';
407
        when 'j' => u := 'J';
408
        when 'k' => u := 'K';
409
        when 'l' => u := 'L';
410
        when 'm' => u := 'M';
411
        when 'n' => u := 'N';
412
        when 'o' => u := 'O';
413
        when 'p' => u := 'P';
414
        when 'q' => u := 'Q';
415
        when 'r' => u := 'R';
416
        when 's' => u := 'S';
417
        when 't' => u := 'T';
418
        when 'u' => u := 'U';
419
        when 'v' => u := 'V';
420
        when 'w' => u := 'W';
421
        when 'x' => u := 'X';
422
        when 'y' => u := 'Y';
423
        when 'z' => u := 'Z';
424
        when others => u := c;
425
    end case;
426
 
427
      return u;
428
 
429
   end to_upper;
430
 
431
 
432
   -- convert a character to lower case
433
 
434
   function to_lower(c: character) return character is
435
 
436
      variable l: character;
437
 
438
    begin
439
 
440
       case c is
441
        when 'A' => l := 'a';
442
        when 'B' => l := 'b';
443
        when 'C' => l := 'c';
444
        when 'D' => l := 'd';
445
        when 'E' => l := 'e';
446
        when 'F' => l := 'f';
447
        when 'G' => l := 'g';
448
        when 'H' => l := 'h';
449
        when 'I' => l := 'i';
450
        when 'J' => l := 'j';
451
        when 'K' => l := 'k';
452
        when 'L' => l := 'l';
453
        when 'M' => l := 'm';
454
        when 'N' => l := 'n';
455
        when 'O' => l := 'o';
456
        when 'P' => l := 'p';
457
        when 'Q' => l := 'q';
458
        when 'R' => l := 'r';
459
        when 'S' => l := 's';
460
        when 'T' => l := 't';
461
        when 'U' => l := 'u';
462
        when 'V' => l := 'v';
463
        when 'W' => l := 'w';
464
        when 'X' => l := 'x';
465
        when 'Y' => l := 'y';
466
        when 'Z' => l := 'z';
467
        when others => l := c;
468
    end case;
469
 
470
      return l;
471
 
472
   end to_lower;
473
 
474
 
475
 
476
   -- convert a string to upper case
477
 
478
   function to_upper(s: string) return string is
479
 
480
     variable uppercase: string (s'range);
481
 
482
   begin
483
 
484
     for i in s'range loop
485
        uppercase(i):= to_upper(s(i));
486
     end loop;
487
     return uppercase;
488
 
489
   end to_upper;
490
 
491
 
492
 
493
   -- convert a string to lower case
494
 
495
   function to_lower(s: string) return string is
496
 
497
     variable lowercase: string (s'range);
498
 
499
   begin
500
 
501
     for i in s'range loop
502
        lowercase(i):= to_lower(s(i));
503
     end loop;
504
     return lowercase;
505
 
506
   end to_lower;
507
 
508
 
509
        -- checks if whitespace (JFF)
510
 
511
        function is_whitespace(c: character) return boolean is
512
 
513
        begin
514
 
515
                if (c = ' ') or (c = HT) then
516
                        return true;
517
                else return false;
518
                end if;
519
 
520
        end is_whitespace;
521
 
522
 
523
        -- remove leading whitespace (JFF)
524
 
525
        function strip_whitespace(s: string) return string is
526
 
527
        variable stemp : string (s'range);
528
        variable j, k : positive := 1;
529
 
530
        begin
531
 
532
        -- fill stemp with blanks
533
        for i in s'range loop
534
                stemp(i) := ' ';
535
        end loop;
536
 
537
        -- find first non-whitespace in s
538
        for i in s'range loop
539
                if is_whitespace(s(i)) then
540
                        j := j + 1;
541
                else exit;
542
                end if;
543
        end loop;
544
        -- j points to first non-whitespace
545
 
546
        -- copy remainder of s into stemp
547
        -- starting at 1
548
        for i in j to s'length loop
549
                stemp(k) := s(i);
550
                k := k + 1;
551
        end loop;
552
 
553
        return stemp;
554
 
555
        end strip_whitespace;
556
 
557
 
558
 
559
        -- return first non-whitespacesubstring (JFF)
560
 
561
        function first_string(s: string) return string is
562
 
563
        variable stemp, s2 : string (s'range);
564
 
565
        begin
566
 
567
        -- fill s2 with blanks
568
        for i in s'range loop
569
                s2(i) := ' ';
570
        end loop;
571
 
572
        -- remove leading whitespace
573
        stemp := strip_whitespace(s);
574
 
575
        -- copy until first whitespace
576
        for i in stemp'range loop
577
                if not is_whitespace(stemp(i)) then
578
                        s2(i) := stemp(i);
579
                else exit;
580
                end if;
581
        end loop;
582
 
583
        return s2;
584
 
585
        end first_string;
586
 
587
 
588
 
589
        -- removes first non-whitespace string from a string (JFF)
590
 
591
        procedure chomp(variable s: inout string; variable shead: out string) is
592
 
593
        variable stemp, stemp2 : string (s'range);
594
        variable j, k : positive := 1;
595
 
596
        begin
597
 
598
        -- fill stemp and stemp2 with blanks
599
        for i in s'range loop
600
                stemp(i) := ' '; stemp2(i) := ' ';
601
        end loop;
602
 
603
        stemp := strip_whitespace(s);
604
 
605
        shead := first_string(stemp);
606
 
607
        -- find first whitespace in stemp
608
        for i in stemp'range loop
609
                if not is_whitespace(stemp(i)) then
610
                        j := j + 1;
611
                else exit;
612
                end if;
613
        end loop;
614
        -- j points to first whitespace
615
 
616
        -- copy remainder of stemp into stemp2
617
        -- starting at 1
618
        for i in j to stemp'length loop
619
                stemp2(k) := stemp(i);
620
                k := k + 1;
621
        end loop;
622
 
623
        s := stemp2;
624
 
625
        end chomp;
626
 
627
 
628
 
629
-- functions to convert strings into other types
630
 
631
 
632
-- converts a character into a std_logic
633
 
634
function to_std_logic(c: character) return std_logic is
635
    variable sl: std_logic;
636
    begin
637
      case c is
638
        when 'U' =>
639
           sl := 'U';
640
        when 'X' =>
641
           sl := 'X';
642
        when '0' =>
643
           sl := '0';
644
        when '1' =>
645
           sl := '1';
646
        when 'Z' =>
647
           sl := 'Z';
648
        when 'W' =>
649
           sl := 'W';
650
        when 'L' =>
651
           sl := 'L';
652
        when 'H' =>
653
           sl := 'H';
654
        when '-' =>
655
           sl := '-';
656
        when others =>
657
           sl := 'X';
658
    end case;
659
   return sl;
660
  end to_std_logic;
661
 
662
 
663
    -- converts a character into std_logic_vector (JFF)
664
    function chr_to_slv(c: character) return std_logic_vector is
665
    variable slv: std_logic_vector(3 downto 0);
666
    begin
667
      case c is
668
        when '0' =>
669
           slv := "0000";
670
        when '1' =>
671
           slv := "0001";
672
        when '2' =>
673
           slv := "0010";
674
        when '3' =>
675
           slv := "0011";
676
        when '4' =>
677
           slv := "0100";
678
        when '5' =>
679
           slv := "0101";
680
        when '6' =>
681
           slv := "0110";
682
        when '7' =>
683
           slv := "0111";
684
        when '8' =>
685
           slv := "1000";
686
        when '9' =>
687
           slv := "1001";
688
        when 'A' | 'a' =>
689
           slv := "1010";
690
        when 'B' | 'b' =>
691
           slv := "1011";
692
        when 'C' | 'c' =>
693
           slv := "1100";
694
        when 'D' | 'd' =>
695
           slv := "1101";
696
        when 'E' | 'e' =>
697
           slv := "1110";
698
        when 'F' | 'f' =>
699
           slv := "1111";
700
        when others => null;
701
    end case;
702
   return slv;
703
         end chr_to_slv;
704
 
705
 
706
    -- converts a character into int (JFF)
707
    function chr_to_int(c: character) return integer is
708
    variable x: integer;
709
    begin
710
      case c is
711
        when '0' =>
712
           x := 0;
713
        when '1' =>
714
           x := 1;
715
        when '2' =>
716
           x := 2;
717
        when '3' =>
718
           x := 3;
719
        when '4' =>
720
           x := 4;
721
        when '5' =>
722
           x := 5;
723
        when '6' =>
724
           x := 6;
725
        when '7' =>
726
           x := 7;
727
        when '8' =>
728
           x := 8;
729
        when '9' =>
730
           x := 9;
731
        when others => null;
732
    end case;
733
   return x;
734
         end chr_to_int;
735
 
736
 
737
 
738
-- converts a binary string into std_logic_vector
739
 
740
function to_std_logic_vector(s: string) return std_logic_vector is
741
  variable slv: std_logic_vector(s'high-s'low downto 0);
742
  variable k: integer;
743
begin
744
   k := s'high-s'low;
745
  for i in s'range loop
746
     slv(k) := to_std_logic(s(i));
747
     k      := k - 1;
748
  end loop;
749
  return slv;
750
end to_std_logic_vector;
751
 
752
 
753
    -- converts a hex string into std_logic_vector (JFF)
754
    function hstr_to_slv(s: string) return std_logic_vector is
755
  variable slv: std_logic_vector(((s'length*4)-1) downto 0) := (others => '0');
756
  variable k: integer;
757
begin
758
  for i in s'range loop
759
    slv := slv((slv'length - 5) downto 0) & chr_to_slv(s(i));
760
  end loop;
761
  return slv;
762
         end hstr_to_slv;
763
 
764
    -- converts a decimal string into an integer (JFF)
765
    function str_to_int(s: string) return integer is
766
  variable k: integer;
767
begin
768
   k := 0;
769
  for i in s'range loop
770
     k := (k*10) + chr_to_int(s(i));
771
  end loop;
772
  return k;
773
         end str_to_int;
774
 
775
 
776
 
777
 
778
 
779
 
780
 
781
----------------
782
--  file I/O  --
783
----------------
784
 
785
 
786
 
787
-- read variable length string from input file
788
 
789
procedure str_read(file in_file: TEXT;
790
                   res_string: out string) is
791
 
792
       variable l:         line;
793
       variable c:         character;
794
       variable is_string: boolean;
795
 
796
   begin
797
 
798
     readline(in_file, l);
799
     -- clear the contents of the result string
800
     for i in res_string'range loop
801
         res_string(i) := ' ';
802
     end loop;
803
     -- read all characters of the line, up to the length  
804
     -- of the results string
805
     for i in res_string'range loop
806
 
807
-- JFF - new
808
--
809
    read(l, c, is_string);
810
    if is_string then res_string(i) := c;
811
    else exit;
812
    end if;
813
 
814
-- JFF - was duplicating the last char if no 
815
-- space at the end of the line
816
-- 
817
--        read(l, c, is_string);
818
--        res_string(i) := c;
819
--        if not is_string then -- found end of line
820
--           exit;
821
--        end if;
822
 
823
 
824
     end loop;
825
 
826
end str_read;
827
 
828
 
829
-- print string to a file
830
procedure print(file out_file: TEXT;
831
                new_string: in  string) is
832
 
833
       variable l: line;
834
 
835
   begin
836
 
837
     write(l, new_string);
838
     writeline(out_file, l);
839
 
840
end print;
841
 
842
 
843
-- print character to a file and start new line
844
procedure print(file out_file: TEXT;
845
                char: in  character) is
846
 
847
       variable l: line;
848
 
849
   begin
850
 
851
     write(l, char);
852
     writeline(out_file, l);
853
 
854
end print;
855
 
856
 
857
 
858
-- appends contents of a string to a file until line feed occurs
859
-- (LF is considered to be the end of the string)
860
 
861
procedure str_write(file out_file: TEXT;
862
                    new_string: in  string) is
863
 begin
864
 
865
   for i in new_string'range loop
866
      print(out_file, new_string(i));
867
      if new_string(i) = LF then -- end of string
868
         exit;
869
      end if;
870
   end loop;
871
 
872
end str_write;
873
 
874
 
875
 
876
 
877
end txt_util;
878
 
879
 
880
 
881
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.