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

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [lib/] [gaisler/] [ambatest/] [ambatest.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
------------------------------------------------------------------------------
2
--  This file is a part of the GRLIB VHDL IP LIBRARY
3
--  Copyright (C) 2003, Gaisler Research
4
--
5
--  This program is free software; you can redistribute it and/or modify
6
--  it under the terms of the GNU General Public License as published by
7
--  the Free Software Foundation; either version 2 of the License, or
8
--  (at your option) any later version.
9
--
10
--  This program is distributed in the hope that it will be useful,
11
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
--  GNU General Public License for more details.
14
--
15
--  You should have received a copy of the GNU General Public License
16
--  along with this program; if not, write to the Free Software
17
--  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
18
-----------------------------------------------------------------------------
19
-- Entity:      ambatest
20
-- File:        ambatest.vhd
21
-- Author:      Alf Vaerneus
22
-- Description: Test package for emulators
23
------------------------------------------------------------------------------
24
 
25
-- pragma translate_off
26
library ieee;
27
use ieee.std_logic_1164.all;
28
library grlib;
29
use grlib.amba.all;
30
library gaisler;
31
use grlib.devices.all;
32
use grlib.stdlib.all;
33
library std;
34
use std.textio.all;
35
 
36
package ambatest is
37
 
38
function printhex(value : std_logic_vector; len : integer) return string;
39
function conv_std_logic_vector(value : string; len : integer) return std_logic_vector;
40
function trimlen(str : string) return integer;
41
procedure printf(str : string; timestamp : boolean := false);
42
procedure printf(str : string; vari : integer; timestamp : boolean := false);
43
procedure printf(str : string; vari : std_logic_vector; timestamp : boolean := false);
44
procedure printf(str : string; vari : string; timestamp : boolean := false);
45
procedure compfiles(file1 : string(18 downto 1); file2 : string(18 downto 1); format : integer);
46
procedure compfiles(file1 : string(18 downto 1); file2 : string(18 downto 1); format : integer;  printlvl : integer; err : out boolean);
47
 
48
type command_type is (RD_SINGLE,
49
                      RD_INCR,
50
                      RD_WRAP4,
51
                      RD_INCR4,
52
                      RD_WRAP8,
53
                      RD_INCR8,
54
                      RD_WRAP16,
55
                      RD_INCR16,
56
                      WR_SINGLE,
57
                      WR_INCR,
58
                      WR_WRAP4,
59
                      WR_INCR4,
60
                      WR_WRAP8,
61
                      WR_INCR8,
62
                      WR_WRAP16,
63
                      WR_INCR16,
64
                      M_READ,
65
                      M_READ_LINE,
66
                      M_READ_MULT,
67
                      M_WRITE,
68
                      M_WRITE_INV,
69
                      C_READ,
70
                      C_WRITE,
71
                      I_READ,
72
                      I_WRITE
73
                      );
74
 
75
constant MAX_NO_TB : integer := 20;
76
 
77
type tb_in_type is record
78
  address   : std_logic_vector(31 downto 0);
79
  data      : std_logic_vector(31 downto 0);
80
  start     : std_logic;
81
  command   : command_type;
82
  no_words  : natural;
83
  userfile  : boolean;
84
  usewfile  : boolean;
85
  rfile     : string(18 downto 1);
86
  wfile     : string(18 downto 1);
87
end record;
88
 
89
type tbi_array_type is array(0 to MAX_NO_TB) of tb_in_type;
90
 
91
type status_type is (OK, ERR, TIMEOUT, RETRY);
92
type tb_out_type is record
93
  data      : std_logic_vector(31 downto 0);
94
  ready     : std_logic;
95
  status    : status_type;
96
end record;
97
 
98
type tbo_array_type is array(0 to MAX_NO_TB) of tb_out_type;
99
 
100
type ctrl_type is record
101
  address   : std_logic_vector(31 downto 0);
102
  data      : std_logic_vector(31 downto 0);
103
  status    : status_type;
104
  curword   : natural;
105
  no_words  : natural;
106
  userfile  : boolean;
107
  usewfile  : boolean;
108
  rfile     : string(18 downto 1);
109
  wfile     : string(18 downto 1);
110
end record;
111
 
112
constant tb_in_init : tb_in_type := (
113
  address => (others => '0'),
114
  data => (others => '0'),
115
  start => '0',
116
  command => RD_SINGLE,
117
  no_words => 0,
118
  userfile => false,
119
  usewfile => false,
120
  rfile => "                  ",
121
  wfile => "                  ");
122
 
123
constant ctrl_init : ctrl_type := (
124
  address => (others => '0'),
125
  data => (others => '0'),
126
  status => OK,
127
  curword => 0,
128
  no_words => 1,
129
  userfile => false,
130
  usewfile => false,
131
  rfile => "                  ",
132
  wfile => "                  ");
133
 
134
constant AHB_IDLE : ahb_mst_out_type := (
135
  hbusreq => '0',
136
  hlock => '0',
137
  htrans => HTRANS_IDLE,
138
  haddr => (others => '0'),
139
  hwrite => '0',
140
  hsize => HSIZE_WORD,
141
  hburst => HBURST_SINGLE,
142
  hprot => (others => '0'),
143
  hwdata => (others => '0'),
144
  hirq => (others => '0'),
145
  hconfig => (others => zero32),
146
  hindex => 0
147
  );
148
 
149
constant READ_SINGLE : ahb_mst_out_type := (
150
  hbusreq => '0',
151
  hlock => '0',
152
  htrans => HTRANS_NONSEQ,
153
  haddr => (others => '0'),
154
  hwrite => '0',
155
  hsize => HSIZE_WORD,
156
  hburst => HBURST_SINGLE,
157
  hprot => (others => '0'),
158
  hwdata => (others => '0'),
159
  hirq => (others => '0'),
160
  hconfig => (others => zero32),
161
  hindex => 0
162
  );
163
 
164
constant READ_INCR : ahb_mst_out_type := (
165
  hbusreq => '0',
166
  hlock => '0',
167
  htrans => HTRANS_NONSEQ,
168
  haddr => (others => '0'),
169
  hwrite => '0',
170
  hsize => HSIZE_WORD,
171
  hburst => HBURST_INCR,
172
  hprot => (others => '0'),
173
  hwdata => (others => '0'),
174
  hirq => (others => '0'),
175
  hconfig => (others => zero32),
176
  hindex => 0
177
  );
178
 
179
constant WRITE_SINGLE : ahb_mst_out_type := (
180
  hbusreq => '0',
181
  hlock => '0',
182
  htrans => HTRANS_NONSEQ,
183
  haddr => (others => '0'),
184
  hwrite => '1',
185
  hsize => HSIZE_WORD,
186
  hburst => HBURST_SINGLE,
187
  hprot => (others => '0'),
188
  hwdata => (others => '0'),
189
  hirq => (others => '0'),
190
  hconfig => (others => zero32),
191
  hindex => 0
192
  );
193
 
194
constant WRITE_INCR : ahb_mst_out_type := (
195
  hbusreq => '0',
196
  hlock => '0',
197
  htrans => HTRANS_NONSEQ,
198
  haddr => (others => '0'),
199
  hwrite => '1',
200
  hsize => HSIZE_WORD,
201
  hburst => HBURST_INCR,
202
  hprot => (others => '0'),
203
  hwdata => (others => '0'),
204
  hirq => (others => '0'),
205
  hconfig => (others => zero32),
206
  hindex => 0
207
  );
208
 
209
 
210
-- AHB Master Emulator
211
component ahbmst_em
212
  generic(
213
    hindex    : integer := 0;
214
    timeoutc  : integer := 100;
215
    dbglevel  : integer := 2
216
  );
217
  port(
218
    rst       : in std_logic;
219
    clk       : in std_logic;
220
    -- AMBA signals
221
    ahbmi     : in  ahb_mst_in_type;
222
    ahbmo     : out ahb_mst_out_type;
223
    -- TB signals
224
    tbi       : in  tb_in_type;
225
    tbo       : out  tb_out_type
226
  );
227
end component;
228
 
229
-- AHB Slave Emulator
230
component ahbslv_em
231
  generic(
232
    hindex    : integer := 0;
233
    abits     : integer := 10;
234
    waitcycles : integer := 2;
235
    retries   : integer := 0;
236
    memaddr   : integer := 16#E00#;
237
    memmask   : integer := 16#FFF#;
238
    ioaddr    : integer := 16#000#;
239
    timeoutc   : integer := 100;
240
    dbglevel  : integer := 2
241
  );
242
  port(
243
    rst       : in std_logic;
244
    clk       : in std_logic;
245
    -- AMBA signals
246
    ahbsi     : in  ahb_slv_in_type;
247
    ahbso     : out ahb_slv_out_type;
248
    -- TB signals
249
    tbi       : in  tb_in_type;
250
    tbo       : out  tb_out_type
251
  );
252
end component;
253
 
254
end ambatest;
255
 
256
 
257
package body ambatest is
258
 
259
function printhex( value : std_logic_vector; len : integer) return string is
260
 variable str1, str2 : string (1 to 8);
261
 variable stmp  : string (8 downto 1);
262
 variable x : std_logic_vector(31 downto 0);
263
 begin
264
     x:= (others => '0');
265
     x(len-1 downto 0) := value;
266
  case len is
267
  when 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 =>
268
    for i in 0 to (len/4)-1 loop
269
      case conv_integer(x(((len-1)-(i*4)) downto ((len-1)-(i*4)-3))) is
270
        when 0 => stmp(i+1) := '0';
271
        when 1 => stmp(i+1) := '1';
272
        when 2 => stmp(i+1) := '2';
273
        when 3 => stmp(i+1) := '3';
274
        when 4 => stmp(i+1) := '4';
275
        when 5 => stmp(i+1) := '5';
276
        when 6 => stmp(i+1) := '6';
277
        when 7 => stmp(i+1) := '7';
278
        when 8 => stmp(i+1) := '8';
279
        when 9 => stmp(i+1) := '9';
280
        when 10 => stmp(i+1) := 'A';
281
        when 11 => stmp(i+1) := 'B';
282
        when 12 => stmp(i+1) := 'C';
283
        when 13 => stmp(i+1) := 'D';
284
        when 14 => stmp(i+1) := 'E';
285
        when 15 => stmp(i+1) := 'F';
286
        when others => stmp(i+1) := 'X';
287
      end case;
288
    end loop;
289
  when others => stmp := (others => ' ');
290
  end case;
291
 
292
 
293
  str2(1 to 8) := stmp(8 downto 1);
294
  for i in 1 to 8 loop
295
    str1(i) := str2(9-i);
296
  end loop;
297
 
298
  return(str1);
299
end printhex;
300
 
301
function to_char( x : INTEGER range 0 to 15) return character is
302
 begin
303
  case x is
304
    when 0 => return('0');
305
    when 1 => return('1');
306
    when 2 => return('2');
307
    when 3 => return('3');
308
    when 4 => return('4');
309
    when 5 => return('5');
310
    when 6 => return('6');
311
    when 7 => return('7');
312
    when 8 => return('8');
313
    when 9 => return('9');
314
    when 10 => return('A');
315
    when 11 => return('B');
316
    when 12 => return('C');
317
    when 13 => return('D');
318
    when 14 => return('E');
319
    when 15 => return('F');
320
  end case;
321
end to_char;
322
 
323
function conv_std_logic_vector(value : string; len : integer) return std_logic_vector is
324
  variable tmpvect : std_logic_vector(31 downto 0);
325
  variable str1,str2 : string(1 to 8);
326
  begin
327
    str1 := value;
328
    for i in 1 to (len/4) loop
329
      str2(i) := str1(((len/4)+1)-i);
330
    end loop;
331
    case len is
332
    when 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 =>
333
      for i in 0 to 7 loop
334
        case str2(i+1) is
335
        when '0' => tmpvect(((i*4)+3) downto (i*4)) := "0000";
336
        when '1' => tmpvect(((i*4)+3) downto (i*4)) := "0001";
337
        when '2' => tmpvect(((i*4)+3) downto (i*4)) := "0010";
338
        when '3' => tmpvect(((i*4)+3) downto (i*4)) := "0011";
339
        when '4' => tmpvect(((i*4)+3) downto (i*4)) := "0100";
340
        when '5' => tmpvect(((i*4)+3) downto (i*4)) := "0101";
341
        when '6' => tmpvect(((i*4)+3) downto (i*4)) := "0110";
342
        when '7' => tmpvect(((i*4)+3) downto (i*4)) := "0111";
343
        when '8' => tmpvect(((i*4)+3) downto (i*4)) := "1000";
344
        when '9' => tmpvect(((i*4)+3) downto (i*4)) := "1001";
345
        when 'A' => tmpvect(((i*4)+3) downto (i*4)) := "1010";
346
        when 'B' => tmpvect(((i*4)+3) downto (i*4)) := "1011";
347
        when 'C' => tmpvect(((i*4)+3) downto (i*4)) := "1100";
348
        when 'D' => tmpvect(((i*4)+3) downto (i*4)) := "1101";
349
        when 'E' => tmpvect(((i*4)+3) downto (i*4)) := "1110";
350
        when 'F' => tmpvect(((i*4)+3) downto (i*4)) := "1111";
351
        when 'a' => tmpvect(((i*4)+3) downto (i*4)) := "1010";
352
        when 'b' => tmpvect(((i*4)+3) downto (i*4)) := "1011";
353
        when 'c' => tmpvect(((i*4)+3) downto (i*4)) := "1100";
354
        when 'd' => tmpvect(((i*4)+3) downto (i*4)) := "1101";
355
        when 'e' => tmpvect(((i*4)+3) downto (i*4)) := "1110";
356
        when 'f' => tmpvect(((i*4)+3) downto (i*4)) := "1111";
357
        when others => tmpvect(((i*4)+3) downto (i*4)) := "0000";
358
        end case;
359
      end loop;
360
    when others => tmpvect := (others => '0');
361
    end case;
362
 
363
    return(tmpvect(len-1 downto 0));
364
end conv_std_logic_vector;
365
 
366
procedure printf(str : string; timestamp : boolean := false) is
367
  variable lenstr,offset,i : integer;
368
  variable rstr : string(1 to 128);
369
  variable L : line;
370
  begin
371
    lenstr := str'length; offset := 1; i := 1;
372
    while i <= lenstr loop
373
      rstr(offset) := str(i); offset := offset+1; i := i+1;
374
    end loop;
375
 
376
    rstr(offset+1) := NUL;
377
    if timestamp then
378
        write(L, rstr & " : ");
379
        write(L, Now, Left, 15);
380
    else
381
        write(L,rstr);
382
    end if;
383
    writeline(output,L);
384
 
385
end procedure;
386
 
387
procedure printf(str : string; vari : integer; timestamp : boolean := false) is
388
  variable lenstr,offset,i,j,x,y,z : integer;
389
  variable rstr : string(1 to 128);
390
  variable tmpstr : string(1 to 8);
391
  variable remzer : boolean;
392
  variable L : line;
393
  begin
394
    lenstr := str'length; offset := 1; i := 1; x := vari;
395
    while i <= lenstr loop
396
      if str(i) = '%' then
397
        if vari = 0 then
398
          rstr(offset) := '0'; offset := offset+1;
399
        else
400
          if vari = 0 then tmpstr := (others => '0');
401
          else
402
            j := 8;
403
            l2: while true loop
404
              j := j-1;
405
              exit l2 when j = 0;
406
              y := x/10;
407
              z := x - y*10;
408
              x := y;
409
              tmpstr(j) := to_char(z);
410
            end loop;
411
            if x>0 then printf("Value is out of range"); end if;
412
          end if;
413
--          tmpstr := printhex(conv_std_logic_vector(vari,32),32);
414
          remzer := false;
415
          for k in 1 to 8 loop
416
            if (tmpstr(k) /= '0' or remzer = true) then
417
              rstr(offset) := tmpstr(k); remzer := true; offset := offset+1;
418
            end if;
419
          end loop;
420
        end if;
421
        i := i+2;
422
      else
423
        rstr(offset) := str(i); offset := offset+1; i := i+1;
424
      end if;
425
    end loop;
426
 
427
    rstr(offset+1) := NUL;
428
    if timestamp then
429
         write(L, rstr & " : ");
430
         write(L, Now, Left, 15);
431
    else
432
        write(L,rstr);
433
    end if;
434
    writeline(output,L);
435
 
436
end procedure;
437
 
438
procedure printf(
439
  str : string;
440
  vari : std_logic_vector;
441
  timestamp : boolean := false) is
442
 
443
  constant zero32 : std_logic_vector(31 downto 0) := (others => '0');
444
  variable lenstr,lenvct,offset,i : integer;
445
  variable rstr : string(1 to 128);
446
  variable tmpstr : string(1 to 8);
447
  variable L : line;
448
  begin
449
    lenstr := str'length; offset := 1;
450
    lenvct := vari'length; i := 1;
451
    while i <= lenstr loop
452
      if str(i) = '%' then
453
        if vari = zero32(lenvct-1 downto 0) then
454
          rstr(offset) := '0'; offset := offset+1;
455
        else
456
          tmpstr := printhex(vari,lenvct);
457
          for j in 1 to 8 loop
458
              rstr(offset) := tmpstr(j); offset := offset+1;
459
          end loop;
460
        end if;
461
        i := i+2;
462
      else
463
        rstr(offset) := str(i); offset := offset+1; i := i+1;
464
      end if;
465
    end loop;
466
 
467
    rstr(offset+1) := NUL;
468
    if timestamp then
469
        write(L, rstr & " : ");
470
        write(L, Now, Left, 15);
471
    else
472
        write(L,rstr);
473
    end if;
474
    writeline(output,L);
475
 
476
end procedure;
477
 
478
function trimlen(str : string) return integer is
479
  variable lenstr,i : integer;
480
  begin
481
    lenstr := str'length; i := 1;
482
    while str(lenstr) /= ' ' loop
483
      i := i+1 ; lenstr := lenstr-1;
484
    end loop;
485
    return(lenstr+1);
486
end function;
487
 
488
procedure printf(
489
  str : string;
490
  vari : string;
491
  timestamp : boolean := false) is
492
  variable lenstr,lenvct,offset,i : integer;
493
  variable rstr : string(1 to 128);
494
  variable L : line;
495
  begin
496
    lenstr := str'length; offset := 1;
497
    lenvct := vari'length; i := 1;
498
    while i <= lenstr loop
499
      if str(i) = '%' then
500
        for j in 1 to lenvct loop
501
            rstr(offset) := vari(j); offset := offset+1;
502
        end loop;
503
        i := i+2;
504
      else
505
        rstr(offset) := str(i); offset := offset+1; i := i+1;
506
      end if;
507
    end loop;
508
 
509
    rstr(offset+1) := NUL;
510
     if timestamp then
511
         write(L, rstr & " : ");
512
         write(L, Now, Left, 15);
513
    else
514
        write(L,rstr);
515
    end if;
516
    writeline(output,L);
517
 
518
end procedure;
519
 
520
procedure compfiles(
521
  file1 : string(18 downto 1);
522
  file2 : string(18 downto 1);
523
  format : integer) is
524
  file comp1, comp2 : text;
525
  variable L1, L2 : line;
526
  variable datahex1, datahex2 : string(1 to 8);
527
  variable dataint1, dataint2, pos, errs : integer;
528
  begin
529
 
530
    pos := 0; errs := 0;
531
    file_open(comp1, external_name => file1(18 downto trimlen(file1)), open_kind => read_mode);
532
    file_open(comp2, external_name => file2(18 downto trimlen(file2)), open_kind => read_mode);
533
    readline(comp1,L1);
534
    readline(comp2,L2);
535
    pos := pos+1;
536
    if format = 0 then
537
      read(L1,dataint1);
538
      read(L2,dataint2);
539
      if dataint1 /= dataint2 then
540
        errs := errs+1;
541
        printf("Comparision error at pos. %d",pos);
542
        printf("Expected data: %d",dataint1);
543
        printf("Compared data: %d",dataint2);
544
      end if;
545
    elsif format = 1 then
546
      read(L1,datahex1);
547
      read(L2,datahex2);
548
      if conv_std_logic_vector(datahex1,32) /= conv_std_logic_vector(datahex2,32) then
549
        errs := errs+1;
550
        printf("Comparision error at pos. %d",pos);
551
        printf("Expected data: %x",datahex1);
552
        printf("Compared data: %x",datahex2);
553
      end if;
554
    end if;
555
    while not (endfile(comp1) or endfile(comp2)) loop
556
      readline(comp1,L1);
557
      readline(comp2,L2);
558
      pos := pos+1;
559
      if format = 0 then
560
        read(L1,dataint1);
561
        read(L2,dataint2);
562
        if dataint1 /= dataint2 then
563
          errs := errs+1;
564
          printf("Comparision error at pos. %d",pos);
565
          printf("Expected data: %d",dataint1);
566
          printf("Compared data: %d",dataint2);
567
        end if;
568
      elsif format = 1 then
569
        read(L1,datahex1);
570
        read(L2,datahex2);
571
        if conv_std_logic_vector(datahex1,32) /= conv_std_logic_vector(datahex2,32) then
572
          errs := errs+1;
573
          printf("Comparision error at pos. %d",pos);
574
          printf("Expected data: %x",datahex1);
575
          printf("Compared data: %x",datahex2);
576
        end if;
577
      end if;
578
    end loop;
579
    if endfile(comp1) /= endfile(comp2) then
580
      printf("Compared files have different size!"); errs := errs+1;
581
    end if;
582
    file_close(comp1); file_close(comp2);
583
    if errs = 0 then
584
      printf("Comparision complete. No failure.");
585
    elsif errs = 1 then
586
      printf("Comparision complete. 1 failure.");
587
    else
588
      printf("Comparision complete. %d failures.",errs);
589
    end if;
590
end procedure;
591
 
592
 
593
procedure compfiles(file1 : string(18 downto 1); file2 : string(18 downto 1); format : integer; printlvl : integer; err : out boolean) is
594
  file comp1, comp2 : text;
595
  variable L1, L2 : line;
596
  variable datahex1, datahex2 : string(1 to 8);
597
  variable dataint1, dataint2, pos, errs : integer;
598
  begin
599
 
600
    pos := 0; errs := 0;
601
    file_open(comp1, external_name => file1(18 downto trimlen(file1)), open_kind => read_mode);
602
    file_open(comp2, external_name => file2(18 downto trimlen(file2)), open_kind => read_mode);
603
    readline(comp1,L1);
604
    readline(comp2,L2);
605
    pos := pos+1;
606
    if format = 0 then
607
      read(L1,dataint1);
608
      read(L2,dataint2);
609
      if dataint1 /= dataint2 then
610
        errs := errs+1;
611
        if printlvl /= 0 then
612
            printf("Comparision error at pos. %d",pos);
613
            printf("Expected data: %d",dataint1);
614
            printf("Compared data: %d",dataint2);
615
        end if;
616
      end if;
617
    elsif format = 1 then
618
      read(L1,datahex1);
619
      read(L2,datahex2);
620
      if conv_std_logic_vector(datahex1,32) /= conv_std_logic_vector(datahex2,32) then
621
        errs := errs+1;
622
        if printlvl /= 0 then
623
            printf("Comparision error at pos. %d",pos);
624
            printf("Expected data: %x",datahex1);
625
            printf("Compared data: %x",datahex2);
626
         end if;
627
      end if;
628
    end if;
629
    while not (endfile(comp1) or endfile(comp2)) loop
630
      readline(comp1,L1);
631
      readline(comp2,L2);
632
      pos := pos+1;
633
      if format = 0 then
634
        read(L1,dataint1);
635
        read(L2,dataint2);
636
        if dataint1 /= dataint2 then
637
          errs := errs+1;
638
          if printlvl /= 0 then
639
              printf("Comparision error at pos. %d",pos);
640
              printf("Expected data: %d",dataint1);
641
              printf("Compared data: %d",dataint2);
642
          end if;
643
        end if;
644
      elsif format = 1 then
645
        read(L1,datahex1);
646
        read(L2,datahex2);
647
        if conv_std_logic_vector(datahex1,32) /= conv_std_logic_vector(datahex2,32) then
648
          errs := errs+1;
649
          if printlvl /= 0 then
650
              printf("Comparision error at pos. %d",pos);
651
              printf("Expected data: %x",datahex1);
652
              printf("Compared data: %x",datahex2);
653
          end if;
654
        end if;
655
      end if;
656
    end loop;
657
    if endfile(comp1) /= endfile(comp2) then
658
        if printlvl /= 0 then
659
            printf("Compared files have different size!"); errs := errs+1;
660
        end if;
661
    end if;
662
    file_close(comp1); file_close(comp2);
663
    err := true;
664
    if errs = 0 then
665
      err := false;
666
      if printlvl >= 2 then
667
          printf("Comparision complete. No failure.");
668
      end if;
669
    elsif errs = 1 then
670
      if printlvl >= 1 then
671
          printf("Comparision complete. 1 failure.");
672
      end if;
673
    else
674
      if printlvl >= 1 then
675
          printf("Comparision complete. %d failures.",errs);
676
      end if;
677
    end if;
678
end procedure;
679
 
680
 
681
end ambatest;
682
-- pragma translate_on
683
 

powered by: WebSVN 2.1.0

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