summaryrefslogtreecommitdiff
path: root/testsuite/vests/vhdl-93/billowitch/compliant/tc538.vhd
blob: 38da705d401b4490dc0f95955b15c76053d29181 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

-- Copyright (C) 2001 Bill Billowitch.

-- Some of the work to develop this test suite was done with Air Force
-- support.  The Air Force and Bill Billowitch assume no
-- responsibilities for this software.

-- This file is part of VESTs (Vhdl tESTs).

-- VESTs is free software; you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the
-- Free Software Foundation; either version 2 of the License, or (at
-- your option) any later version. 

-- VESTs is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-- for more details. 

-- You should have received a copy of the GNU General Public License
-- along with VESTs; if not, write to the Free Software Foundation,
-- Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 

-- ---------------------------------------------------------------------
--
-- $Id: tc538.vhd,v 1.2 2001-10-26 16:29:56 paw Exp $
-- $Revision: 1.2 $
--
-- ---------------------------------------------------------------------

ENTITY c03s03b00x00p05n02i00538ent IS
END c03s03b00x00p05n02i00538ent;

ARCHITECTURE c03s03b00x00p05n02i00538arch OF c03s03b00x00p05n02i00538ent IS

BEGIN
  TESTING: PROCESS
    subtype byte is bit_vector (7 downto 0);
    type byte_mem is array (0 to 15) of byte;

    type ar_bv_ptr is access byte_mem;
    variable v_ar_bv_ptr1: ar_bv_ptr := new byte_mem'(0 => "10000000",
                                                      1 => "00000001",
                                                      others => "00000000");
    variable v_ar_bv_ptr2: ar_bv_ptr;
    variable v_ar_bv_ptr3: ar_bv_ptr := v_ar_bv_ptr1;
    variable   OKtest : integer := 0;
  BEGIN
    assert v_ar_bv_ptr1(1)    = "00000001";
    if (v_ar_bv_ptr1(1)  = "00000001") then
      OKtest := Oktest + 1;
    end if;
    assert v_ar_bv_ptr2    = null;
    if (v_ar_bv_ptr2     = null) then
      OKtest := Oktest + 1;
    end if;
    assert v_ar_bv_ptr3(0)    = "10000000";
    if (v_ar_bv_ptr3(0)  = "10000000") then
      OKtest := Oktest + 1;
    end if;
    assert v_ar_bv_ptr3(15) = "00000000";
    if (v_ar_bv_ptr3(15) = "00000000") then
      OKtest := Oktest + 1;
    end if;
    assert v_ar_bv_ptr3(1)(0)    = '1';        -- (7 downto 0)
    if (v_ar_bv_ptr3(1)(0)       = '1') then
      OKtest := Oktest + 1;
    end if;

    v_ar_bv_ptr2 := new byte_mem'(0 => "10000000",
                                  1 => "00000001",
                                  others => "00000000");

    assert v_ar_bv_ptr2(0)(7) = '1';        -- (7 downto 0)
    if (v_ar_bv_ptr2(0)(7) = '1') then
      OKtest := Oktest + 1;
    end if;

    assert (v_ar_bv_ptr1(1) & v_ar_bv_ptr3(7)) = "0000000100000000";
    if ((v_ar_bv_ptr1(1) & v_ar_bv_ptr3(7)) = "0000000100000000") then
      OKtest := Oktest + 1;
    end if;
    assert (v_ar_bv_ptr3(1) & v_ar_bv_ptr2(0)) = "0000000110000000";
    if ((v_ar_bv_ptr3(1) & v_ar_bv_ptr2(0)) = "0000000110000000") then
      OKtest := Oktest + 1;
    end if;
    assert (v_ar_bv_ptr1(1) /= v_ar_bv_ptr3(0)) = true;
    if ((v_ar_bv_ptr1(1) /= v_ar_bv_ptr3(0)) = true) then
      OKtest := Oktest + 1;
    end if;

    assert NOT(OKtest = 9)
      report "***PASSED TEST: c03s03b00x00p05n02i00538" 
      severity NOTE;
    assert (OKtest = 9)
      report "***FAILED TEST: c03s03b00x00p05n02i00538 - An access value belongs to a corresponding subtype of an access type if the value of the designated object satisfies the constraint."
      severity ERROR;
    wait;
  END PROCESS TESTING;

END c03s03b00x00p05n02i00538arch;