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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
| library ieee;
use ieee.std_logic_1164.all; -- biblio for std_logic
entity pointer is
port (
rst : in std_logic;
clk : in std_logic;
re : in std_logic);
end pointer;
architecture arch of pointer is
type CELL;
type LINK is access CELL;
type CELL is record
value : natural;
NEXTP : LINK;
end record CELL;
shared variable HEAD, current, current1,current2, previous1,previous2, previous : LINK; --Zeiger auf CELL
shared variable tests : boolean := false;
signal output : natural;
begin -- architecture
MAKE_LL : process
variable tempptr, tempptr1,tempptr2 : LINK;
variable find, find1,find2,find3 : boolean := false;
begin -- process
HEAD := new CELL'(14, HEAD);
HEAD := new CELL'(12, HEAD);
HEAD := new CELL'(10, HEAD);
current := HEAD;
while current /= null and find = false loop
if current.value > 13 then
find := true;
else
previous := current;
current := current.NEXTP;
end if;
end loop;
if previous = null then
HEAD := new CELL'(13, HEAD);
elsif current = null then
tempptr := new CELL'(13, null);
previous.NEXTP := tempptr;
else
tempptr := new CELL'(13, current);
--temp := tempptr;
-- tempptr := current;
previous.NEXTP := tempptr;
-- current := previous.NEXTP;
-- previous.NEXTP := temp;
-- current := temp;
report "previous and current don't point of null" severity note;
--deallocate(tempptr);
-- deallocate(temp);
end if;
current1 := HEAD;
while current1 /= null and find2 = false loop
if current1.value > 5 then
find2 := true;
else
previous1 := current1;
current1 := current1.NEXTP;
end if;
end loop;
if previous1 = null then
HEAD := new CELL'(5, HEAD);
elsif current1 = null then
tempptr1 := new CELL'(5, null);
previous1.NEXTP := tempptr1;
else
tempptr1 := new CELL'(5, current1);
--temp := tempptr;
-- tempptr := current;
previous1.NEXTP := tempptr1;
-- current := previous.NEXTP;
-- previous.NEXTP := temp;
-- current := temp;
report "previous and current don't point of null" severity note;
--deallocate(tempptr);
-- deallocate(temp);
end if;
current2 := HEAD;
while current2 /= null and find3 = false loop
if current2.value > 15 then
find3 := true;
else
previous2 := current2;
current2 := current2.NEXTP;
end if;
end loop;
if previous2 = null then
HEAD := new CELL'(15, HEAD);
elsif current2 = null then
tempptr2 := new CELL'(15, null);
previous2.NEXTP := tempptr2;
else
tempptr2 := new CELL'(15, current2);
--temp := tempptr;
-- tempptr := current;
previous2.NEXTP := tempptr2;
-- current := previous.NEXTP;
-- previous.NEXTP := temp;
-- current := temp;
report "previous and current don't point of null" severity note;
--deallocate(tempptr);
-- deallocate(temp);
end if;
tests := true;
wait;
end process;
LESEN_LL : process
variable testnew : LINK;
begin -- process
testnew := HEAD;
if tests then
while testnew /= null loop
output <= testnew.value;
wait for 20 ns;
testnew := testnew.NEXTP;
if testnew = null then
wait;
end if;
end loop;
end if;
wait for 10 ns;
end process;
end arch; |