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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c4/] [c45342a.ada] - Blame information for rev 154

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

Line No. Rev Author Line
1 149 jeremybenn
-- C45342A.ADA
2
 
3
--                             Grant of Unlimited Rights
4
--
5
--     Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6
--     F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained 
7
--     unlimited rights in the software and documentation contained herein.
8
--     Unlimited rights are defined in DFAR 252.227-7013(a)(19).  By making 
9
--     this public release, the Government intends to confer upon all 
10
--     recipients unlimited rights  equal to those held by the Government.  
11
--     These rights include rights to use, duplicate, release or disclose the 
12
--     released technical data and computer software in whole or in part, in 
13
--     any manner and for any purpose whatsoever, and to have or permit others 
14
--     to do so.
15
--
16
--                                    DISCLAIMER
17
--
18
--     ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19
--     DISCLOSED ARE AS IS.  THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED 
20
--     WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21
--     SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE 
22
--     OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23
--     PARTICULAR PURPOSE OF SAID MATERIAL.
24
--*
25
-- CHECK THAT CATENATION OF TWO OR MORE NON-NULL OPERANDS YIELDS THE
26
-- CORRECT RESULT, WITH THE CORRECT BOUNDS, WHETHER BOUNDS ARE STATIC OR
27
-- DYNAMIC.
28
 
29
-- BHS 6/27/84
30
 
31
WITH REPORT;
32
PROCEDURE C45342A IS
33
 
34
     USE REPORT;
35
 
36
     SUBTYPE S IS INTEGER RANGE 1..100;
37
     TYPE ARR IS ARRAY (S RANGE <>) OF INTEGER;
38
 
39
     A,B : ARR (2..9);
40
 
41
     FUNCTION F (AR_VAR1, AR_VAR2, AR_VAR3 : ARR) RETURN ARR IS
42
     BEGIN
43
          RETURN AR_VAR1 & AR_VAR2 & AR_VAR3;
44
     END F;
45
 
46
     PROCEDURE CAT (A : ARR; I1,I2 : INTEGER; NUM : CHARACTER) IS
47
     BEGIN
48
          IF A'FIRST /= I1 OR A'LAST /= I2 THEN
49
               FAILED ("INCORRECT CATENATION BOUNDS - " & NUM);
50
          END IF;
51
     END CAT;
52
 
53
 
54
BEGIN
55
 
56
     TEST ("C45342A", "CHECK THAT CATENATION OF NON-NULL OPERANDS " &
57
                      "YIELDS CORRECT RESULT WITH CORRECT BOUNDS");
58
 
59
     BEGIN
60
          A := (1,2,3,4,5,6,7,8);
61
          B := A(2..4) & A(2..5) & A(2..2);
62
          IF B /= (1,2,3,1,2,3,4,1) THEN
63
               FAILED ("INCORRECT CATENATION RESULT - 1");
64
          END IF;
65
 
66
          A := (8,7,6,5,4,3,2,1);
67
          IF F(A(2..3), A(2..4), A(2..4)) /= (8,7,8,7,6,8,7,6) THEN
68
               FAILED ("INCORRECT CATENATION RESULT - 2");
69
          END IF;
70
 
71
          CAT ( A(3..5) & A(2..3), 3, 7, '3' );
72
     END;
73
 
74
 
75
     DECLARE
76
          DYN2 : INTEGER := IDENT_INT(2);
77
          DYN3 : INTEGER := IDENT_INT(3);
78
          DYN4 : INTEGER := IDENT_INT(4);
79
          DYN6 : INTEGER := IDENT_INT(6);
80
 
81
     BEGIN
82
          A := (1,2,3,4,5,6,7,8);
83
          B := A(DYN2..DYN3) & A(DYN2..DYN4) & A(DYN2..DYN4);
84
          IF B /= (1,2,1,2,3,1,2,3) THEN
85
               FAILED ("INCORRECT CATENATION RESULT - 4");
86
          END IF;
87
 
88
          A := (8,7,6,5,4,3,2,1);
89
          IF F ( A(DYN2..DYN6), A(DYN2..DYN3), A(DYN2..DYN2) )
90
                /= (8,7,6,5,4,8,7,8) THEN
91
               FAILED ("INCORRECT CATENATION RESULT - 5");
92
          END IF;
93
 
94
          CAT ( A(DYN3..5) & A(2..3), 3, 7, '6');
95
     END;
96
 
97
     RESULT;
98
 
99
END C45342A;

powered by: WebSVN 2.1.0

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