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

Subversion Repositories vhld_tb

[/] [vhld_tb/] [trunk/] [source/] [tb_pkg_body.vhd] - Blame information for rev 10

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sckoarn
-------------------------------------------------------------------------------
2
--             Copyright 2007  Ken Campbell
3
-------------------------------------------------------------------------------
4
-- $Author: sckoarn $
5
--
6 10 sckoarn
-- $Date: 2007-09-02 04:04:04 $
7 2 sckoarn
--
8
-- $Name: not supported by cvs2svn $
9
--
10 10 sckoarn
-- $Id: tb_pkg_body.vhd,v 1.2 2007-09-02 04:04:04 sckoarn Exp $
11 2 sckoarn
--
12
-- $Source: /home/marcus/revision_ctrl_test/oc_cvs/cvs/vhld_tb/source/tb_pkg_body.vhd,v $
13
--
14
-- Description :  The the testbench package body file.
15
--                Initial GNU release.
16
--
17
------------------------------------------------------------------------------
18
--This file is part of The VHDL Test Bench.
19
--
20
--    The VHDL Test Bench is free software; you can redistribute it and/or modify
21
--    it under the terms of the GNU General Public License as published by
22
--    the Free Software Foundation; either version 2 of the License, or
23
--    (at your option) any later version.
24
--
25 10 sckoarn
--    The VHDL Test Bench is distributed in the hope that it will be useful,
26 2 sckoarn
--    but WITHOUT ANY WARRANTY; without even the implied warranty of
27
--    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
--    GNU General Public License for more details.
29
--
30
--    You should have received a copy of the GNU General Public License
31
--    along with The VHDL Test Bench; if not, write to the Free Software
32
--    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
33
-------------------------------------------------------------------------------
34
-- Revision History:
35
-- $Log: not supported by cvs2svn $
36 10 sckoarn
-- Revision 1.1.1.1  2007/04/06 04:06:48  sckoarn
37
-- Import of the vhld_tb
38 2 sckoarn
--
39 10 sckoarn
--
40 2 sckoarn
-------------------------------------------------------------------------------
41
 
42
package body tb_pkg is
43
 
44
-------------------------------------------------------------------------------
45
-- FUNCTION Defs
46
-------------------------------------------------------------------------------
47
--  is_digit
48
 function is_digit(constant c: in character) return boolean is
49
   variable rtn : boolean;
50
 begin
51
   if (c >= '0' and c <= '9') then
52
        rtn := true;
53
   else
54
        rtn := false;
55
   end if;
56
   return rtn;
57
 end is_digit;
58
--------------------------------------
59
-- is_space 
60
 function is_space(constant c: in character) return boolean is
61
   variable rtn : boolean;
62
 begin
63
   if(c = ' ' or c = ht) then
64
        rtn := true;
65
   else
66
        rtn := false;
67
   end if;
68
   return rtn;
69
 end is_space;
70
------------------------------------------------------------------------------
71
--  to_char
72
  function ew_to_char(int: integer) return character is
73
    variable c: character;
74
  begin
75
    c := nul;
76
    case int is
77
      when 0 => c := '0';
78
      when 1 => c := '1';
79
      when 2 => c := '2';
80
      when 3 => c := '3';
81
      when 4 => c := '4';
82
      when 5 => c := '5';
83
      when 6 => c := '6';
84
      when 7 => c := '7';
85
      when 8 => c := '8';
86
      when 9 => c := '9';
87
      when 10 => c := 'A';
88
      when 11 => c := 'B';
89
      when 12 => c := 'C';
90
      when 13 => c := 'D';
91
      when 14 => c := 'E';
92
      when 15 => c := 'F';
93
      when others =>
94
         assert(false)
95
           report LF & "Error: ew_to_char was given a non Number didgit."
96
         severity failure;
97
    end case;
98
 
99
    return c;
100
  end ew_to_char;
101
 
102
-------------------------------------------------------------------------------
103
--  to_string function  integer
104
  function to_str(int: integer) return string is
105
  begin
106
    return ew_to_str(int,dec) ;
107
  end to_str ;
108
 
109
-------------------------------------------------------------------------------
110
--  ew_str_cat
111
  function ew_str_cat(s1: stm_text;
112
                      s2: text_field) return stm_text is
113
 
114
    variable i:  integer;
115
    variable j:  integer;
116
    variable sc: stm_text;
117
 
118
  begin
119
    sc := s1;
120
    i := 1;
121
    while(sc(i) /= nul) loop
122
      i := i + 1;
123
    end loop;
124
    j := 1;
125
    while(s2(j) /= nul) loop
126
      sc(i) := s2(j);
127
      i := i + 1;
128
      j := j + 1;
129
    end loop;
130
 
131
    return sc;
132
  end ew_str_cat;
133
 
134
-------------------------------------------------------------------------------
135
-- fld_len    field length
136
--          inputs :  string of type text_field
137
--          return :  integer number of non 'nul' chars
138
function fld_len(s : in text_field) return integer is
139
    variable i:  integer := 1;
140
  begin
141
    while(s(i) /= nul) loop
142
      i := i + 1;
143
    end loop;
144
    return (i - 1);
145
  end fld_len;
146
------------------------------------------------------------------------------
147
-- c2int   convert character to integer
148
function c2int(c: in character) return integer is
149
  variable i:  integer;
150
begin
151
  i := -1;
152
  case c is
153
    when '0' => i := 0;
154
    when '1' => i := 1;
155
    when '2' => i := 2;
156
    when '3' => i := 3;
157
    when '4' => i := 4;
158
    when '5' => i := 5;
159
    when '6' => i := 6;
160
    when '7' => i := 7;
161
    when '8' => i := 8;
162
    when '9' => i := 9;
163
    when others =>
164
      assert(false)
165
        report LF & "Error: c2int was given a non Number didgit."
166
      severity failure;
167
  end case;
168
  return i;
169
end c2int;
170
-------------------------------------------------------------------------------
171
-- str2integer   Convert a string to integer number.
172
--   inputs  :  string
173
--   output  :  int value
174
function str2integer(str: in string) return integer is
175
  variable l:   integer;
176
  variable j:   integer := 1;
177
  variable rtn: integer := 0;
178
begin
179
  l := fld_len(str);
180
 
181
  for i in l downto 1 loop
182
    rtn := rtn + (c2int(str(j)) *(10**(i - 1)));
183
    j := j + 1;
184
  end loop;
185
 
186
  return rtn;
187
end str2integer;
188
-------------------------------------------------------------------------------
189
-- hex2integer    convert hex Stimulus field to integer
190
--          inputs :  string of type text_field containing only Hex numbers
191
--          return :  integer value
192
function hex2integer(hex_number:  in text_field;
193
                     file_name:   in text_line;
194
                     line:        in integer) return integer is
195
    variable len:         integer;
196
    variable temp_field:  text_field;
197
    variable temp_int:    integer;
198
    variable power:       integer;
199
    variable int_number:  integer;
200
  begin
201
     len      := fld_len(hex_number);
202
     power    := 0;
203
     temp_int := 0;
204
     for i in len downto 1 loop
205
       case hex_number(i) is
206
         when '0' =>
207
           int_number  := 0;
208
         when '1' =>
209
           int_number  := 1;
210
         when '2' =>
211
           int_number  := 2;
212
         when '3' =>
213
           int_number  := 3;
214
         when '4' =>
215
           int_number  := 4;
216
         when '5' =>
217
           int_number  := 5;
218
         when '6' =>
219
           int_number  := 6;
220
         when '7' =>
221
           int_number  := 7;
222
         when '8' =>
223
           int_number  := 8;
224
         when '9' =>
225
           int_number  := 9;
226
         when 'a' | 'A'=>
227
           int_number  := 10;
228
         when 'b' | 'B'=>
229
           int_number  := 11;
230
         when 'c' | 'C'=>
231
           int_number  := 12;
232
         when 'd' | 'D'=>
233
           int_number  := 13;
234
         when 'e' | 'E'=>
235
           int_number  := 14;
236
         when 'f' | 'F'=>
237
           int_number  := 15;
238
         when others =>
239
         assert(false)
240
           report LF & "Error: hex2integer found non Hex didgit on line "
241
                     & (integer'image(line)) & " of file " & file_name
242
         severity failure;
243
       end case;
244
 
245
       temp_int  := temp_int + (int_number *(16 ** power));
246
       power     := power + 1;
247
     end loop;
248
 
249
     return temp_int;
250
  end hex2integer;
251
-------------------------------------------------------------------------------
252
-- convert character to 4 bit vector
253
--   input    character
254
--   output   std_logic_vector  4 bits
255
function c2std_vec(c: in character) return std_logic_vector is
256
begin
257
  case c is
258
    when '0' =>  return "0000";
259
    when '1' =>  return "0001";
260
    when '2' =>  return "0010";
261
    when '3' =>  return "0011";
262
    when '4' =>  return "0100";
263
    when '5' =>  return "0101";
264
    when '6' =>  return "0110";
265
    when '7' =>  return "0111";
266
    when '8' =>  return "1000";
267
    when '9' =>  return "1001";
268
    when 'a' | 'A' =>  return "1010";
269
    when 'b' | 'B' =>  return "1011";
270
    when 'c' | 'C' =>  return "1100";
271
    when 'd' | 'D' =>  return "1101";
272
    when 'e' | 'E' =>  return "1110";
273
    when 'f' | 'F' =>  return "1111";
274
    when others =>
275
     assert(false)
276
       report LF & "Error: c2std_vec found non Hex didgit on file line "
277
     severity failure;
278
     return "XXXX";
279
  end case;
280
end c2std_vec;
281
-------------------------------------------------------------------------------
282
--  std_vec2c  convert 4 bit std_vector to a character
283
--     input  std_logic_vector 4 bits
284
--     output  character
285
function std_vec2c(vec: in std_logic_vector(3 downto 0)) return character is
286
begin
287
  case vec is
288
    when "0000" => return '0';
289
    when "0001" => return '1';
290
    when "0010" => return '2';
291
    when "0011" => return '3';
292
    when "0100" => return '4';
293
    when "0101" => return '5';
294
    when "0110" => return '6';
295
    when "0111" => return '7';
296
    when "1000" => return '8';
297
    when "1001" => return '9';
298
    when "1010" => return 'A';
299
    when "1011" => return 'B';
300
    when "1100" => return 'C';
301
    when "1101" => return 'D';
302
    when "1110" => return 'E';
303
    when "1111" => return 'F';
304
    when others =>
305
     assert(false)
306
       report LF & "Error: std_vec2c found non-binary didgit in vec "
307
     severity failure;
308
     return 'X';
309
  end case;
310
end std_vec2c;
311
-------------------------------------------------------------------------------
312
-- bin2integer    convert bin Stimulus field to integer
313
--          inputs :  string of type text_field containing only binary numbers
314
--          return :  integer value
315
function bin2integer(bin_number:  in text_field;
316
                     file_name:   in text_line;
317
                     line:        in integer) return integer is
318
    variable len:         integer;
319
    variable temp_field:  text_field;
320
    variable temp_int:    integer;
321
    variable power:       integer;
322
    variable int_number:  integer;
323
  begin
324
     len      := fld_len(bin_number);
325
     power    := 0;
326
     temp_int := 0;
327
     for i in len downto 1 loop
328
       case bin_number(i) is
329
         when '0' =>
330
           int_number  := 0;
331
         when '1' =>
332
           int_number  := 1;
333
         when others =>
334
         assert(false)
335
           report LF & "Error: bin2integer found non Binary didgit on line "
336
                     & (integer'image(line)) & " of file " & file_name
337
         severity failure;
338
       end case;
339
 
340
       temp_int  := temp_int + (int_number *(2 ** power));
341
       power     := power + 1;
342
     end loop;
343
 
344
     return temp_int;
345
  end bin2integer;
346
-------------------------------------------------------------------------------
347
-- stim_to_integer    convert Stimulus field to integer
348
--          inputs :  string of type text_field "stimulus format of number"
349
--          return :  integer value
350
function stim_to_integer(field:      in text_field;
351
                         file_name:  in text_line;
352
                         line:       in integer) return integer is
353
    variable len:       integer;
354
    variable text:      text_field;
355
    variable value:     integer := 1;
356
    variable temp_str : string(1 to 48);
357
  begin
358
    len := fld_len(field);
359
 
360
    case field(1) is
361
      when 'x' | 'h' =>
362
        value := 2;
363
        while(field(value) /= nul) loop
364
          temp_str(value - 1) := field(value);
365
          value := value + 1;
366
        end loop;
367
        value  := hex2integer(temp_str,file_name,line);
368
      when 'b' =>
369
        value := 2;
370
        while(field(value) /= nul) loop
371
          temp_str(value - 1) := field(value);
372
          value := value + 1;
373
        end loop;
374
        value  := bin2integer(temp_str,file_name,line);
375
      when others =>
376
--        value  := from_string(field(1 to len));
377
        value  := str2integer(field);
378
    end case;
379
    return value;
380
  end stim_to_integer;
381
 
382
-------------------------------------------------------------------------------
383
--  to_str function  with base parameter
384
--     Convert integer to number base
385
  function ew_to_str(int: integer; b: base) return text_field is
386
 
387
    variable temp  : text_field ;
388
    variable temp1 : text_field ;
389
    variable radix : integer := 0;
390
    variable num   : integer := 0;
391
    variable power : integer := 1;
392
    variable len   : integer := 1;
393
    variable pre   : string(1 to 2);
394
    variable i     : integer;
395
    variable j     : integer;
396
    variable vec   : std_logic_vector(31 downto 0);
397
 
398
  begin
399
 
400
    num := int;
401
    temp := (others => nul);
402
    case b is
403
      when bin =>
404
        radix := 2;                -- depending on what
405
        pre := "0b";
406
      when oct =>
407
        radix := 8;                -- base the number is
408
        pre := "0o";
409
      when hex =>
410
        radix := 16;               -- to be displayed as
411
        pre := "0x";
412
      when dec =>
413
        radix := 10;               -- choose a radix range
414
        pre := (others => nul);
415
    end case ;
416
    -- Now jump through Hoops because of sign
417
    if(num < 0 and b = hex) then
418
      vec := std_logic_vector(conv_unsigned(int, 32));
419
      temp(1) := std_vec2c(vec(31 downto 28));
420
      temp(2) := std_vec2c(vec(27 downto 24));
421
      temp(3) := std_vec2c(vec(23 downto 20));
422
      temp(4) := std_vec2c(vec(19 downto 16));
423
      temp(5) := std_vec2c(vec(15 downto 12));
424
      temp(6) := std_vec2c(vec(11 downto 8));
425
      temp(7) := std_vec2c(vec(7 downto 4));
426
      temp(8) := std_vec2c(vec(3 downto 0));
427
    else
428
      while num >= radix loop                   -- determine how many
429
        len := len + 1;                        -- characters required
430
        num := num / radix;                    -- to represent the
431
      end loop ;                                -- number.
432
      for i in len downto 1 loop                -- convert the number to
433
        temp(i) := ew_to_char(int/power mod radix); -- a string starting
434
        power := power * radix;                 -- with the right hand
435
      end loop ;                                -- side.
436
    end if;
437
    -- add prefix if is one
438
    if(pre(1) /= nul) then
439
      temp1 := temp;
440
      i := 1;
441
      j := 3;
442
      temp(1 to 2) := pre;
443
      while(temp1(i) /= nul) loop
444
        temp(j) := temp1(i);
445
        i := i + 1;
446
        j := j + 1;
447
      end loop;
448
    end if;
449
 
450
    return temp;
451
 
452
  end ew_to_str ;
453
 
454
-------------------------------------------------------------------------------
455
-- Procedure to print instruction records to stdout  *for debug*
456
  procedure print_inst(variable inst  :  in stim_line_ptr) is
457
    variable l:    text_line;
458
    variable l_i:  integer := 1;
459
    variable j:    integer := 1;
460
  begin
461
    while (inst.instruction(j) /= nul) loop
462
      l(l_i) := inst.instruction(j);
463
      j   := j +1;
464
      l_i := l_i + 1;
465
    end loop;
466
 
467
    l(l_i) := ' ';
468
    l_i := l_i + 1;
469
    j   := 1;
470
    -- field one
471
    if(inst.inst_field_1(1) /= nul) then
472
      while (inst.inst_field_1(j) /= nul) loop
473
        l(l_i) := inst.inst_field_1(j);
474
        j   := j +1;
475
        l_i := l_i + 1;
476
      end loop;
477
      l(l_i) := ' ';
478
      l_i := l_i + 1;
479
      j   := 1;
480
      -- field two
481
      if(inst.inst_field_2(1) /= nul) then
482
        while (inst.inst_field_2(j) /= nul) loop
483
          l(l_i) := inst.inst_field_2(j);
484
          j   := j +1;
485
          l_i := l_i + 1;
486
        end loop;
487
        l(l_i) := ' ';
488
        l_i := l_i + 1;
489
        j   := 1;
490
        -- field three
491
        if(inst.inst_field_3(1) /= nul) then
492
          while (inst.inst_field_3(j) /= nul) loop
493
            l(l_i) := inst.inst_field_3(j);
494
            j   := j +1;
495
            l_i := l_i + 1;
496
          end loop;
497
          l(l_i) := ' ';
498
          l_i := l_i + 1;
499
          j   := 1;
500
          -- field four
501
          if(inst.inst_field_4(1) /= nul) then
502
            while (inst.inst_field_4(j) /= nul) loop
503
              l(l_i) := inst.inst_field_4(j);
504
              j   := j +1;
505
              l_i := l_i + 1;
506
            end loop;
507
          end if;
508
        end if;
509
      end if;
510
    end if;
511
    print(l);
512
 
513
    print("   Sequence Number: " & to_str(inst.line_number) &
514
          "  File Line Number: " & to_str(inst.file_line));
515
    if(inst.num_of_lines > 0) then
516
      print("   Number of Lines: " & to_str(inst.num_of_lines));
517
    end if;
518
  end print_inst;
519
 
520
--------------------------------------------------------------------------------
521
--  access_variable
522
--     inputs:
523
--               Text field containing variable
524
--     outputs:
525
--               value  $VAR  returns Value of VAR
526
--               value  VAR   returns index of VAR
527
--
528
--               valid  is 1 if valid 0 if not
529
  procedure access_variable(variable var_list : in  var_field_ptr;
530
                            variable var      : in text_field;
531
                            variable value    : out integer;
532
                            variable valid    : out integer) is
533
    variable l          : integer;
534
    variable l_2        : integer;
535
    variable var_ptr    : var_field_ptr;
536
    variable temp_field : text_field;
537
    variable ptr        : integer := 0;  -- 0 is index, 1 is pointer
538
  begin
539
    l      := fld_len(var);
540
    valid  := 0;
541
    -- if the variable is a special
542
    if(var(1) = '=') then
543
          value  := 0;
544
          valid  := 1;
545
    elsif(var(1 to 2) = ">=") then
546
          value  := 4;
547
          valid  := 1;
548
    elsif(var(1 to 2) = "<=") then
549
          value  := 5;
550
          valid  := 1;
551
    elsif(var(1) = '>') then
552
          value  := 1;
553
          valid  := 1;
554
    elsif(var(1) = '<') then
555
          value  := 2;
556
          valid  := 1;
557
    elsif(var(1 to 2) = "!=") then
558
          value  := 3;
559
          valid  := 1;
560
 
561
    else
562
      if(var(1) = '$') then
563
        ptr := 1; -- this is a pointer
564
        for i in 2 to l loop
565
          temp_field(i-1) := var(i);
566
        end loop;
567
      else
568
        temp_field  :=  var;
569
      end if;
570
 
571
      var_ptr := var_list;
572
      while(var_ptr.next_rec  /= null) loop
573
        -- if we have a match
574
        if(temp_field = var_ptr.var_name) then
575
          if(ptr = 1) then
576
            value  := var_ptr.var_value;
577
            valid  := 1;
578
          else
579
            value  := var_ptr.var_index;
580
            valid  := 1;
581
          end if;
582
          exit;
583
        end if;
584
        var_ptr := var_ptr.next_rec;
585
      end loop;
586
 
587
      -- if we have a match and was the last record
588
      if(var_ptr.next_rec  = null and temp_field = var_ptr.var_name) then
589
        if(ptr = 1) then
590
          value  := var_ptr.var_value;
591
          valid  := 1;
592
        else
593
          value  := var_ptr.var_index;
594
          valid  := 1;
595
        end if;
596
      end if;
597
    end if;
598
  end access_variable;
599
--------------------------------------------------------------------------------
600
--  index_variable
601
--     inputs:
602
--               index:  the index of the variable being accessed
603
--     outputs:
604
--               Variable Value
605
--               valid  is 1 if valid 0 if not
606
  procedure index_variable(variable var_list : in  var_field_ptr;
607
                           variable index    : in  integer;
608
                           variable value    : out integer;
609
                           variable valid    : out integer) is
610
    variable ptr:  var_field_ptr;
611
  begin
612
    ptr    :=  var_list;
613
    valid  :=  0;
614
    while(ptr.next_rec  /= null) loop
615
      if(ptr.var_index = index) then
616
        value :=  ptr.var_value;
617
        valid :=  1;
618
        exit;
619
      end if;
620
      ptr  :=  ptr.next_rec;
621
    end loop;
622
    if(ptr.var_index = index) then
623
      value :=  ptr.var_value;
624
      valid :=  1;
625
    end if;
626
  end index_variable;
627
 
628
--------------------------------------------------------------------------------
629
--  update_variable
630
--     inputs:
631
--               index:  the index of the variable being updated
632
--     outputs:
633
--               valid  is 1 if valid 0 if not
634
  procedure update_variable(variable var_list : in  var_field_ptr;
635 10 sckoarn
                            variable index    : in  integer;
636
                            variable value    : in  integer;
637
                            variable valid    : out integer) is
638 2 sckoarn
    variable ptr:  var_field_ptr;
639
  begin
640
    ptr    :=  var_list;
641
    valid  :=  0;
642
    while(ptr.next_rec  /= null) loop
643
      if(ptr.var_index = index) then
644
        ptr.var_value :=  value;
645
        valid :=  1;
646
        exit;
647
      end if;
648
      ptr  :=  ptr.next_rec;
649
    end loop;
650
    -- check the current one
651
    if(ptr.var_index = index) then
652
      ptr.var_value :=  value;
653
      valid :=  1;
654
    end if;
655
  end update_variable;
656
 
657
-------------------------------------------------------------------------------
658
-- Read a line from a file
659
--   inputs  :   file of type text
660
--   outputs :   The line of type text_line
661
  procedure file_read_line(file file_name: text;
662
                           variable file_line: out text_line
663
                          ) is
664
    variable index:  integer;             -- index into string
665
    variable rline:  line;
666
 
667
  begin
668
 
669
    index := 1;  -- set index to begin of string
670
    file_line := (others => nul);
671
    if(not endfile(file_name)) then
672
      readline(file_name,rline);
673
 
674
      while(rline'right /= (index - 1) and rline'length /= 0) loop
675
        file_line(index) := rline(index);
676
        index    := index + 1;
677
      end loop;
678
    end if;
679
  end file_read_line;
680
 
681
  ------------------------------------------------------------------------------
682
  -- procedure to break a line down in to text fields
683
  procedure tokenize_line(variable text_line:   in  text_line;
684
                          variable token1:      out text_field;
685
                          variable token2:      out text_field;
686
                          variable token3:      out text_field;
687
                          variable token4:      out text_field;
688
                          variable token5:      out text_field;
689
                          variable token6:      out text_field;
690
                          variable token7:      out text_field;
691
                          variable txt_ptr:     out stm_text_ptr;
692
                          variable valid:       out integer) is
693
    variable token_index:     integer  :=  0;
694
    variable current_token:   text_field;
695
    variable token_number:    integer  :=  0;
696
    variable c:               string(1 to 2);
697
    variable comment_found:   integer  :=  0;
698
    variable txt_found:       integer  :=  0;
699
    variable j:               integer;
700
 
701
  begin
702
    -- null outputs
703
    token1  :=  (others => nul);
704
    token2  :=  (others => nul);
705
    token3  :=  (others => nul);
706
    token4  :=  (others => nul);
707
    token5  :=  (others => nul);
708
    token6  :=  (others => nul);
709
    token7  :=  (others => nul);
710
    txt_ptr :=  null;
711
    valid   :=  0;
712
    txt_found  :=  0;
713
    j := 1;
714
 
715
    -- loop for max number of char
716
    for i in 1 to text_line'high loop
717
      -- collect for comment test ** assumed no line will be max 256
718
      c(1)  := text_line(i);
719
      c(2)  := text_line(i + 1);  -- or this line will blow up
720
      if(c = "--") then
721
        comment_found  :=  1;
722
        exit;
723
      end if;
724
      -- if is begin text char '"'
725
      if(c(1) = '"') then  --"  <-- this double quote is just to fix highlighting.
726
        txt_found := 1;
727
        txt_ptr := new stm_text;
728
        next;
729
      end if;
730
 
731
      -- if we have found a txt string
732
      if (txt_found = 1 and text_line(i) /= nul) then
733
        -- if string too long, prevent tool hang, truncate and notify
734
        if(j > c_stm_text_len) then
735
          print("tokenize_line: truncated txt line, it was larger than c_stm_text_len");
736
          exit;
737
        end if;
738
        txt_ptr(j) := text_line(i);
739
        j := j + 1;
740
      -- if is a character store in the right token
741
      elsif(is_space(text_line(i)) = false and text_line(i) /= nul) then
742
        token_index  := token_index + 1;
743
        current_token(token_index)    := text_line(i);
744
      -- else is a space, deal with pointers
745
      elsif(is_space(text_line(i + 1)) = false and text_line(i + 1) /= nul) then
746
        case token_number is
747
          when 0 =>
748
            if(token_index /= 0) then
749
              token1  :=  current_token;
750
              current_token  :=  (others => nul);
751
              token_number := 1;
752
              valid        := 1;
753
              token_index  := 0;
754
            end if;
755
          when 1 =>
756
            token2  :=  current_token;
757
            current_token  :=  (others => nul);
758
            token_number := 2;
759
            valid        := 2;
760
            token_index  := 0;
761
          when 2 =>
762
            token3  :=  current_token;
763
            current_token  :=  (others => nul);
764
            token_number := 3;
765
            valid        := 3;
766
            token_index  := 0;
767
          when 3 =>
768
            token4  :=  current_token;
769
            current_token  :=  (others => nul);
770
            token_number := 4;
771
            valid        := 4;
772
            token_index  := 0;
773
          when 4 =>
774
            token5  :=  current_token;
775
            current_token  :=  (others => nul);
776
            token_number := 5;
777
            valid        := 5;
778
            token_index  := 0;
779
          when 5 =>
780
            token6  :=  current_token;
781
            current_token  :=  (others => nul);
782
            token_number := 6;
783
            valid        := 6;
784
            token_index  := 0;
785
          when 6 =>
786
            token7  :=  current_token;
787
            current_token  :=  (others => nul);
788
            token_number := 7;
789
            valid        := 7;
790
            token_index  := 0;
791
          when 7 =>
792
          when others =>
793
            null;
794
        end case;
795
      end if;
796
      -- break from loop if is null
797
      if(text_line(i) = nul) then
798
        if(token_index /= 0) then
799
          case token_number is
800
            when 0 =>
801
              token1  :=  current_token;
802
              valid   := 1;
803
            when 1 =>
804
              token2  :=  current_token;
805
              valid   := 2;
806
            when 2 =>
807
              token3  :=  current_token;
808
              valid   := 3;
809
            when 3 =>
810
              token4  :=  current_token;
811
              valid   := 4;
812
            when 4 =>
813
              token5  :=  current_token;
814
              valid   := 5;
815
            when 5 =>
816
              token6  :=  current_token;
817
              valid   := 6;
818
            when 6 =>
819
              token7  :=  current_token;
820
              valid   := 7;
821
            when others =>
822
              null;
823
          end case;
824
        end if;
825
        exit;
826
      end if;
827
    end loop;
828
    -- did we find a comment and there is a token
829
    if(comment_found = 1) then
830
      if(token_index /= 0) then
831
        case token_number is
832
          when 0 =>
833
            token1  :=  current_token;
834
            valid   := 1;
835
          when 1 =>
836
            token2  :=  current_token;
837
            valid   := 2;
838
          when 2 =>
839
            token3  :=  current_token;
840
            valid   := 3;
841
          when 3 =>
842
            token4  :=  current_token;
843
            valid   := 4;
844
          when 4 =>
845
            token5  :=  current_token;
846
            valid   := 5;
847
          when 5 =>
848
            token6  :=  current_token;
849
            valid   := 6;
850
          when 6 =>
851
            token7  :=  current_token;
852
            valid   := 7;
853
          when others =>
854
            null;
855
        end case;
856
      end if;
857
    end if;
858
  end tokenize_line;
859
-------------------------------------------------------------------------------
860
-- Add a new instruction to the instruction list
861 10 sckoarn
--   inputs  :   the linked list of instructions
862
--               the instruction
863
--               the number of args
864
--   outputs :   Updated instruction set linked list
865 2 sckoarn
  procedure define_instruction(variable inst_set: inout inst_def_ptr;
866
                               constant inst:     in    string;
867
                               constant args:     in    integer) is
868
    variable v_inst_ptr:    inst_def_ptr;
869
    variable v_prev_ptr:    inst_def_ptr;
870
    variable v_new_ptr:     inst_def_ptr;
871
    variable v_temp_inst:   inst_def_ptr;
872
    variable v_length:      integer;
873
    variable v_list_size:   integer;
874
    variable v_dup_error:   boolean;
875
 
876
  begin
877
    assert(inst'high <= max_field_len)
878
      report LF & "Error: Creation of Instruction of length greater than Max_field_len attemped!!" &
879
             LF & "This Max is currently set to " & (integer'image(max_field_len))
880
    severity failure;
881
    -- get to the last element and test is not exsiting
882
    v_temp_inst :=  inst_set;
883
    v_inst_ptr  :=  inst_set;
884
    -- zero the size
885
    v_list_size :=  0;
886
    while(v_inst_ptr /= null) loop
887
      -- if there is a chance of a duplicate command
888
      if(v_inst_ptr.instruction_l = inst'high) then
889
        v_dup_error := true;
890
        for i in 1 to inst'high loop
891
          if(v_inst_ptr.instruction(i) /= inst(i)) then
892
            v_dup_error := false;
893
          end if;
894
        end loop;
895
        -- if we find a duplicate, die
896
        assert(v_dup_error = false)
897
          report LF & "Error: Duplicate instruction definition attempted!"
898
        severity failure;
899
      end if;
900
      v_prev_ptr  := v_inst_ptr;  -- store for pointer updates
901
      v_inst_ptr  := v_inst_ptr.next_rec;
902
      v_list_size :=  v_list_size + 1;
903
    end loop;
904
 
905
    -- add the new instruction
906
    v_new_ptr   := new inst_def;
907
    -- if this is the first command return new pointer
908
    if(v_list_size = 0) then
909
      v_temp_inst :=  v_new_ptr;
910
    -- else write new pointer to next_rec
911
    else
912
      v_prev_ptr.next_rec  :=  v_new_ptr;
913
    end if;
914
    v_new_ptr.instruction_l := inst'high;
915
    v_new_ptr.params        := args;
916
    -- copy the instruction text into field
917
    for i in 1 to v_new_ptr.instruction_l loop
918
      v_new_ptr.instruction(i) := inst(i);
919
    end loop;
920
    -- return the pointer
921
    inst_set  :=  v_temp_inst;
922
 
923
  end define_instruction;
924
 
925
--------------------------------------------------------------------------------
926
--  Check for valid instruction in the list of instructions
927
procedure check_valid_inst(variable inst     :  in text_field;
928
                           variable inst_set :  in inst_def_ptr;
929
                           variable token_num:  in integer;
930
                           variable line_num :  in integer;
931
                           variable name     :  in text_line) is
932
    variable l :     integer  := 0;
933
    variable seti:   inst_def_ptr;
934
    variable match:  integer  := 0;
935
    variable ilv:    integer  := 0;  -- inline variable
936
  begin
937
    -- create useable pointer
938
    seti  := inst_set;
939
    -- count up the characters in inst
940
    l := fld_len(inst);
941
      -- if this is a referance variable -- handle in add variable Proc
942
    if(inst(l) = ':') then
943
      match  := 1;
944
      ilv    := 1;
945
    else
946
      -- process list till null next
947
      while (seti.next_rec /= null) loop
948
        if(seti.instruction_l = l) then
949
          match  := 1;
950
          for j in 1 to l loop
951
            if(seti.instruction(j) /= inst(j)) then
952
              match  := 0;
953
            end if;
954
          end loop;
955
        end if;
956
        if(match = 0) then
957
          seti  := seti.next_rec;
958
        else
959
          exit;
960
        end if;
961
      end loop;
962
      -- check current one
963
      if(seti.instruction_l = l and match = 0) then
964
        match  := 1;
965
        for j in 1 to l loop
966
          if(seti.instruction(j) /= inst(j)) then
967
            match  := 0;
968
          end if;
969
        end loop;
970
      end if;
971
    end if;
972
 
973
    -- if we had a match, check the number of paramiters
974
    if(match = 1 and ilv = 0) then
975
      assert(seti.params = (token_num - 1))
976
        report LF & "Error: Undefined Instruction was found, incorrect number of fields passed!" & LF &
977
                    "This is found on line " & (integer'image(line_num)) & " in file " & name & LF
978
      severity failure;
979
    end if;
980
 
981
    -- if we find a duplicate, die
982
    assert(match = 1)
983
      report LF & "Error: Undefined Instruction on line " & (integer'image(line_num)) &
984
                  " found in input file " & name & LF
985
    severity failure;
986
  end check_valid_inst;
987
 
988
--------------------------------------------------------------------------------
989
--  add_variable
990
--    This procedure adds a variable to the variable list.  This is localy
991
--    available at this time.
992
procedure add_variable(variable var_list  :   inout  var_field_ptr;
993
                       variable p1        :  in text_field;  -- should be var name
994
                       variable p2        :  in text_field;  -- should be value
995
                       variable token_num :  in integer;
996
                       variable sequ_num  :  in integer;
997
                       variable line_num  :  in integer;
998
                       variable name      :  in text_line;
999
                       variable length    :  in integer) is
1000
 
1001
    variable temp_var:       var_field_ptr;
1002
    variable current_ptr:    var_field_ptr;
1003
    variable index:          integer := 1;
1004
 
1005
  begin
1006
    -- if this is NOT the first one
1007
    if(var_list /= null) then
1008
      current_ptr  := var_list;
1009
      index        := index + 1;
1010
      if(p1(length) /= ':') then  -- is not an inline variable
1011
        while(current_ptr.next_rec /= null) loop
1012
          -- if we have defined the current before then die
1013
          assert(current_ptr.var_name /= p1)
1014
            report LF & "Error: Attemping to add a duplicate Variable definition "
1015
                      & " on line " & (integer'image(line_num)) & " of file " & name
1016
          severity failure;
1017
 
1018
          current_ptr  :=  current_ptr.next_rec;
1019
          index  := index + 1;
1020
        end loop;
1021
        -- if we have defined the current before then die. This checks the last one
1022
        assert(current_ptr.var_name /= p1)
1023
          report LF & "Error: Attemping to add a duplicate Variable definition "
1024
                    & " on line " & (integer'image(line_num)) & " of file " & name
1025
        severity failure;
1026
 
1027
        temp_var              := new var_field;
1028
        temp_var.var_name     := p1;  -- direct write of text_field
1029
        temp_var.var_value    := stim_to_integer(p2,name,line_num); -- convert text_field to integer
1030
        temp_var.var_index    := index;
1031
        current_ptr.next_rec  :=  temp_var;
1032
      else
1033
        while(current_ptr.next_rec /= null) loop
1034
          -- if we have defined the current before then die
1035
          assert(current_ptr.var_name(1 to (length - 1)) /= p1(1 to (length - 1)))
1036
            report LF & "Error: Attemping to add a duplicate Inline Variable definition "
1037
                      & " on line " & (integer'image(line_num)) & " of file " & name
1038
          severity failure;
1039
 
1040
          current_ptr  :=  current_ptr.next_rec;
1041
          index  := index + 1;
1042
        end loop;
1043
        -- if we have defined the current before then die. This checks the last one
1044
        assert(current_ptr.var_name(1 to (length - 1)) /= p1(1 to (length - 1)))
1045
          report LF & "Error: Attemping to add a duplicate Inline Variable definition "
1046
                    & " on line " & (integer'image(line_num)) & " of file " & name
1047
        severity failure;
1048
 
1049
        temp_var              := new var_field;
1050
        temp_var.var_name(1 to (length - 1))     := p1(1 to (length - 1));
1051
        temp_var.var_value    := sequ_num;
1052
        temp_var.var_index    := index;
1053
        current_ptr.next_rec  :=  temp_var;
1054
      end if;
1055
    -- this is the first one
1056
    else
1057
      if(p1(length) /= ':') then  -- is not an inline variable
1058
        temp_var            := new var_field;
1059
        temp_var.var_name   := p1;  -- direct write of text_field
1060
        temp_var.var_index  := index;
1061
        temp_var.var_value  := stim_to_integer(p2,name,line_num); -- convert text_field to integer
1062
        var_list  :=  temp_var;
1063
      else
1064
        temp_var              := new var_field;
1065
        temp_var.var_name(1 to (length - 1))     := p1(1 to (length - 1));
1066
        temp_var.var_value    := sequ_num;
1067
        temp_var.var_index    := index;
1068
        var_list              :=  temp_var;
1069
      end if;
1070
    end if;
1071
  end add_variable;
1072
--------------------------------------------------------------------------------
1073
--  add_instruction
1074
--    This is the procedure that adds the instruction to the linked list of
1075
--    instructions.  Also Variable addition are called and or handled.
1076
--    the instruction sequence Link list.
1077
--     inputs:
1078
--               stim_line_ptr   is the pointer to the instruction List
1079
--               inst            is the instruction token
1080
--               p1              paramitor one, corrisponds to field one of stimulus
1081
--               p2              paramitor one, corrisponds to field two of stimulus
1082
--               p3              paramitor one, corrisponds to field three of stimulus
1083
--               p4              paramitor one, corrisponds to field four of stimulus
1084
--               p5              paramitor one, corrisponds to field three of stimulus
1085
--               p6              paramitor one, corrisponds to field four of stimulus
1086
--               str_ptr         pointer to string for print instruction
1087
--               token_num       the number of tokens, including instruction
1088
--               sequ_num        is the stimulus file line referance  ie program line number
1089
--               line_num        Line number in the text file
1090
--     outputs:
1091
--               none.  Error will terminate sim
1092
  procedure add_instruction(variable inst_list  :  inout stim_line_ptr;
1093
                            variable var_list   :  inout var_field_ptr;
1094
                            variable inst       :  in text_field;
1095
                            variable p1         :  in text_field;
1096
                            variable p2         :  in text_field;
1097
                            variable p3         :  in text_field;
1098
                            variable p4         :  in text_field;
1099
                            variable p5         :  in text_field;
1100
                            variable p6         :  in text_field;
1101
                            variable str_ptr    :  in stm_text_ptr;
1102
                            variable token_num  :  in integer;
1103
                            variable sequ_num   :  inout integer;
1104
                            variable line_num   :  in integer;
1105 10 sckoarn
                            variable file_name  :  in text_line;
1106
                            variable file_idx   :  in integer) is
1107 2 sckoarn
   variable temp_stim_line:  stim_line_ptr;
1108
   variable temp_current:    stim_line_ptr;
1109
   variable valid:           integer;
1110
   variable l:               integer;
1111
 begin
1112
   valid  := 1;
1113
   l := fld_len(inst);
1114
   temp_current  :=  inst_list;
1115
   -- take care of special cases
1116
   if(inst(1 to l) = "DEFINE_VAR") then
1117
     l := fld_len(p1);
1118
     --  Add the variable to the Variable pool, not considered an instruction
1119
     add_variable(var_list,p1,p2,token_num,sequ_num,line_num,file_name,l);
1120 10 sckoarn
     valid := 0;  --Removes this from the instruction list 
1121 2 sckoarn
   elsif(inst(l) = ':') then
1122
     add_variable(var_list,inst,p1,token_num,sequ_num,line_num,file_name,l);
1123
     valid := 0;
1124
   end if;
1125
 
1126
   if(valid = 1) then
1127
     -- prepare the new record
1128
     temp_stim_line  := new stim_line;
1129
     temp_stim_line.instruction   := inst;
1130
     temp_stim_line.inst_field_1  := p1;
1131
     temp_stim_line.inst_field_2  := p2;
1132
     temp_stim_line.inst_field_3  := p3;
1133
     temp_stim_line.inst_field_4  := p4;
1134
     temp_stim_line.inst_field_5  := p5;
1135
     temp_stim_line.inst_field_6  := p6;
1136
     temp_stim_line.txt           := str_ptr;
1137
     temp_stim_line.line_number   := sequ_num;
1138 10 sckoarn
     temp_stim_line.file_idx     := file_idx;
1139 2 sckoarn
     temp_stim_line.file_line     := line_num;
1140
 
1141
     -- if is not the first instruction
1142
     if(inst_list /= null) then
1143
       while(temp_current.next_rec /= null) loop
1144
         temp_current  := temp_current.next_rec;
1145
       end loop;
1146
       temp_current.next_rec  :=  temp_stim_line;
1147
       inst_list.num_of_lines :=  inst_list.num_of_lines + 1;
1148
     -- other wise is first instruction to be added
1149
     else
1150
       inst_list  :=  temp_stim_line;
1151
       inst_list.num_of_lines := 1;
1152
     end if;
1153
     sequ_num  :=  sequ_num + 1;
1154
--     print_inst(temp_stim_line);  -- for debug
1155
   end if;
1156
 
1157
 end add_instruction;
1158 10 sckoarn
------------------------------------------------------------------------------
1159
-- test_inst_sequ
1160
--  This procedure accesses the full instruction sequence and checks for valid
1161
--   variables.  This is prior to the simulation run start.
1162
  procedure test_inst_sequ(variable inst_sequ  :  in  stim_line_ptr;
1163
                           variable file_list  :  in  file_def_ptr;
1164
                           variable var_list   :  in  var_field_ptr
1165
                          ) is
1166
    variable temp_text_field:     text_field;
1167
    variable temp_var:            text_field;
1168
    variable inst_ptr:            stim_line_ptr;
1169
    variable valid:               integer;
1170
    variable line:                integer;  -- value of the file_line
1171
    variable file_name:           text_line;
1172
    variable v_p:                 integer;
1173
    variable inst       :         text_field;
1174
    variable txt        :         stm_text_ptr;
1175
    variable inst_len   :         integer;
1176
    variable fname      :         text_line;
1177
    variable file_line  :         integer;
1178
    variable temp_fn_prt:         file_def_ptr;
1179
    variable tmp_int    :         integer;
1180
 
1181
  begin
1182
    inst_ptr  :=  inst_sequ;
1183
    -- go through all the instructions
1184
    while(inst_ptr.next_rec /= null) loop
1185
      inst := inst_ptr.instruction;
1186
      inst_len := fld_len(inst_ptr.instruction);
1187
      file_line := inst_ptr.file_line;
1188
      line      := inst_ptr.file_line;
1189
      -- recover the file name this line came from
1190
      temp_fn_prt := file_list;
1191
      tmp_int   :=  inst_ptr.file_idx;
1192
      while (temp_fn_prt.next_rec /= null) loop
1193
        if(temp_fn_prt.rec_idx = tmp_int) then
1194
          exit;
1195
        end if;
1196
        temp_fn_prt  :=  temp_fn_prt.next_rec;
1197
      end loop;
1198
      for i in 1 to fname'high loop
1199
        file_name(i) :=  temp_fn_prt.file_name(i);
1200
      end loop;
1201
 
1202
      txt       := inst_ptr.txt;
1203
      -- load parameter one
1204
      temp_text_field  :=  inst_ptr.inst_field_1;
1205
      if(temp_text_field(1) /= nul) then
1206
        -- if this is a numaric  do nothing
1207
        if(temp_text_field(1) = 'x' or temp_text_field(1) = 'h' or
1208
           temp_text_field(1) = 'b' or is_digit(temp_text_field(1)) = true) then
1209
           null;
1210
        else  -- else is a variable, get the value or halt incase of error
1211
          access_variable(var_list,temp_text_field,v_p,valid);
1212
          assert(valid = 1)
1213
            report LF & "Error: First variable on stimulus line " & (integer'image(line))
1214
                      & " is not valid!!" & LF & "In file " & file_name
1215
          severity failure;
1216
        end if;
1217
      end if;
1218
      -- load parameter two
1219
      temp_text_field  :=  inst_ptr.inst_field_2;
1220
      if(temp_text_field(1) /= nul) then
1221
        -- if this is a numaric do nothing
1222
        if(temp_text_field(1) = 'x' or temp_text_field(1) = 'h' or
1223
           temp_text_field(1) = 'b' or is_digit(temp_text_field(1)) = true) then
1224
           null;
1225
        else  -- else is a variable, get the value or halt incase of error
1226
          access_variable(var_list,temp_text_field,v_p,valid);
1227
          assert(valid = 1)
1228
            report LF & "Error: Second variable on stimulus line " & (integer'image(line))
1229
                      & " is not valid!!" & LF & "In file " & file_name
1230
          severity failure;
1231
        end if;
1232
      end if;
1233
      -- load parameter three
1234
      temp_text_field  :=  inst_ptr.inst_field_3;
1235
      if(temp_text_field(1) /= nul) then
1236
        -- if this is a numaric do nothing
1237
        if(temp_text_field(1) = 'x' or temp_text_field(1) = 'h' or
1238
           temp_text_field(1) = 'b' or is_digit(temp_text_field(1)) = true) then
1239
           null;
1240
        else  -- else is a variable, get the value or halt incase of error
1241
          access_variable(var_list,temp_text_field,v_p,valid);
1242
          assert(valid = 1)
1243
            report LF & "Error: Third variable on stimulus line " & (integer'image(line))
1244
                      & " is not valid!!" & LF & "In file " & file_name
1245
          severity failure;
1246
        end if;
1247
      end if;
1248
      -- load parameter four
1249
      temp_text_field  :=  inst_ptr.inst_field_4;
1250
      if(temp_text_field(1) /= nul) then
1251
        -- if this is a numaric do nothing
1252
        if(temp_text_field(1) = 'x' or temp_text_field(1) = 'h' or
1253
           temp_text_field(1) = 'b'or is_digit(temp_text_field(1)) = true) then
1254
           null;
1255
        else  -- else is a variable, get the value or halt incase of error
1256
          access_variable(var_list,temp_text_field,v_p,valid);
1257
          assert(valid = 1)
1258
            report LF & "Error: Forth variable on stimulus line " & (integer'image(line))
1259
                      & " is not valid!!" & LF & "In file " & file_name
1260
          severity failure;
1261
        end if;
1262
      end if;
1263
      -- load parameter five
1264
      temp_text_field  :=  inst_ptr.inst_field_5;
1265
      if(temp_text_field(1) /= nul) then
1266
        -- if this is a numaric do nothing
1267
        if(temp_text_field(1) = 'x' or temp_text_field(1) = 'h' or
1268
          temp_text_field(1) = 'b' or is_digit(temp_text_field(1)) = true) then
1269
          null;
1270
        else  -- else is a variable, get the value or halt incase of error
1271
          access_variable(var_list,temp_text_field,v_p,valid);
1272
          assert(valid = 1)
1273
            report LF & "Error: Fifth variable on stimulus line " & (integer'image(line))
1274
                      & " is not valid!!" & LF & "In file " & file_name
1275
          severity failure;
1276
        end if;
1277
      end if;
1278
      -- load parameter six
1279
      temp_text_field  :=  inst_ptr.inst_field_6;
1280
      if(temp_text_field(1) /= nul) then
1281
        -- if this is a numaric field convert to integer
1282
        if(temp_text_field(1) = 'x' or temp_text_field(1) = 'h' or
1283
           temp_text_field(1) = 'b' or is_digit(temp_text_field(1)) = true) then
1284
           null;
1285
        else  -- else is a variable, get the value or halt incase of error
1286
          access_variable(var_list,temp_text_field,v_p,valid);
1287
          assert(valid = 1)
1288
            report LF & "Error: Sixth variable on stimulus line " & (integer'image(line))
1289
                      & " is not valid!!" & LF & "In file " & file_name
1290
          severity failure;
1291
        end if;
1292
      end if;
1293
      -- point to next record
1294
      inst_ptr := inst_ptr.next_rec;
1295
    end loop;
1296
 
1297
  end test_inst_sequ;
1298 2 sckoarn
--------------------------------------------------------------------------------
1299
--  The read include file procedure
1300
--    This is the main procedure for reading, parcing, checking and returning
1301
--    the instruction sequence Link list.
1302
  procedure read_include_file(variable name:       text_line;
1303
                              variable sequ_numb:  inout integer;
1304 10 sckoarn
                              variable file_list:  inout file_def_ptr;
1305 2 sckoarn
                              variable inst_set:   inout inst_def_ptr;
1306
                              variable var_list:   inout var_field_ptr;
1307
                              variable inst_sequ:  inout stim_line_ptr;
1308
                              variable status:     inout integer) is
1309
    variable l:          text_line; -- the line
1310
    variable l_num:      integer;   -- line number file
1311
    variable sequ_line:  integer;   -- line number program
1312
    variable t1:         text_field;
1313
    variable t2:         text_field;
1314
    variable t3:         text_field;
1315
    variable t4:         text_field;
1316
    variable t5:         text_field;
1317
    variable t6:         text_field;
1318
    variable t7:         text_field;
1319
    variable t_txt:      stm_text_ptr;
1320
    variable valid:      integer;
1321
    variable v_inst_ptr: inst_def_ptr;
1322
    variable v_var_prt:  var_field_ptr;
1323
    variable v_sequ_ptr: stim_line_ptr;
1324
    variable v_len:      integer;
1325
    variable v_stat:     file_open_status;
1326 10 sckoarn
    variable idx:        integer;
1327
    variable v_tmp:      text_line;
1328
 
1329
    variable v_tmp_fn_ptr: file_def_ptr;
1330
    variable v_new_fn:     integer;
1331
    variable v_tmp_fn:   file_def_ptr;
1332
    variable v_txt:      stm_text; --stm_text_ptr;
1333 2 sckoarn
 
1334
  begin
1335 10 sckoarn
    sequ_line     :=  sequ_numb;
1336
    v_tmp_fn_ptr  :=  file_list;
1337
    -- for linux systems, trailing spaces need to be removed
1338
    --    from file names
1339
    --  copy text string to temp
1340
    for i in 1 to c_stm_text_len loop
1341
      if(name(i) = nul) then
1342
        v_tmp(i) := name(i);
1343
        exit;
1344
      else
1345
        v_tmp(i) := name(i);
1346
      end if;
1347
    end loop;
1348
    --fix up any trailing white space in txt
1349
    idx  :=  0;
1350
    --    get to the end of the string
1351
    for i in 1 to c_stm_text_len loop
1352
      if(v_tmp(i) /= nul) then
1353
        idx  :=  idx + 1;
1354
      else
1355
        exit;
1356
      end if;
1357
    end loop;
1358
    --  now nul out spaces
1359
    for i in idx downto 1 loop
1360
      if(is_space(v_tmp(i)) = true) then
1361
        v_tmp(i) := nul;
1362
      else
1363
        exit;
1364
      end if;
1365
    end loop;
1366
    --  open include file
1367
    file_open(v_stat, include_file, v_tmp, read_mode);
1368 2 sckoarn
    if(v_stat /= open_ok) then
1369
      print("Error: Unable to open include file  " & name);
1370
      status   :=  1;
1371
      return;
1372
    end if;
1373
    l_num      :=  1;  -- initialize line number
1374
 
1375 10 sckoarn
    --  the file is opened, put it on the file name LL
1376
    while (v_tmp_fn_ptr.next_rec /= null) loop
1377
      v_tmp_fn_ptr :=  v_tmp_fn_ptr.next_rec;
1378
    end loop;
1379
    v_new_fn   :=  v_tmp_fn_ptr.rec_idx + 1;
1380
    v_tmp_fn            :=  new file_def;
1381
    v_tmp_fn_ptr.next_rec  :=  v_tmp_fn;
1382
    v_tmp_fn.rec_idx    := v_new_fn;
1383
 
1384
    --  nul the text line
1385
    v_tmp_fn.file_name  := (others => nul);
1386
    for i in 1 to name'high loop
1387
      v_tmp_fn.file_name(i)  := name(i);
1388
    end loop;
1389
    v_tmp_fn.next_rec  :=  null;
1390
 
1391
 
1392 2 sckoarn
    v_inst_ptr :=  inst_set;
1393
    v_var_prt  :=  var_list;
1394
    v_sequ_ptr :=  inst_sequ;
1395
 
1396
    -- while not the end of file read it
1397
    while(not endfile(include_file)) loop
1398
      file_read_line(include_file,l);
1399
      --  tokenize the line
1400
      tokenize_line(l,t1,t2,t3,t4,t5,t6,t7,t_txt,valid);
1401
      v_len  := fld_len(t1);
1402
      if(t1(1 to v_len) = "INCLUDE") then
1403 10 sckoarn
        print("Nested INCLUDE statement found in " & v_tmp & " on line " &
1404
              (integer'image(l_num)));
1405
        assert(false)
1406
          report LF & "Error: Nested INCLUDE statements are not supported at this time."
1407
        severity failure;
1408 2 sckoarn
 
1409
      -- if there was valid tokens
1410
      elsif(valid /= 0) then
1411
        check_valid_inst(t1, v_inst_ptr, valid, l_num, name);
1412 10 sckoarn
        add_instruction(v_sequ_ptr,v_var_prt,t1,t2,t3,t4,t5,t6,t7,t_txt,valid,
1413
                        sequ_line,l_num,name,v_new_fn);
1414 2 sckoarn
      end if;
1415
      l_num  :=  l_num + 1;
1416
    end loop; -- end loop read file
1417
    file_close(include_file);
1418
    sequ_numb  :=  sequ_line;
1419
    inst_set   :=  v_inst_ptr;
1420
    var_list   :=  v_var_prt;
1421
    inst_sequ  :=  v_sequ_ptr;
1422
  end read_include_file;
1423
 
1424
--------------------------------------------------------------------------------
1425
--  The read instruction file procedure
1426
--    This is the main procedure for reading, parcing, checking and returning
1427
--    the instruction sequence Link list.
1428
  procedure read_instruction_file(constant file_name:  string;
1429
                                  variable inst_set:   inout inst_def_ptr;
1430
                                  variable var_list:   inout var_field_ptr;
1431 10 sckoarn
                                  variable inst_sequ:  inout stim_line_ptr;
1432
                                  variable file_list:  inout file_def_ptr) is
1433 2 sckoarn
    variable l:          text_line; -- the line
1434
    variable l_num:      integer;   -- line number file
1435
    variable sequ_line:  integer;   -- line number program
1436
    variable t1:         text_field;
1437
    variable t2:         text_field;
1438
    variable t3:         text_field;
1439
    variable t4:         text_field;
1440
    variable t5:         text_field;
1441
    variable t6:         text_field;
1442
    variable t7:         text_field;
1443
    variable t_txt:      stm_text_ptr;
1444
    variable valid:      integer;
1445
    variable v_ostat:    integer;
1446
    variable v_inst_ptr: inst_def_ptr;
1447
    variable v_var_prt:  var_field_ptr;
1448
    variable v_sequ_ptr: stim_line_ptr;
1449
    variable v_len:      integer;
1450
    variable v_stat:     file_open_status;
1451
    variable v_name:     text_line;
1452
    variable v_iname:    text_line;
1453 10 sckoarn
    variable v_tmp_fn:   file_def_ptr;
1454
    variable v_fn_idx:   integer;
1455
    variable v_idx:      integer;
1456
 
1457 2 sckoarn
  begin
1458
    -- open the stimulus_file and check
1459
    file_open(v_stat, stimulus, file_name, read_mode);
1460
    assert(v_stat = open_ok)
1461
      report LF & "Error: Unable to open stimulus_file  " & file_name
1462
    severity failure;
1463
    -- copy file name to type text_line
1464
    for i in 1 to file_name'high loop
1465
      v_name(i)  := file_name(i);
1466
    end loop;
1467 10 sckoarn
    -- the first item on the file names link list
1468
    file_list           :=  null;
1469
    v_tmp_fn            :=  new file_def;
1470
    v_tmp_fn.rec_idx    := 1;
1471
    v_fn_idx            := 1;
1472
    v_idx               := 1;
1473
    --  nul the text line
1474
    v_tmp_fn.file_name  := (others => nul);
1475
    for i in 1 to file_name'high loop
1476
      v_tmp_fn.file_name(i)  := file_name(i);
1477
    end loop;
1478
    v_tmp_fn.next_rec  :=  null;
1479
 
1480 2 sckoarn
    l_num      :=  1;
1481
    sequ_line  :=  1;
1482
    v_ostat    :=  0;
1483
 
1484
    v_inst_ptr :=  inst_set;
1485
    v_var_prt  :=  var_list;
1486
    v_sequ_ptr :=  inst_sequ;
1487
 
1488
    -- while not the end of file read it
1489
    while(not endfile(stimulus)) loop
1490
      file_read_line(stimulus,l);
1491
      --  tokenize the line
1492
      tokenize_line(l,t1,t2,t3,t4,t5,t6,t7,t_txt,valid);
1493
      v_len  := fld_len(t1);
1494
      -- if there is an INCLUDE instruction
1495
      if(t1(1 to v_len) = "INCLUDE") then
1496 10 sckoarn
        -- if file name is in par2
1497 2 sckoarn
        if(valid = 2) then
1498
          v_iname  := (others => nul);
1499
          for i in 1 to max_field_len loop
1500
            v_iname(i) := t2(i);
1501
          end loop;
1502 10 sckoarn
        -- elsif the text string is not null
1503
        elsif(t_txt /= null) then
1504 2 sckoarn
          v_iname  := (others => nul);
1505
          for i in 1 to c_stm_text_len loop
1506
            v_iname(i) := t_txt(i);
1507 10 sckoarn
            if(t_txt(i) = nul) then
1508
              exit;
1509
            end if;
1510
          end loop;
1511
        else
1512
          assert(false)
1513
            report LF & "Error:  INCLUDE instruction has not file name included.  Found on" & LF &
1514
                        "line " & (integer'image(l_num)) & " in file " & file_name & LF
1515
          severity failure;
1516 2 sckoarn
        end if;
1517
        print("INCLUDE found: Loading file " & v_iname);
1518 10 sckoarn
        read_include_file(v_iname,sequ_line,v_tmp_fn,v_inst_ptr,v_var_prt,v_sequ_ptr,v_ostat);
1519 2 sckoarn
        -- if include file not found
1520
        if(v_ostat = 1) then
1521
          exit;
1522
        end if;
1523
      -- if there was valid tokens
1524
      elsif(valid /= 0) then
1525
        check_valid_inst(t1, v_inst_ptr, valid, l_num, v_name);
1526 10 sckoarn
        add_instruction(v_sequ_ptr,v_var_prt,t1,t2,t3,t4,t5,t6,t7,t_txt,valid,
1527
                        sequ_line,l_num,v_name,v_fn_idx);
1528 2 sckoarn
      end if;
1529
      l_num  :=  l_num + 1;
1530
    end loop; -- end loop read file
1531
 
1532
    file_close(stimulus);  -- close the file when done
1533
 
1534
    assert(v_ostat = 0)
1535 10 sckoarn
      report LF & "Include file specified on line " & (integer'image(l_num)) &
1536
                  " in file " &  file_name &
1537
                  " was not found! Test Terminated" & LF
1538 2 sckoarn
    severity failure;
1539
 
1540
    inst_set   :=  v_inst_ptr;
1541
    var_list   :=  v_var_prt;
1542
    inst_sequ  :=  v_sequ_ptr;
1543 10 sckoarn
    file_list  :=  v_tmp_fn;
1544
 
1545
    --  Now that all the stimulus is loaded, test for invalid variables
1546
    test_inst_sequ(inst_sequ, v_tmp_fn, var_list);
1547
 
1548 2 sckoarn
  end read_instruction_file;
1549
 
1550
------------------------------------------------------------------------------
1551
-- access_inst_sequ
1552
--  This procedure accesses the instruction sequence and returns the parameters
1553 10 sckoarn
--  as they exsist related to the variables state.
1554
--  INPUTS:   inst_sequ  link list of instructions from stimulus
1555
--            var_list   link list of variables
1556
--            file_list  link list of file names
1557
--            sequ_num   the sequence number to recover
1558
--
1559
--  OUTPUTS:  inst  instruction text
1560
--            p1    paramiter 1 in integer form
1561
--            p2    paramiter 2 in integer form
1562
--            p3    paramiter 3 in integer form
1563
--            p4    paramiter 4 in integer form
1564
--            p5    paramiter 5 in integer form
1565
--            p6    paramiter 6 in integer form
1566
--            txt   pointer to any text string of this sequence
1567
--            inst_len  the lenth of inst in characters
1568
--            fname  file name this sequence came from
1569
--            file_line  the line number in fname this sequence came from
1570
--            
1571 2 sckoarn
  procedure access_inst_sequ(variable inst_sequ  :  in  stim_line_ptr;
1572
                             variable var_list   :  in  var_field_ptr;
1573 10 sckoarn
                             variable file_list  :  in  file_def_ptr;
1574 2 sckoarn
                             variable sequ_num   :  in  integer;
1575
                             variable inst       :  out text_field;
1576
                             variable p1         :  out integer;
1577
                             variable p2         :  out integer;
1578
                             variable p3         :  out integer;
1579
                             variable p4         :  out integer;
1580
                             variable p5         :  out integer;
1581
                             variable p6         :  out integer;
1582
                             variable txt        :  out stm_text_ptr;
1583
                             variable inst_len   :  out integer;
1584
                             variable fname      :  out text_line;
1585
                             variable file_line  :  out integer
1586
                             ) is
1587
    variable temp_text_field:     text_field;
1588
    variable temp_var:            text_field;
1589
    variable inst_ptr:            stim_line_ptr;
1590
    variable valid:               integer;
1591
    variable line:                integer;  -- value of the file_line
1592
    variable file_name:           text_line;
1593 10 sckoarn
    variable tmp_int:             integer;
1594
    variable temp_fn_prt:         file_def_ptr;
1595 2 sckoarn
  begin
1596
   -- get to the instruction indicated by sequ_num
1597
    inst_ptr  :=  inst_sequ;
1598
    while(inst_ptr.next_rec /= null) loop
1599
      if(inst_ptr.line_number = sequ_num) then
1600
        exit;
1601
      else
1602
        inst_ptr := inst_ptr.next_rec;
1603
      end if;
1604
    end loop;
1605
    -- output the instruction and its length
1606
    inst := inst_ptr.instruction;
1607
    inst_len := fld_len(inst_ptr.instruction);
1608
    file_line := inst_ptr.file_line;
1609
    line      := inst_ptr.file_line;
1610 10 sckoarn
    -- recover the file name this line came from
1611
    temp_fn_prt := file_list;
1612
    tmp_int   :=  inst_ptr.file_idx;
1613
    while (temp_fn_prt.next_rec /= null) loop
1614
      if(temp_fn_prt.rec_idx = tmp_int) then
1615
        exit;
1616
      end if;
1617
      temp_fn_prt  :=  temp_fn_prt.next_rec;
1618
    end loop;
1619
    for i in 1 to fname'high loop
1620
      file_name(i) :=  temp_fn_prt.file_name(i);
1621
    end loop;
1622
 
1623 2 sckoarn
    txt       := inst_ptr.txt;
1624
    -- load parameter one
1625
    temp_text_field  :=  inst_ptr.inst_field_1;
1626
    if(temp_text_field(1) /= nul) then
1627
      -- if this is a numaric field convert to integer
1628
      if(temp_text_field(1) = 'x' or temp_text_field(1) = 'h' or
1629
         temp_text_field(1) = 'b') then
1630
        p1 := stim_to_integer(temp_text_field,file_name,line);
1631
      elsif(is_digit(temp_text_field(1)) = true) then
1632
        p1 := stim_to_integer(temp_text_field,file_name,line);
1633
      else  -- else is a variable, get the value or halt incase of error
1634
        access_variable(var_list,temp_text_field,p1,valid);
1635
        assert(valid = 1)
1636
          report LF & "Error: First variable on stimulus line " & (integer'image(line))
1637
                    & " is not valid!!" & LF & "In file " & file_name
1638
        severity failure;
1639
      end if;
1640
    end if;
1641
    -- load parameter two
1642
    temp_text_field  :=  inst_ptr.inst_field_2;
1643
    if(temp_text_field(1) /= nul) then
1644
      -- if this is a numaric field convert to integer
1645
      if(temp_text_field(1) = 'x' or temp_text_field(1) = 'h' or
1646
         temp_text_field(1) = 'b') then
1647
        p2 := stim_to_integer(temp_text_field,file_name,line);
1648
      elsif(is_digit(temp_text_field(1)) = true) then
1649
        p2 := stim_to_integer(temp_text_field,file_name,line);
1650
      else  -- else is a variable, get the value or halt incase of error
1651
        access_variable(var_list,temp_text_field,p2,valid);
1652
        assert(valid = 1)
1653
          report LF & "Error: Second variable on stimulus line " & (integer'image(line))
1654
                    & " is not valid!!" & LF & "In file " & file_name
1655
        severity failure;
1656
      end if;
1657
    end if;
1658
    -- load parameter three
1659
    temp_text_field  :=  inst_ptr.inst_field_3;
1660
    if(temp_text_field(1) /= nul) then
1661
      -- if this is a numaric field convert to integer
1662
      if(temp_text_field(1) = 'x' or temp_text_field(1) = 'h' or
1663
         temp_text_field(1) = 'b') then
1664
        p3 := stim_to_integer(temp_text_field,file_name,line);
1665
      elsif(is_digit(temp_text_field(1)) = true) then
1666
        p3 := stim_to_integer(temp_text_field,file_name,line);
1667
      else  -- else is a variable, get the value or halt incase of error
1668
        access_variable(var_list,temp_text_field,p3,valid);
1669
        assert(valid = 1)
1670
          report LF & "Error: Third variable on stimulus line " & (integer'image(line))
1671
                    & " is not valid!!" & LF & "In file " & file_name
1672
        severity failure;
1673
      end if;
1674
    end if;
1675
    -- load parameter four
1676
    temp_text_field  :=  inst_ptr.inst_field_4;
1677
    if(temp_text_field(1) /= nul) then
1678
      -- if this is a numaric field convert to integer
1679
      if(temp_text_field(1) = 'x' or temp_text_field(1) = 'h' or
1680
         temp_text_field(1) = 'b') then
1681
        p4 := stim_to_integer(temp_text_field,file_name,line);
1682
      elsif(is_digit(temp_text_field(1)) = true) then
1683
        p4 := stim_to_integer(temp_text_field,file_name,line);
1684
      else  -- else is a variable, get the value or halt incase of error
1685
        access_variable(var_list,temp_text_field,p4,valid);
1686
        assert(valid = 1)
1687
          report LF & "Error: Forth variable on stimulus line " & (integer'image(line))
1688
                    & " is not valid!!" & LF & "In file " & file_name
1689
        severity failure;
1690
      end if;
1691
    end if;
1692
    -- load parameter five
1693
    temp_text_field  :=  inst_ptr.inst_field_5;
1694
    if(temp_text_field(1) /= nul) then
1695
      -- if this is a numaric field convert to integer
1696
      if(temp_text_field(1) = 'x' or temp_text_field(1) = 'h' or
1697
         temp_text_field(1) = 'b') then
1698
        p5 := stim_to_integer(temp_text_field,file_name,line);
1699
      elsif(is_digit(temp_text_field(1)) = true) then
1700
        p5 := stim_to_integer(temp_text_field,file_name,line);
1701
      else  -- else is a variable, get the value or halt incase of error
1702
        access_variable(var_list,temp_text_field,p5,valid);
1703
        assert(valid = 1)
1704
          report LF & "Error: Fifth variable on stimulus line " & (integer'image(line))
1705
                    & " is not valid!!" & LF & "In file " & file_name
1706
        severity failure;
1707
      end if;
1708
    end if;
1709
    -- load parameter six
1710
    temp_text_field  :=  inst_ptr.inst_field_6;
1711
    if(temp_text_field(1) /= nul) then
1712
      -- if this is a numaric field convert to integer
1713
      if(temp_text_field(1) = 'x' or temp_text_field(1) = 'h' or
1714
         temp_text_field(1) = 'b') then
1715
        p6 := stim_to_integer(temp_text_field,file_name,line);
1716
      elsif(is_digit(temp_text_field(1)) = true) then
1717
        p6 := stim_to_integer(temp_text_field,file_name,line);
1718
      else  -- else is a variable, get the value or halt incase of error
1719
        access_variable(var_list,temp_text_field,p6,valid);
1720
        assert(valid = 1)
1721
          report LF & "Error: Sixth variable on stimulus line " & (integer'image(line))
1722
                    & " is not valid!!" & LF & "In file " & file_name
1723
        severity failure;
1724
      end if;
1725
    end if;
1726
  end access_inst_sequ;
1727
 
1728
-------------------------------------------------------------------------
1729
-- dump inst_sequ
1730
--  This procedure dumps to the simulation window the current instruction
1731
--  sequence.  The whole thing will be dumped, which could be big.
1732
--   ** intended for testbench development debug **
1733 10 sckoarn
--  procedure dump_inst_sequ(variable inst_sequ  :  in  stim_line_ptr) is
1734
--    variable v_sequ  :  stim_line_ptr;
1735
--  begin
1736
--    v_sequ  :=  inst_sequ;
1737
--    while(v_sequ.next_rec /= null) loop
1738
--      print("-----------------------------------------------------------------");
1739
--      print("Instruction is " & v_sequ.instruction &
1740
--      "     Par1: "   & v_sequ.inst_field_1 &
1741
--      "     Par2: "   & v_sequ.inst_field_2 &
1742
--      "     Par3: "   & v_sequ.inst_field_3 &
1743
--      "     Par4: "   & v_sequ.inst_field_4);
1744
--      print("Line Number: " & to_str(v_sequ.line_number) & "     File Line Number: " & to_str(v_sequ.file_line) &
1745
--      "     File Name: " & v_sequ.file_name);
1746
--      
1747
--      v_sequ  :=  v_sequ.next_rec;
1748
--    end loop;
1749
--    -- get the last one
1750
--    print("-----------------------------------------------------------------");
1751
--    print("Instruction is " & v_sequ.instruction & "     Par1: "   & v_sequ.inst_field_1 &
1752
--    "     Par2: "   & v_sequ.inst_field_2 & "     Par3: "   & v_sequ.inst_field_3 &
1753
--    "     Par4: "   & v_sequ.inst_field_4);
1754
--    print("Line Number: " & to_str(v_sequ.line_number) & "     File Line Number: " & to_str(v_sequ.file_line) &
1755
--    "     File Name: " & v_sequ.file_name);
1756
--  end dump_inst_sequ;
1757 2 sckoarn
 
1758
-------------------------------------------------------------------------------
1759
-- Procedure to print messages to stdout
1760
  procedure print(s: in string) is
1761
    variable l: line;
1762
  begin
1763
    write(l, s);
1764
    writeline(output,l);
1765
  end print;
1766
 
1767
-------------------------------------------------------------------------------
1768
--  procedure to print to the stdout the txt pointer
1769
  procedure txt_print(variable ptr: in stm_text_ptr) is
1770
    variable txt_str      : stm_text;
1771
  begin
1772
 
1773
    if (ptr /= null) then
1774
      txt_str := (others => nul);
1775 10 sckoarn
      for i in 1 to c_stm_text_len loop
1776 2 sckoarn
        if (ptr(i) = nul) then
1777
          exit;
1778
        end if;
1779
        txt_str(i) := ptr(i);
1780
      end loop;
1781
      print(txt_str);
1782
    end if;
1783
  end txt_print;
1784
 
1785
-------------------------------------------------------------------------------
1786
--  procedure to print to the stdout the txt pointer, and
1787
--     sub any variables found
1788
  procedure txt_print_wvar(variable var_list : in var_field_ptr;
1789
                           variable ptr      : in stm_text_ptr;
1790
                           constant b        : in base) is
1791
 
1792
    variable i:          integer;
1793
    variable j:          integer;
1794
    variable k:          integer;
1795
    variable txt_str:    stm_text;
1796
    variable tmp_str:    stm_text;
1797
    variable v1:         integer;
1798
    variable valid:      integer;
1799
    variable tmp_field:  text_field;
1800
    variable tmp_i:      integer;
1801
 
1802
  begin
1803
    if(ptr /= null) then
1804
      i := 1;
1805
      j := 1;
1806
      txt_str := (others => nul);
1807 10 sckoarn
      while(i <= c_stm_text_len and j <= c_stm_text_len) loop
1808 2 sckoarn
        if(ptr(i) /= '$') then
1809
          txt_str(j) := ptr(i);
1810
          i := i + 1;
1811
          j := j + 1;
1812
        else
1813
          tmp_field := (others => nul);
1814
          tmp_i := 1;
1815
          tmp_field(tmp_i) := ptr(i);
1816
          i := i + 1;
1817
          tmp_i := tmp_i + 1;
1818
          -- parse to the next space
1819
          while(ptr(i) /= ' ' and ptr(i) /= nul) loop
1820
            tmp_field(tmp_i) := ptr(i);
1821
            i := i + 1;
1822
            tmp_i := tmp_i + 1;
1823
          end loop;
1824
          access_variable(var_list,tmp_field,v1,valid);
1825
          assert(valid = 1)
1826
            report LF & "Invalid Variable found in stm_text_ptr: ignoring."
1827
          severity warning;
1828
 
1829
          if(valid = 1) then
1830
 
1831
            txt_str :=  ew_str_cat(txt_str, ew_to_str(v1, b));
1832
            k := 1;
1833
            while(txt_str(k) /= nul) loop
1834
              k := k + 1;
1835
            end loop;
1836
            j := k;
1837
          end if;
1838
        end if;
1839
      end loop;
1840
      -- print the created string
1841
      print(txt_str);
1842
    end if;
1843
  end txt_print_wvar;
1844
 
1845
end tb_pkg;
1846
 

powered by: WebSVN 2.1.0

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