1 |
6 |
federico.a |
#!/usr/bin/perl
|
2 |
|
|
|
3 |
|
|
use Tk;
|
4 |
|
|
use Time::Local;
|
5 |
|
|
#use strict;
|
6 |
|
|
#use strict 'subs';
|
7 |
|
|
|
8 |
|
|
#LOCAL VARIABLES
|
9 |
|
|
my $infile="./ahb_generate.conf";
|
10 |
|
|
my $conffile="./ahb_configure.vhd";
|
11 |
|
|
my $matfile="./ahb_matrix.vhd";
|
12 |
|
|
my $sysfile="./ahb_system.vhd";
|
13 |
|
|
my $tbfile="./ahb_tb.vhd";
|
14 |
|
|
|
15 |
|
|
my @master_list;
|
16 |
|
|
my @slave_list;
|
17 |
|
|
|
18 |
|
|
my @mst_list;
|
19 |
|
|
my @slv_list;
|
20 |
|
|
my @pslv_list;
|
21 |
|
|
|
22 |
|
|
my $inst_name;
|
23 |
|
|
my $entity;
|
24 |
|
|
|
25 |
|
|
my $num_arb;
|
26 |
|
|
my $num_arb_msts;
|
27 |
|
|
my $def_arb_mst;
|
28 |
|
|
my @arb_master_list;
|
29 |
|
|
my @arb_slave_list;
|
30 |
|
|
|
31 |
|
|
my $num_brg;
|
32 |
|
|
my $num_brg_slvs;
|
33 |
|
|
my $def_brg_slv;
|
34 |
|
|
my $brg_master;
|
35 |
|
|
my @brg_slave_list;
|
36 |
|
|
|
37 |
|
|
my $num_apb;
|
38 |
|
|
my $num_apb_slvs;
|
39 |
|
|
my $apb_max_addr;
|
40 |
|
|
my $apb_slave_id;
|
41 |
|
|
my @apb_slave_list;
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
my $alg_number;
|
45 |
|
|
my @alg_list = qw/"Fixed" "Round-Robin" "Pseudo-Random" "Locked-Fixed" "Locked-R-R" "Locked-P-R"/;
|
46 |
|
|
|
47 |
|
|
my @gen_signal;
|
48 |
|
|
my @gen_ahb_signal;
|
49 |
|
|
my @gen_conf;
|
50 |
|
|
my @gen_comp;
|
51 |
|
|
my @gen_tbcomp;
|
52 |
|
|
my @gen_uut;
|
53 |
|
|
my @ass_signal;
|
54 |
|
|
|
55 |
|
|
my $curr_line;
|
56 |
|
|
my $cnt;
|
57 |
|
|
my $item;
|
58 |
|
|
|
59 |
|
|
my $chk=0;
|
60 |
|
|
my @tmp_chk;
|
61 |
|
|
my @tmp_lst;
|
62 |
|
|
my $tmp;
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
my $mat;
|
66 |
|
|
my @matrix;
|
67 |
|
|
# GUI SHAPING
|
68 |
|
|
my (@pt)=qw/-side top -fill both -anchor n -pady 10/;
|
69 |
|
|
my (@pc)=qw/-side top -fill both -anchor center -pady 10/;
|
70 |
|
|
my (@pw)=qw/-side left -fill both -anchor w -padx 10/;
|
71 |
|
|
my (@pe)=qw/-side right -fill both -anchor e -padx 10/;
|
72 |
|
|
|
73 |
|
|
# GUI FSM
|
74 |
|
|
my $state='WinGlobal';
|
75 |
|
|
my $i=0;
|
76 |
|
|
my $j;
|
77 |
|
|
|
78 |
|
|
my $a;
|
79 |
|
|
my $b;
|
80 |
|
|
my $c;
|
81 |
|
|
my $d;
|
82 |
|
|
my $e;
|
83 |
|
|
my $f;
|
84 |
|
|
|
85 |
|
|
my $mw;
|
86 |
|
|
my $frame;
|
87 |
|
|
|
88 |
|
|
my $done='disabled';
|
89 |
|
|
|
90 |
|
|
my $masters=-1;
|
91 |
|
|
my $slaves=-1;
|
92 |
|
|
my $pslaves=-1;
|
93 |
|
|
my $arbs=-1;
|
94 |
|
|
my $ahbs=-1;
|
95 |
|
|
my $apbs=-1;
|
96 |
|
|
|
97 |
|
|
my @master;
|
98 |
|
|
my @slave;
|
99 |
|
|
my @pslave;
|
100 |
|
|
my @arb;
|
101 |
|
|
my @ahb;
|
102 |
|
|
my @apb;
|
103 |
|
|
my @uut;
|
104 |
|
|
|
105 |
|
|
my @tmp_mat;
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
sub ResetConf
|
109 |
|
|
|
110 |
|
|
{
|
111 |
|
|
$state='WinGlobal';
|
112 |
|
|
$masters=-1;
|
113 |
|
|
$slaves=-1;
|
114 |
|
|
$pslaves=-1;
|
115 |
|
|
$arbs=-1;
|
116 |
|
|
$ahbs=-1;
|
117 |
|
|
$apbs=-1;
|
118 |
|
|
$#master=-1;
|
119 |
|
|
$#slave=-1;
|
120 |
|
|
$#pslave=-1;
|
121 |
|
|
$#arb=-1;
|
122 |
|
|
$#ahb=-1;
|
123 |
|
|
$#apb=-1;
|
124 |
|
|
}
|
125 |
|
|
|
126 |
|
|
sub ReadConf
|
127 |
|
|
{
|
128 |
|
|
|
129 |
|
|
$state='WinGlobal';
|
130 |
|
|
seek(file1,0,0);
|
131 |
|
|
$masters=-1;
|
132 |
|
|
$slaves=-1;
|
133 |
|
|
$pslaves=-1;
|
134 |
|
|
$arbs=-1;
|
135 |
|
|
$ahbs=-1;
|
136 |
|
|
$apbs=-1;
|
137 |
|
|
|
138 |
|
|
|
139 |
|
|
while(defined($curr_line=<file1>)) {
|
140 |
|
|
chop $curr_line;
|
141 |
|
|
if($curr_line =~ /^#/) {
|
142 |
|
|
print "# Comment skipped ...\n";
|
143 |
|
|
} elsif($curr_line =~ /^(ahb_master),(\w+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)$/){
|
144 |
|
|
$masters++;
|
145 |
|
|
print "Reading AHB Master $masters...\n";
|
146 |
|
|
$master[$masters]{"module"}=$1;
|
147 |
|
|
$master[$masters]{"name"}=$2;
|
148 |
|
|
$master[$masters]{"id"}=$masters;
|
149 |
|
|
$master[$masters]{"fifo_ln"}=$3;
|
150 |
|
|
$master[$masters]{"fifo_he"}=$4;
|
151 |
|
|
$master[$masters]{"fifo_hf"}=$5;
|
152 |
|
|
$master[$masters]{"num_bits_addr"}=$6;
|
153 |
|
|
$master[$masters]{"write_burst"}=$7;
|
154 |
|
|
$master[$masters]{"read_burst"}=$8;
|
155 |
|
|
$master[$masters]{"write_lat"}=$9;
|
156 |
|
|
$master[$masters]{"read_lat"}=$10;
|
157 |
|
|
$uut[$masters]{"base_addr"}=$11;
|
158 |
|
|
} elsif($curr_line =~ /^(ahb_slave),(\w+),\((.*)\),(\w+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)$/){
|
159 |
|
|
$slaves++;
|
160 |
|
|
print "Reading AHB Slave $slaves...\n";
|
161 |
|
|
$slave[$slaves]{"module"}=$1;
|
162 |
|
|
$slave[$slaves]{"name"}=$2;
|
163 |
|
|
foreach $item (split(',',$3)) {
|
164 |
|
|
$slave[$slaves]{"list"} .= " $item";
|
165 |
|
|
}
|
166 |
|
|
$slave[$slaves]{"id"}=$slaves;
|
167 |
|
|
$slave[$slaves]{"type"}=$4;
|
168 |
|
|
$slave[$slaves]{"add_h"}=$5;
|
169 |
|
|
$slave[$slaves]{"add_l"}=$6;
|
170 |
|
|
$slave[$slaves]{"add_hh"}=$7;
|
171 |
|
|
$slave[$slaves]{"add_ll"}=$8;
|
172 |
|
|
$slave[$slaves]{"alg"}=$9;
|
173 |
|
|
$slave[$slaves]{"fifo_ln"}=$10;
|
174 |
|
|
$slave[$slaves]{"fifo_he"}=$11;
|
175 |
|
|
$slave[$slaves]{"fifo_hf"}=$12;
|
176 |
|
|
$slave[$slaves]{"num_bits_addr"}=$13;
|
177 |
|
|
$slave[$slaves]{"write_burst"}=$14;
|
178 |
|
|
$slave[$slaves]{"read_burst"}=$15;
|
179 |
|
|
$slave[$slaves]{"write_lat"}=$16;
|
180 |
|
|
$slave[$slaves]{"read_lat"}=$17;
|
181 |
|
|
} elsif($curr_line =~ /^(apb_slave),(\w+),(\d+),(\d+),(\d+),(\d+),(\d+)$/){
|
182 |
|
|
$pslaves++;
|
183 |
|
|
print "Reading APB Slave $pslaves...\n";
|
184 |
|
|
$pslave[$pslaves]{"module"}=$1;
|
185 |
|
|
$pslave[$pslaves]{"name"}=$2;
|
186 |
|
|
$pslave[$pslaves]{"id"}=$pslaves;
|
187 |
|
|
$pslave[$pslaves]{"add_h"}=$3;
|
188 |
|
|
$pslave[$pslaves]{"add_l"}=$4;
|
189 |
|
|
$pslave[$pslaves]{"add_hh"}=$5;
|
190 |
|
|
$pslave[$pslaves]{"add_ll"}=$6;
|
191 |
|
|
$pslave[$pslaves]{"num_bits_addr"}=$7;
|
192 |
|
|
} elsif($curr_line =~ /^(ahb_arbiter),(\w+),(\d+),\((.*)\),\((.*)\),(\d+)$/){
|
193 |
|
|
$arbs++;
|
194 |
|
|
print "Reading AHB Arbiter $arbs...\n";
|
195 |
|
|
$arb[$arbs]{"module"}=$1;
|
196 |
|
|
$arb[$arbs]{"name"}=$2;
|
197 |
|
|
$arb[$arbs]{"id"}=$arbs;
|
198 |
|
|
$arb[$arbs]{"def"}=$3;
|
199 |
|
|
foreach $item (split(',',$4)) {
|
200 |
|
|
$arb[$arbs]{"m_list"} .= " $item";
|
201 |
|
|
}
|
202 |
|
|
foreach $item (split(',',$5)) {
|
203 |
|
|
$arb[$arbs]{"s_list"} .= " $item";
|
204 |
|
|
}
|
205 |
|
|
$arb[$arbs]{"alg"}=$6;
|
206 |
|
|
} elsif($curr_line =~ /^(ahb_bridge),(\w+),(\d+),(\d+),\((.*)\),(\d+)$/){
|
207 |
|
|
$ahbs++;
|
208 |
|
|
print "Reading AHB Bridge $ahbs...\n";
|
209 |
|
|
$ahb[$ahbs]{"module"}=$1;
|
210 |
|
|
$ahb[$ahbs]{"name"}=$2;
|
211 |
|
|
$ahb[$ahbs]{"id"}=$ahbs;
|
212 |
|
|
$ahb[$ahbs]{"alg"}=$3;
|
213 |
|
|
$ahb[$ahbs]{"def"}=$4;
|
214 |
|
|
foreach $item (split(',',$5)) {
|
215 |
|
|
$ahb[$ahbs]{"list"} .= " $item";
|
216 |
|
|
}
|
217 |
|
|
$ahb[$ahbs]{"mst"}=$6;
|
218 |
|
|
} elsif($curr_line =~ /^(apb_bridge),(\w+),(\d+),(\d+),\((.*)\)$/){
|
219 |
|
|
$apbs++;
|
220 |
|
|
print "Reading APB Bridge $apbs...\n";
|
221 |
|
|
$apb[$apbs]{"module"}=$1;
|
222 |
|
|
$apb[$apbs]{"name"}=$2;
|
223 |
|
|
$apb[$apbs]{"id"}=$apbs;
|
224 |
|
|
$apb[$apbs]{"num_bits_addr"}=$3;
|
225 |
|
|
$apb[$apbs]{"slv"}=$4;
|
226 |
|
|
foreach $item (split(',',$5)) {
|
227 |
|
|
$apb[$apbs]{"list"} .= " $item";
|
228 |
|
|
}
|
229 |
|
|
|
230 |
|
|
} else {
|
231 |
|
|
print "#### wrong format!!!\n";
|
232 |
|
|
}
|
233 |
|
|
# close(file1);
|
234 |
|
|
}
|
235 |
|
|
|
236 |
|
|
|
237 |
|
|
sub SaveConf
|
238 |
|
|
{
|
239 |
|
|
|
240 |
|
|
$state='WinGlobal';
|
241 |
|
|
open(file1,">$infile")|| die "Cannot write ahb configuration output file $infile\n";
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
$i=0;
|
245 |
|
|
while($i<=$masters) {
|
246 |
|
|
print file1 "# ahb_master $i: module,name,fifo_length,fifo_he,fifo_hf,num_bits_adds,write_burst,read_burst,write_lat,read_lat,UUT_BaseAddr\n";
|
247 |
|
|
print file1 "$master[$i]{\"module\"},";
|
248 |
|
|
print file1 "$master[$i]{\"name\"},";
|
249 |
|
|
print file1 "$master[$i]{\"fifo_ln\"},";
|
250 |
|
|
print file1 "$master[$i]{\"fifo_he\"},";
|
251 |
|
|
print file1 "$master[$i]{\"fifo_hf\"},";
|
252 |
|
|
print file1 "$master[$i]{\"num_bits_addr\"},";
|
253 |
|
|
print file1 "$master[$i]{\"write_burst\"},";
|
254 |
|
|
print file1 "$master[$i]{\"read_burst\"},";
|
255 |
|
|
print file1 "$master[$i]{\"write_lat\"},";
|
256 |
|
|
print file1 "$master[$i]{\"read_lat\"},";
|
257 |
|
|
print file1 "$uut[$i]{\"base_addr\"}\n";
|
258 |
|
|
$i++;
|
259 |
|
|
}
|
260 |
|
|
|
261 |
|
|
$i=0;
|
262 |
|
|
while($i<=$slaves) {
|
263 |
|
|
print file1 "# ahb_slave $i:
|
264 |
|
|
# module,name,NOT_USED,type,add_h,add_l,remap add_h,remap add_l,NOT_USED,fifo_le,fifo_he,fifo_hf,num_bits_adds,write_burst,read_burst,write_lat,read_lat\n";
|
265 |
|
|
print file1 "$slave[$i]{\"module\"},";
|
266 |
|
|
print file1 "$slave[$i]{\"name\"},";
|
267 |
|
|
print file1 "(";
|
268 |
|
|
$_=$slave[$i]{"list"};
|
269 |
|
|
s/^[ ]+//g;
|
270 |
|
|
s/[ ]+$//g;
|
271 |
|
|
s/[ ]+/,/g;
|
272 |
|
|
print file1 "$_),";
|
273 |
|
|
# print file1 "$slave[$i]{\"id\"},";
|
274 |
|
|
print file1 "$slave[$i]{\"type\"},";
|
275 |
|
|
print file1 "$slave[$i]{\"add_h\"},";
|
276 |
|
|
print file1 "$slave[$i]{\"add_l\"},";
|
277 |
|
|
print file1 "$slave[$i]{\"add_hh\"},";
|
278 |
|
|
print file1 "$slave[$i]{\"add_ll\"},";
|
279 |
|
|
print file1 "$slave[$i]{\"alg\"},";
|
280 |
|
|
print file1 "$slave[$i]{\"fifo_ln\"},";
|
281 |
|
|
print file1 "$slave[$i]{\"fifo_he\"},";
|
282 |
|
|
print file1 "$slave[$i]{\"fifo_hf\"},";
|
283 |
|
|
print file1 "$slave[$i]{\"num_bits_addr\"},";
|
284 |
|
|
print file1 "$slave[$i]{\"write_burst\"},";
|
285 |
|
|
print file1 "$slave[$i]{\"read_burst\"},";
|
286 |
|
|
print file1 "$slave[$i]{\"write_lat\"},";
|
287 |
|
|
print file1 "$slave[$i]{\"read_lat\"}\n";
|
288 |
|
|
$i++;
|
289 |
|
|
}
|
290 |
|
|
|
291 |
|
|
$i=0;
|
292 |
|
|
while($i<=$pslaves) {
|
293 |
|
|
print file1 "# apb_slave $i: module,name,add_h,add_l,remap add_h,remap add_l,num_bits_adds\n";
|
294 |
|
|
print file1 "$pslave[$i]{\"module\"},";
|
295 |
|
|
print file1 "$pslave[$i]{\"name\"},";
|
296 |
|
|
# print file1 "$pslave[$i]{\"id\"},";
|
297 |
|
|
print file1 "$pslave[$i]{\"add_h\"},";
|
298 |
|
|
print file1 "$pslave[$i]{\"add_l\"},";
|
299 |
|
|
print file1 "$pslave[$i]{\"add_hh\"},";
|
300 |
|
|
print file1 "$pslave[$i]{\"add_ll\"},";
|
301 |
|
|
print file1 "$pslave[$i]{\"num_bits_addr\"}\n";
|
302 |
|
|
$i++;
|
303 |
|
|
}
|
304 |
|
|
|
305 |
|
|
$i=0;
|
306 |
|
|
while($i<=$arbs) {
|
307 |
|
|
print file1 "# ahb_arbiter $i: module,name,default master,master_list,slave_list,arbitration type\n";
|
308 |
|
|
print file1 "$arb[$i]{\"module\"},";
|
309 |
|
|
print file1 "$arb[$i]{\"name\"},";
|
310 |
|
|
# print file1 "$arb[$i]{\"id\"},";
|
311 |
|
|
print file1 "$arb[$i]{\"def\"},";
|
312 |
|
|
print file1 "(";
|
313 |
|
|
$_=$arb[$i]{"m_list"};
|
314 |
|
|
s/^[ ]+//g;
|
315 |
|
|
s/[ ]+$//g;
|
316 |
|
|
s/[ ]+/,/g;
|
317 |
|
|
print file1 "$_),";
|
318 |
|
|
print file1 "(";
|
319 |
|
|
$_=$arb[$i]{"s_list"};
|
320 |
|
|
s/^[ ]+//g;
|
321 |
|
|
s/[ ]+$//g;
|
322 |
|
|
s/[ ]+/,/g;
|
323 |
|
|
print file1 "$_),";
|
324 |
|
|
print file1 "$arb[$i]{\"alg\"}\n";
|
325 |
|
|
$i++;
|
326 |
|
|
}
|
327 |
|
|
|
328 |
|
|
$i=0;
|
329 |
|
|
while($i<=$ahbs) {
|
330 |
|
|
print file1 "# ahb_bridge $i: module,name,arbitration type,default slave,slave_list,master\n";
|
331 |
|
|
print file1 "$ahb[$i]{\"module\"},";
|
332 |
|
|
print file1 "$ahb[$i]{\"name\"},";
|
333 |
|
|
# print file1 "$ahb[$i]{\"id\"},";
|
334 |
|
|
print file1 "$ahb[$i]{\"alg\"},";
|
335 |
|
|
print file1 "$ahb[$i]{\"def\"},";
|
336 |
|
|
print file1 "(";
|
337 |
|
|
$_=$ahb[$i]{"list"};
|
338 |
|
|
s/^[ ]+//g;
|
339 |
|
|
s/[ ]+$//g;
|
340 |
|
|
s/[ ]+/,/g;
|
341 |
|
|
print file1 "$_),";
|
342 |
|
|
print file1 "$ahb[$ahbs]{\"mst\"}\n";
|
343 |
|
|
$i++;
|
344 |
|
|
}
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
$i=0;
|
348 |
|
|
while($i<=$apbs) {
|
349 |
|
|
print file1 "# apb_bridge $i: module,name,num_bits_adds,slave,periph list\n";
|
350 |
|
|
print file1 "$apb[$i]{\"module\"},";
|
351 |
|
|
print file1 "$apb[$i]{\"name\"},";
|
352 |
|
|
# print file1 "$apb[$i]{\"id\"},";
|
353 |
|
|
print file1 "$apb[$i]{\"num_bits_addr\"},";
|
354 |
|
|
print file1 "$apb[$i]{\"slv\"},";
|
355 |
|
|
print file1 "(";
|
356 |
|
|
$_=$apb[$i]{"list"};
|
357 |
|
|
s/^[ ]+//g;
|
358 |
|
|
s/[ ]+$//g;
|
359 |
|
|
s/[ ]+/,/g;
|
360 |
|
|
print file1 "$_)\n";
|
361 |
|
|
$i++;
|
362 |
|
|
}
|
363 |
|
|
|
364 |
|
|
}
|
365 |
|
|
|
366 |
|
|
|
367 |
|
|
sub gen_master
|
368 |
|
|
{
|
369 |
|
|
|
370 |
|
|
my $tmp_mst=shift(@_);
|
371 |
|
|
|
372 |
|
|
@gen_tbcomp = (@gen_tbcomp, "
|
373 |
|
|
$tmp_mst->{\"name\"}: ahb_master
|
374 |
|
|
generic map(
|
375 |
|
|
fifohempty_level => $tmp_mst->{\"fifo_he\"},
|
376 |
|
|
fifohfull_level => $tmp_mst->{\"fifo_hf\"},
|
377 |
|
|
fifo_length => $tmp_mst->{\"fifo_ln\"})
|
378 |
|
|
port map (
|
379 |
|
|
hresetn => hresetn,
|
380 |
|
|
hclk => hclk,
|
381 |
|
|
mst_in => ahb_mst_$tmp_mst->{\"id\"}_in,
|
382 |
|
|
mst_out => ahb_mst_$tmp_mst->{\"id\"}_out,
|
383 |
|
|
dma_start => dma_start($tmp_mst->{\"id\"}),
|
384 |
|
|
m_wrap_out => m_wrap_out($tmp_mst->{\"id\"}),
|
385 |
|
|
m_wrap_in => m_wrap_in($tmp_mst->{\"id\"}),
|
386 |
|
|
eot_int => eot_int($tmp_mst->{\"id\"}),
|
387 |
|
|
slv_running => zero,
|
388 |
|
|
mst_running => open);
|
389 |
|
|
|
390 |
|
|
$tmp_mst->{\"name\"}_wrap: mst_wrap
|
391 |
|
|
generic map(
|
392 |
|
|
--synopsys translate_off
|
393 |
|
|
dump_file => \"m$tmp_mst->{\"id\"}.log\",
|
394 |
|
|
dump_type => dump_all,
|
395 |
|
|
--synopsys translate_on
|
396 |
|
|
ahb_max_addr => $tmp_mst->{\"num_bits_addr\"},
|
397 |
|
|
m_const_lat_write => $tmp_mst->{\"write_lat\"},
|
398 |
|
|
m_const_lat_read => $tmp_mst->{\"read_lat\"},
|
399 |
|
|
m_write_burst => $tmp_mst->{\"write_burst\"},
|
400 |
|
|
m_read_burst => $tmp_mst->{\"read_burst\"})
|
401 |
|
|
port map(
|
402 |
|
|
hresetn => hresetn,
|
403 |
|
|
clk => hclk,
|
404 |
|
|
conf => conf($tmp_mst->{\"id\"}),
|
405 |
|
|
dma_start => dma_start($tmp_mst->{\"id\"}),
|
406 |
|
|
m_wrap_in => m_wrap_out($tmp_mst->{\"id\"}),
|
407 |
|
|
m_wrap_out => m_wrap_in($tmp_mst->{\"id\"}));
|
408 |
|
|
");
|
409 |
|
|
|
410 |
|
|
|
411 |
|
|
@gen_uut = (@gen_uut, "
|
412 |
|
|
uut_stimulator_$tmp_mst->{\"id\"}: uut_stimulator
|
413 |
|
|
generic map(
|
414 |
|
|
enable => 1,
|
415 |
|
|
stim_type => stim_$tmp_mst->{\"id\"},
|
416 |
|
|
eot_enable => 1)
|
417 |
|
|
port map(
|
418 |
|
|
hclk => hclk,
|
419 |
|
|
hresetn => hresetn,
|
420 |
|
|
amba_error => zero,
|
421 |
|
|
eot_int => eot_int($tmp_mst->{\"id\"}),
|
422 |
|
|
conf => conf($tmp_mst->{\"id\"}),
|
423 |
|
|
sim_end => sim_end($tmp_mst->{\"id\"}));
|
424 |
|
|
|
425 |
|
|
");
|
426 |
|
|
|
427 |
|
|
|
428 |
|
|
}
|
429 |
|
|
|
430 |
|
|
sub gen_slave {
|
431 |
|
|
|
432 |
|
|
my $tmp_slv=shift(@_);
|
433 |
|
|
|
434 |
|
|
#if ($tmp_slv->{"type"}=='wait') {
|
435 |
|
|
#@gen_tbcomp = (@gen_tbcomp, "
|
436 |
|
|
#$tmp_slv->{\"name\"}: ahb_single_slave");
|
437 |
|
|
#} else {
|
438 |
|
|
@gen_tbcomp = (@gen_tbcomp, "
|
439 |
|
|
$tmp_slv->{\"name\"}: ahb_slave_$tmp_slv->{\"type\"}");
|
440 |
|
|
#};
|
441 |
|
|
|
442 |
|
|
@gen_tbcomp = (@gen_tbcomp, "
|
443 |
|
|
generic map(
|
444 |
|
|
num_slv => $tmp_slv->{\"id\"},
|
445 |
|
|
fifohempty_level => $tmp_slv->{\"fifo_he\"},
|
446 |
|
|
fifohfull_level => $tmp_slv->{\"fifo_hf\"},
|
447 |
|
|
fifo_length => $tmp_slv->{\"fifo_ln\"})
|
448 |
|
|
port map (
|
449 |
|
|
hresetn => hresetn,
|
450 |
|
|
hclk => hclk,
|
451 |
|
|
remap => remap,
|
452 |
|
|
slv_in => ahb_slv_$tmp_slv->{\"id\"}_in,
|
453 |
|
|
slv_out => ahb_slv_$tmp_slv->{\"id\"}_out,
|
454 |
|
|
s_wrap_out => s_wrap_out($tmp_slv->{\"id\"}),
|
455 |
|
|
s_wrap_in => s_wrap_in($tmp_slv->{\"id\"}),
|
456 |
|
|
mst_running => zero,
|
457 |
|
|
prior_in => zero,
|
458 |
|
|
slv_running => open,
|
459 |
|
|
slv_err => open);
|
460 |
|
|
|
461 |
|
|
|
462 |
|
|
$tmp_slv->{\"name\"}_wrap: slv_mem
|
463 |
|
|
generic map(
|
464 |
|
|
--synopsys translate_off
|
465 |
|
|
dump_file => \"s$tmp_slv->{\"id\"}.log\",
|
466 |
|
|
dump_type => dump_all,
|
467 |
|
|
--synopsys translate_on
|
468 |
|
|
ahb_max_addr => $tmp_slv->{\"num_bits_addr\"},
|
469 |
|
|
s_const_lat_write => $tmp_slv->{\"write_lat\"},
|
470 |
|
|
s_const_lat_read => $tmp_slv->{\"read_lat\"},
|
471 |
|
|
s_write_burst => $tmp_slv->{\"write_burst\"},
|
472 |
|
|
s_read_burst => $tmp_slv->{\"read_burst\"})
|
473 |
|
|
port map(
|
474 |
|
|
hresetn => hresetn,
|
475 |
|
|
clk => hclk,
|
476 |
|
|
conf => no_conf_s,
|
477 |
|
|
dma_start => open,
|
478 |
|
|
s_wrap_in => s_wrap_out($tmp_slv->{\"id\"}),
|
479 |
|
|
s_wrap_out => s_wrap_in($tmp_slv->{\"id\"}));
|
480 |
|
|
|
481 |
|
|
");
|
482 |
|
|
|
483 |
|
|
|
484 |
|
|
}
|
485 |
|
|
|
486 |
|
|
|
487 |
|
|
|
488 |
|
|
sub gen_pslave
|
489 |
|
|
{
|
490 |
|
|
my $tmp_pslv=shift(@_);
|
491 |
|
|
@gen_tbcomp = (@gen_tbcomp, "
|
492 |
|
|
$tmp_pslv->{\"name\"}: apb_slave
|
493 |
|
|
generic map(
|
494 |
|
|
--synopsys translate_off
|
495 |
|
|
dump_file => \"p$tmp_pslv->{\"id\"}.log\",
|
496 |
|
|
--synopsys translate_on
|
497 |
|
|
apb_slv_addr => $tmp_pslv->{\"num_bits_addr\"})
|
498 |
|
|
port map (
|
499 |
|
|
hresetn => hresetn,
|
500 |
|
|
hclk => hclk,
|
501 |
|
|
apb_in => apb_slv_$tmp_pslv->{\"id\"}_in,
|
502 |
|
|
apb_out => apb_slv_$tmp_pslv->{\"id\"}_out);
|
503 |
|
|
|
504 |
|
|
");
|
505 |
|
|
|
506 |
|
|
|
507 |
|
|
}
|
508 |
|
|
|
509 |
|
|
|
510 |
|
|
|
511 |
|
|
sub gen_arbiter
|
512 |
|
|
{
|
513 |
|
|
my $tmp_arb=shift(@_);
|
514 |
|
|
|
515 |
|
|
@arb_master_list = split(' ',$tmp_arb->{"m_list"});
|
516 |
|
|
$def_arb_mst = $arb_master_list[0];
|
517 |
|
|
$num_arb_msts = $#arb_master_list+1;
|
518 |
|
|
@arb_slave_list = split(' ',$tmp_arb->{"s_list"});
|
519 |
|
|
|
520 |
|
|
print "\nModule/ID: $tmp_arb->{\"module\"}, $tmp_arb->{\"id\"}";
|
521 |
|
|
print "\nName: $tmp_arb->{\"name\"}";
|
522 |
|
|
print "\nMasters'list:\n(@arb_master_list)";
|
523 |
|
|
print "\nDefault master: $tmp_arb->{\"def\"}";
|
524 |
|
|
print "\nType of arbitration: ".$alg_list[$tmp_arb->{"alg"}];
|
525 |
|
|
print "\nSlaves'list:\n(@arb_slave_list)\n\n";
|
526 |
|
|
|
527 |
|
|
$cnt=0;
|
528 |
|
|
foreach $item (@arb_master_list) {
|
529 |
|
|
++$mst_list[$item];
|
530 |
|
|
if ($item==$tmp_arb->{"def"}) {$def_arb_mst=$cnt;}
|
531 |
|
|
$cnt++;
|
532 |
|
|
}
|
533 |
|
|
|
534 |
|
|
foreach $item (@arb_slave_list) {++$slv_list[$item];}
|
535 |
|
|
|
536 |
|
|
@gen_comp = (@gen_comp,"
|
537 |
|
|
$tmp_arb->{\"name\"}: $tmp_arb->{\"module\"}
|
538 |
|
|
generic map(
|
539 |
|
|
num_arb => $tmp_arb->{\"id\"},
|
540 |
|
|
num_arb_msts => $num_arb_msts,
|
541 |
|
|
num_slvs => ".($#arb_slave_list+1).",
|
542 |
|
|
def_arb_mst => $def_arb_mst,
|
543 |
|
|
alg_number => $tmp_arb->{\"alg\"})
|
544 |
|
|
port map(
|
545 |
|
|
hresetn => hresetn,
|
546 |
|
|
hclk => hclk,
|
547 |
|
|
remap => remap,
|
548 |
|
|
mst_in_v => mst_in_arb_$tmp_arb->{\"id\"}_v(".($num_arb_msts-1)." downto 0),
|
549 |
|
|
mst_out_v => mst_out_arb_$tmp_arb->{\"id\"}_v(".($num_arb_msts-1)." downto 0),
|
550 |
|
|
slv_in_v => slv_in_arb_$tmp_arb->{\"id\"}_v($#arb_slave_list downto 0),
|
551 |
|
|
slv_out_v => slv_out_arb_$tmp_arb->{\"id\"}_v($#arb_slave_list downto 0));
|
552 |
|
|
|
553 |
|
|
");
|
554 |
|
|
|
555 |
|
|
@gen_signal = (@gen_signal,
|
556 |
|
|
"signal mst_out_arb_$tmp_arb->{\"id\"}_v: mst_in_v_t(".($num_arb_msts-1)." downto 0);
|
557 |
|
|
signal mst_in_arb_$tmp_arb->{\"id\"}_v: mst_out_v_t(".($num_arb_msts-1)." downto 0);
|
558 |
|
|
signal slv_out_arb_$tmp_arb->{\"id\"}_v: slv_in_v_t($#arb_slave_list downto 0);
|
559 |
|
|
signal slv_in_arb_$tmp_arb->{\"id\"}_v: slv_out_v_t($#arb_slave_list downto 0);
|
560 |
|
|
");
|
561 |
|
|
|
562 |
|
|
$cnt = $#arb_master_list;
|
563 |
|
|
foreach $item (@arb_master_list){
|
564 |
|
|
@ass_signal = (@ass_signal, "ahb_mst_".$item."_in <= mst_out_arb_$tmp_arb->{\"id\"}_v($cnt);\n");
|
565 |
|
|
@ass_signal = (@ass_signal, "mst_in_arb_$tmp_arb->{\"id\"}_v($cnt) <= ahb_mst_".$item."_out;\n");
|
566 |
|
|
$cnt--;
|
567 |
|
|
}
|
568 |
|
|
|
569 |
|
|
$cnt = $#arb_slave_list;
|
570 |
|
|
foreach $item (@arb_slave_list){
|
571 |
|
|
@ass_signal = (@ass_signal, "ahb_slv_".$item."_in <= slv_out_arb_$tmp_arb->{\"id\"}_v($cnt);\n");
|
572 |
|
|
@ass_signal = (@ass_signal, "slv_in_arb_$tmp_arb->{\"id\"}_v($cnt) <= ahb_slv_".$item."_out;\n");
|
573 |
|
|
$cnt--;
|
574 |
|
|
}
|
575 |
|
|
}
|
576 |
|
|
|
577 |
|
|
|
578 |
|
|
sub gen_bridge
|
579 |
|
|
{
|
580 |
|
|
|
581 |
|
|
my $tmp_brg=shift(@_);
|
582 |
|
|
|
583 |
|
|
@brg_slave_list = split(' ',$tmp_brg->{"list"});
|
584 |
|
|
$def_brg_slv=$brg_slave_list[0];
|
585 |
|
|
$num_brg_slvs = $#brg_slave_list+1;
|
586 |
|
|
|
587 |
|
|
|
588 |
|
|
print "Module/ID: $tmp_brg->{\"module\"}, $tmp_brg->{\"id\"}";
|
589 |
|
|
print "\nName: $tmp_brg->{\"name\"}";
|
590 |
|
|
print "\nSlaves'list:\n(@brg_slave_list)";
|
591 |
|
|
print "\nDefault slave: $tmp_brg->{\"def\"}";
|
592 |
|
|
print "\nType of arbitration: ".$alg_list[$tmp_brg->{"alg"}];
|
593 |
|
|
print "\nMaster: $tmp_brg->{\"mst\"}\n\n";
|
594 |
|
|
|
595 |
|
|
|
596 |
|
|
--$mst_list[$tmp_brg->{"mst"}];
|
597 |
|
|
@gen_signal = (@gen_signal, "signal ahb_mst_$tmp_brg->{\"mst\"}_in: mst_in_t;\n");
|
598 |
|
|
@gen_signal = (@gen_signal, "signal ahb_mst_$tmp_brg->{\"mst\"}_out: mst_out_t;\n");
|
599 |
|
|
|
600 |
|
|
|
601 |
|
|
$cnt = 0;
|
602 |
|
|
foreach $item (@brg_slave_list) {
|
603 |
|
|
--$slv_list[$item];
|
604 |
|
|
@gen_signal = (@gen_signal, "signal ahb_slv_".$item."_in: slv_in_t;\n");
|
605 |
|
|
@gen_signal = (@gen_signal, "signal ahb_slv_".$item."_out: slv_out_t;\n");
|
606 |
|
|
if ($item==$tmp_brg->{"def"}) {$def_brg_slv=$cnt;}
|
607 |
|
|
$cnt++;
|
608 |
|
|
}
|
609 |
|
|
|
610 |
|
|
|
611 |
|
|
@gen_comp = (@gen_comp, "\n$tmp_brg->{\"name\"}: $tmp_brg->{\"module\"}\n");
|
612 |
|
|
@gen_comp = (@gen_comp, "generic map(\n");
|
613 |
|
|
@gen_comp = (@gen_comp, "num_brg => $tmp_brg->{\"id\"},\n");
|
614 |
|
|
@gen_comp = (@gen_comp, "num_brg_slvs => $num_brg_slvs,\n");
|
615 |
|
|
@gen_comp = (@gen_comp, "def_brg_slv => $def_brg_slv,\n");
|
616 |
|
|
@gen_comp = (@gen_comp, "alg_number => $tmp_brg->{\"alg\"})\n");
|
617 |
|
|
@gen_comp = (@gen_comp, "port map(\n");
|
618 |
|
|
@gen_comp = (@gen_comp, " hresetn => hresetn,\n");
|
619 |
|
|
@gen_comp = (@gen_comp, " hclk => hclk,\n");
|
620 |
|
|
@gen_comp = (@gen_comp, " remap => remap,\n");
|
621 |
|
|
@gen_comp = (@gen_comp, " slv_in_v => slv_in_brg_$tmp_brg->{\"id\"}_v($#brg_slave_list downto 0),\n");
|
622 |
|
|
@gen_comp = (@gen_comp, " slv_out_v => slv_out_brg_$tmp_brg->{\"id\"}_v($#brg_slave_list downto 0),\n");
|
623 |
|
|
@gen_comp = (@gen_comp, " mst_in => mst_in_brg_$tmp_brg->{\"id\"},\n");
|
624 |
|
|
@gen_comp = (@gen_comp, " mst_out => mst_out_brg_$tmp_brg->{\"id\"},\n");
|
625 |
|
|
@gen_comp = (@gen_comp, " slv_err => open,\n");
|
626 |
|
|
@gen_comp = (@gen_comp, " mst_err => open);\n");
|
627 |
|
|
@gen_comp = (@gen_comp, "\n\n");
|
628 |
|
|
|
629 |
|
|
@gen_signal = (@gen_signal, "signal mst_out_brg_$tmp_brg->{\"id\"}: mst_out_t;\n");
|
630 |
|
|
@gen_signal = (@gen_signal, "signal mst_in_brg_$tmp_brg->{\"id\"}: mst_in_t;\n");
|
631 |
|
|
@gen_signal = (@gen_signal, "signal slv_out_brg_$tmp_brg->{\"id\"}_v: slv_out_v_t($#brg_slave_list downto 0);\n");
|
632 |
|
|
@gen_signal = (@gen_signal, "signal slv_in_brg_$tmp_brg->{\"id\"}_v: slv_in_v_t($#brg_slave_list downto 0);\n");
|
633 |
|
|
|
634 |
|
|
@ass_signal = (@ass_signal, "ahb_mst_$tmp_brg->{\"mst\"}_out <= mst_out_brg_$tmp_brg->{\"id\"};\n");
|
635 |
|
|
@ass_signal = (@ass_signal, "mst_in_brg_$tmp_brg->{\"id\"} <= ahb_mst_$tmp_brg->{\"mst\"}_in;\n");
|
636 |
|
|
|
637 |
|
|
$cnt = $#brg_slave_list;
|
638 |
|
|
foreach $item (@brg_slave_list){
|
639 |
|
|
@ass_signal = (@ass_signal, "ahb_slv_".$item."_out <= slv_out_brg_$tmp_brg->{\"id\"}_v($cnt);\n");
|
640 |
|
|
@ass_signal = (@ass_signal, "slv_in_brg_$tmp_brg->{\"id\"}_v($cnt) <= ahb_slv_".$item."_in;\n");
|
641 |
|
|
$cnt--;
|
642 |
|
|
}
|
643 |
|
|
|
644 |
|
|
}
|
645 |
|
|
|
646 |
|
|
|
647 |
|
|
sub gen_apb
|
648 |
|
|
{
|
649 |
|
|
my $tmp_apb=shift(@_);
|
650 |
|
|
|
651 |
|
|
@apb_slave_list = split(' ',$tmp_apb->{"list"});
|
652 |
|
|
|
653 |
|
|
print "Module/ID: $tmp_apb->{\"module\"}, $tmp_apb->{\"id\"}";
|
654 |
|
|
print "\nName: $tmp_apb->{\"name\"}";
|
655 |
|
|
print "\nNumber of address bits to decode: $tmp_apb->{\"num_bits_addr\"}";
|
656 |
|
|
print "\nAHB Slave: $tmp_apb->{\"slv\"}";
|
657 |
|
|
print "\nSlaves'list:\n(@apb_slave_list)\n\n";
|
658 |
|
|
|
659 |
|
|
|
660 |
|
|
--$slv_list[$tmp_apb->{"slv"}];
|
661 |
|
|
@gen_signal = (@gen_signal, "signal ahb_slv_$tmp_apb->{\"slv\"}_in: slv_in_t;\n");
|
662 |
|
|
@gen_signal = (@gen_signal, "signal ahb_slv_$tmp_apb->{\"slv\"}_out: slv_out_t;\n");
|
663 |
|
|
|
664 |
|
|
|
665 |
|
|
@gen_comp = (@gen_comp, "$tmp_apb->{\"name\"}: $tmp_apb->{\"module\"}\n");
|
666 |
|
|
@gen_comp = (@gen_comp, "generic map(\n");
|
667 |
|
|
@gen_comp = (@gen_comp, "num_brg => $tmp_apb->{\"id\"},\n");
|
668 |
|
|
@gen_comp = (@gen_comp, "num_brg_slvs => ".($#apb_slave_list+1).",\n");
|
669 |
|
|
@gen_comp = (@gen_comp, "apb_max_addr => $tmp_apb->{\"num_bits_addr\"})\n");
|
670 |
|
|
@gen_comp = (@gen_comp, "port map(\n");
|
671 |
|
|
@gen_comp = (@gen_comp, " hresetn => hresetn,\n");
|
672 |
|
|
@gen_comp = (@gen_comp, " hclk => hclk,\n");
|
673 |
|
|
@gen_comp = (@gen_comp, " remap => remap,\n");
|
674 |
|
|
@gen_comp = (@gen_comp, " slv_in => slv_in_apb_$tmp_apb->{\"id\"},\n");
|
675 |
|
|
@gen_comp = (@gen_comp, " slv_out => slv_out_apb_$tmp_apb->{\"id\"},\n");
|
676 |
|
|
@gen_comp = (@gen_comp, " apb_mst_in => apb_slv_$tmp_apb->{\"id\"}_out_v(".($#apb_slave_list)." downto 0),\n");
|
677 |
|
|
@gen_comp = (@gen_comp, " apb_mst_out => apb_slv_$tmp_apb->{\"id\"}_in_v(".($#apb_slave_list)." downto 0));\n");
|
678 |
|
|
@gen_comp = (@gen_comp, "\n\n");
|
679 |
|
|
|
680 |
|
|
@gen_signal = (@gen_signal, "signal slv_in_apb_$tmp_apb->{\"id\"}: slv_in_t;\n");
|
681 |
|
|
@gen_signal = (@gen_signal, "signal slv_out_apb_$tmp_apb->{\"id\"}: slv_out_t;\n");
|
682 |
|
|
@gen_signal = (@gen_signal, "signal apb_slv_$tmp_apb->{\"id\"}_out_v: apb_out_v_t($#apb_slave_list downto 0);\n");
|
683 |
|
|
@gen_signal = (@gen_signal, "signal apb_slv_$tmp_apb->{\"id\"}_in_v: apb_in_v_t($#apb_slave_list downto 0);\n");
|
684 |
|
|
|
685 |
|
|
@ass_signal = (@ass_signal, "slv_in_apb_$tmp_apb->{\"id\"} <= ahb_slv_$tmp_apb->{\"slv\"}_in;\n");
|
686 |
|
|
@ass_signal = (@ass_signal, "ahb_slv_$tmp_apb->{\"slv\"}_out <= slv_out_apb_$tmp_apb->{\"id\"};\n");
|
687 |
|
|
|
688 |
|
|
$cnt = $#apb_slave_list;
|
689 |
|
|
foreach $item (@apb_slave_list){
|
690 |
|
|
@ass_signal = (@ass_signal, "apb_slv_$tmp_apb->{\"id\"}_out_v($cnt) <= apb_slv_${item}_out;\n");
|
691 |
|
|
@ass_signal = (@ass_signal, "apb_slv_${item}_in <= apb_slv_$tmp_apb->{\"id\"}_in_v($cnt);\n");
|
692 |
|
|
++$pslv_list[$item];
|
693 |
|
|
$cnt--;
|
694 |
|
|
}
|
695 |
|
|
}
|
696 |
|
|
|
697 |
|
|
sub gen_lib()
|
698 |
|
|
{
|
699 |
|
|
|
700 |
|
|
print file3 (
|
701 |
|
|
"
|
702 |
|
|
--*******************************************************************
|
703 |
|
|
--** ****
|
704 |
|
|
--** AHB system generator ****
|
705 |
|
|
--** ****
|
706 |
|
|
--** Author: Federico Aglietti ****
|
707 |
|
|
--** federico.aglietti\@opencores.org ****
|
708 |
|
|
--** ****
|
709 |
|
|
--*******************************************************************
|
710 |
|
|
--** ****
|
711 |
|
|
--** Copyright (C) 2004 Federico Aglietti ****
|
712 |
|
|
--** federico.aglietti\@opencores.org ****
|
713 |
|
|
--** ****
|
714 |
|
|
--** This source file may be used and distributed without ****
|
715 |
|
|
--** restriction provided that this copyright statement is not ****
|
716 |
|
|
--** removed from the file and that any derivative work contains ****
|
717 |
|
|
--** the original copyright notice and the associated disclaimer.****
|
718 |
|
|
--** ****
|
719 |
|
|
--** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ****
|
720 |
|
|
--** EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ****
|
721 |
|
|
--** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ****
|
722 |
|
|
--** FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ****
|
723 |
|
|
--** OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ****
|
724 |
|
|
--** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ****
|
725 |
|
|
--** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ****
|
726 |
|
|
--** GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ****
|
727 |
|
|
--** BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ****
|
728 |
|
|
--** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ****
|
729 |
|
|
--** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ****
|
730 |
|
|
--** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ****
|
731 |
|
|
--** POSSIBILITY OF SUCH DAMAGE. ****
|
732 |
|
|
--** ****
|
733 |
|
|
--*******************************************************************
|
734 |
|
|
library ieee;
|
735 |
|
|
use ieee.std_logic_arith.all;
|
736 |
|
|
use ieee.std_logic_misc.all;
|
737 |
|
|
use ieee.std_logic_unsigned.all;
|
738 |
|
|
use ieee.std_logic_1164.all;
|
739 |
|
|
|
740 |
|
|
use work.ahb_package.all;
|
741 |
|
|
use work.ahb_configure.all;
|
742 |
|
|
use work.ahb_components.all;
|
743 |
|
|
");
|
744 |
|
|
|
745 |
|
|
print file4 (
|
746 |
|
|
"
|
747 |
|
|
--*******************************************************************
|
748 |
|
|
--** ****
|
749 |
|
|
--** AHB system generator ****
|
750 |
|
|
--** ****
|
751 |
|
|
--** Author: Federico Aglietti ****
|
752 |
|
|
--** federico.aglietti\@opencores.org ****
|
753 |
|
|
--** ****
|
754 |
|
|
--*******************************************************************
|
755 |
|
|
--** ****
|
756 |
|
|
--** Copyright (C) 2004 Federico Aglietti ****
|
757 |
|
|
--** federico.aglietti\@opencores.org ****
|
758 |
|
|
--** ****
|
759 |
|
|
--** This source file may be used and distributed without ****
|
760 |
|
|
--** restriction provided that this copyright statement is not ****
|
761 |
|
|
--** removed from the file and that any derivative work contains ****
|
762 |
|
|
--** the original copyright notice and the associated disclaimer.****
|
763 |
|
|
--** ****
|
764 |
|
|
--** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ****
|
765 |
|
|
--** EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ****
|
766 |
|
|
--** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ****
|
767 |
|
|
--** FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ****
|
768 |
|
|
--** OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ****
|
769 |
|
|
--** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ****
|
770 |
|
|
--** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ****
|
771 |
|
|
--** GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ****
|
772 |
|
|
--** BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ****
|
773 |
|
|
--** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ****
|
774 |
|
|
--** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ****
|
775 |
|
|
--** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ****
|
776 |
|
|
--** POSSIBILITY OF SUCH DAMAGE. ****
|
777 |
|
|
--** ****
|
778 |
|
|
--*******************************************************************
|
779 |
|
|
library ieee;
|
780 |
|
|
use ieee.std_logic_arith.all;
|
781 |
|
|
use ieee.std_logic_misc.all;
|
782 |
|
|
use ieee.std_logic_unsigned.all;
|
783 |
|
|
use ieee.std_logic_1164.all;
|
784 |
|
|
use IEEE.std_logic_textio.all;
|
785 |
|
|
|
786 |
|
|
use work.ahb_package.all;
|
787 |
|
|
use work.ahb_configure.all;
|
788 |
|
|
use work.ahb_components.all;
|
789 |
|
|
");
|
790 |
|
|
|
791 |
|
|
print file5 (
|
792 |
|
|
"
|
793 |
|
|
--*******************************************************************
|
794 |
|
|
--** ****
|
795 |
|
|
--** AHB system generator ****
|
796 |
|
|
--** ****
|
797 |
|
|
--** Author: Federico Aglietti ****
|
798 |
|
|
--** federico.aglietti\@opencores.org ****
|
799 |
|
|
--** ****
|
800 |
|
|
--*******************************************************************
|
801 |
|
|
--** ****
|
802 |
|
|
--** Copyright (C) 2004 Federico Aglietti ****
|
803 |
|
|
--** federico.aglietti\@opencores.org ****
|
804 |
|
|
--** ****
|
805 |
|
|
--** This source file may be used and distributed without ****
|
806 |
|
|
--** restriction provided that this copyright statement is not ****
|
807 |
|
|
--** removed from the file and that any derivative work contains ****
|
808 |
|
|
--** the original copyright notice and the associated disclaimer.****
|
809 |
|
|
--** ****
|
810 |
|
|
--** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ****
|
811 |
|
|
--** EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ****
|
812 |
|
|
--** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ****
|
813 |
|
|
--** FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ****
|
814 |
|
|
--** OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ****
|
815 |
|
|
--** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ****
|
816 |
|
|
--** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ****
|
817 |
|
|
--** GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ****
|
818 |
|
|
--** BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ****
|
819 |
|
|
--** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ****
|
820 |
|
|
--** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ****
|
821 |
|
|
--** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ****
|
822 |
|
|
--** POSSIBILITY OF SUCH DAMAGE. ****
|
823 |
|
|
--** ****
|
824 |
|
|
--*******************************************************************
|
825 |
|
|
library ieee;
|
826 |
|
|
use ieee.std_logic_arith.all;
|
827 |
|
|
use ieee.std_logic_misc.all;
|
828 |
|
|
use ieee.std_logic_unsigned.all;
|
829 |
|
|
use ieee.std_logic_1164.all;
|
830 |
|
|
use IEEE.std_logic_textio.all;
|
831 |
|
|
|
832 |
|
|
use work.ahb_package.all;
|
833 |
|
|
use work.ahb_configure.all;
|
834 |
|
|
use work.ahb_components.all;
|
835 |
|
|
");
|
836 |
|
|
|
837 |
|
|
}
|
838 |
|
|
|
839 |
|
|
sub gen_ent()
|
840 |
|
|
{
|
841 |
|
|
print file3 ("
|
842 |
|
|
entity ahb_matrix is
|
843 |
|
|
port(
|
844 |
|
|
hresetn: in std_logic;
|
845 |
|
|
hclk: in std_logic;
|
846 |
|
|
");
|
847 |
|
|
$cnt=0;
|
848 |
|
|
foreach $item (@mst_list){
|
849 |
|
|
if ($item > 0) {
|
850 |
|
|
print file3 ("
|
851 |
|
|
ahb_mst_${cnt}_out: in mst_out_t;
|
852 |
|
|
ahb_mst_${cnt}_in: out mst_in_t;
|
853 |
|
|
");
|
854 |
|
|
@gen_ahb_signal = (@gen_ahb_signal, "
|
855 |
|
|
signal ahb_mst_${cnt}_out: mst_out_t;
|
856 |
|
|
signal ahb_mst_${cnt}_in: mst_in_t;
|
857 |
|
|
");
|
858 |
|
|
};
|
859 |
|
|
$cnt++;
|
860 |
|
|
};
|
861 |
|
|
$cnt=0;
|
862 |
|
|
foreach $item (@slv_list){
|
863 |
|
|
if ($item > 0) {
|
864 |
|
|
print file3 ("
|
865 |
|
|
ahb_slv_${cnt}_out: in slv_out_t;
|
866 |
|
|
ahb_slv_${cnt}_in: out slv_in_t;
|
867 |
|
|
");
|
868 |
|
|
@gen_ahb_signal = (@gen_ahb_signal, "
|
869 |
|
|
signal ahb_slv_${cnt}_out: slv_out_t;
|
870 |
|
|
signal ahb_slv_${cnt}_in: slv_in_t;
|
871 |
|
|
");
|
872 |
|
|
};
|
873 |
|
|
$cnt++;
|
874 |
|
|
};
|
875 |
|
|
$cnt=0;
|
876 |
|
|
foreach $item (@pslv_list){
|
877 |
|
|
if ($item > 0) {
|
878 |
|
|
print file3 ("
|
879 |
|
|
apb_slv_${cnt}_out: in apb_out_t;
|
880 |
|
|
apb_slv_${cnt}_in: out apb_in_t;
|
881 |
|
|
");
|
882 |
|
|
@gen_ahb_signal = (@gen_ahb_signal, "
|
883 |
|
|
signal apb_slv_${cnt}_out: apb_out_t;
|
884 |
|
|
signal apb_slv_${cnt}_in: apb_in_t;
|
885 |
|
|
");
|
886 |
|
|
};
|
887 |
|
|
$cnt++;
|
888 |
|
|
};
|
889 |
|
|
print file3 ("
|
890 |
|
|
remap: in std_logic
|
891 |
|
|
);
|
892 |
|
|
end;
|
893 |
|
|
|
894 |
|
|
architecture rtl of ahb_matrix is
|
895 |
|
|
|
896 |
|
|
");
|
897 |
|
|
|
898 |
|
|
print file4 ("
|
899 |
|
|
entity ahb_system is
|
900 |
|
|
port(
|
901 |
|
|
hresetn: in std_logic;
|
902 |
|
|
hclk: in std_logic;
|
903 |
|
|
|
904 |
|
|
eot_int: out std_logic_vector($masters downto 0);
|
905 |
|
|
conf: in conf_type_v($masters downto 0);
|
906 |
|
|
|
907 |
|
|
remap: in std_logic
|
908 |
|
|
);
|
909 |
|
|
end;
|
910 |
|
|
|
911 |
|
|
architecture rtl of ahb_system is
|
912 |
|
|
|
913 |
|
|
|
914 |
|
|
");
|
915 |
|
|
|
916 |
|
|
print file5 ("
|
917 |
|
|
entity ahb_tb is
|
918 |
|
|
end;
|
919 |
|
|
|
920 |
|
|
architecture rtl of ahb_tb is
|
921 |
|
|
|
922 |
|
|
|
923 |
|
|
");
|
924 |
|
|
|
925 |
|
|
}
|
926 |
|
|
|
927 |
|
|
sub gen_arrays {
|
928 |
|
|
|
929 |
|
|
@gen_conf = "
|
930 |
|
|
library ieee;
|
931 |
|
|
|
932 |
|
|
use ieee.std_logic_1164.all;
|
933 |
|
|
use ieee.std_logic_arith.all;
|
934 |
|
|
use work.ahb_package.all;
|
935 |
|
|
|
936 |
|
|
package ahb_configure is
|
937 |
|
|
|
938 |
|
|
--***************************************************************
|
939 |
|
|
-- definition of custom amba system parameters
|
940 |
|
|
--***************************************************************
|
941 |
|
|
|
942 |
|
|
--***************************************************************
|
943 |
|
|
-- AMBA SLAVES address configuration space
|
944 |
|
|
--***************************************************************
|
945 |
|
|
--For every slave define HIGH and LOW address, before and after (r)emap
|
946 |
|
|
|
947 |
|
|
constant n_u: addr_t := (0, 0);\n\n";
|
948 |
|
|
|
949 |
|
|
|
950 |
|
|
#### PERIPHERAL SLAVES
|
951 |
|
|
|
952 |
|
|
for $i (0 .. $pslaves) {@gen_conf = (@gen_conf, "constant $pslave[$i]->{\"name\"}: addr_t := ($pslave[$i]->{\"add_h\"}, $pslave[$i]->{add_l});\n");}
|
953 |
|
|
for $i (0 .. $pslaves) {@gen_conf = (@gen_conf, "constant r$pslave[$i]->{\"name\"}: addr_t := ($pslave[$i]->{\"add_hh\"}, $pslave[$i]->{add_ll});\n");}
|
954 |
|
|
|
955 |
|
|
#### PERIPHERAL SLAVES ARRAY
|
956 |
|
|
|
957 |
|
|
for $i (0 .. 15) {
|
958 |
|
|
if ($i <= $pslaves) {$tmp_mat[$i] = ("r$pslave[$i]->{\"name\"}");} else {$tmp_mat[$i] = ("n_u");};
|
959 |
|
|
};
|
960 |
|
|
|
961 |
|
|
@gen_conf = (@gen_conf, "\nconstant pslv_matrix: addr_matrix_t(1 downto 0) := (\n(");
|
962 |
|
|
$i=15;
|
963 |
|
|
while ($i > 0) {@gen_conf = (@gen_conf, "$tmp_mat[$i],");$i--;}
|
964 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[0]),\n(");
|
965 |
|
|
|
966 |
|
|
for $i (0 .. 15) {
|
967 |
|
|
if ($i <= $pslaves) {$tmp_mat[$i] = ("$pslave[$i]->{\"name\"}");} else {$tmp_mat[$i] = ("n_u");};
|
968 |
|
|
};
|
969 |
|
|
|
970 |
|
|
$i=15;
|
971 |
|
|
while ($i > 0) {@gen_conf = (@gen_conf, "$tmp_mat[$i],");$i--;}
|
972 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[0]));\n\n");
|
973 |
|
|
|
974 |
|
|
#### SLAVES
|
975 |
|
|
|
976 |
|
|
for $i (0 .. $slaves) {@gen_conf = (@gen_conf, "constant $slave[$i]->{\"name\"}: addr_t := ($slave[$i]->{\"add_h\"}, $slave[$i]->{add_l});\n");}
|
977 |
|
|
for $i (0 .. $slaves) {@gen_conf = (@gen_conf, "constant r$slave[$i]->{\"name\"}: addr_t := ($slave[$i]->{\"add_hh\"}, $slave[$i]->{add_ll});\n");}
|
978 |
|
|
|
979 |
|
|
#### SLAVES ARRAY
|
980 |
|
|
|
981 |
|
|
for $i (0 .. 15) {
|
982 |
|
|
if ($i <= $slaves) {
|
983 |
|
|
$tmp_mat[$i] = ("r$slave[$i]->{\"name\"}");
|
984 |
|
|
} else {
|
985 |
|
|
$tmp_mat[$i] = ("n_u");
|
986 |
|
|
};
|
987 |
|
|
};
|
988 |
|
|
|
989 |
|
|
@gen_conf = (@gen_conf, "\nconstant slv_matrix: addr_matrix_t(1 downto 0) := (\n(");
|
990 |
|
|
$i=15;
|
991 |
|
|
while ($i > 0) {@gen_conf = (@gen_conf, "$tmp_mat[$i],");$i--;}
|
992 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[0]),\n(");
|
993 |
|
|
|
994 |
|
|
for $i (0 .. 15) {
|
995 |
|
|
if ($i <= $slaves) {
|
996 |
|
|
$tmp_mat[$i] = ("$slave[$i]->{\"name\"}");
|
997 |
|
|
} else {
|
998 |
|
|
$tmp_mat[$i] = ("n_u");
|
999 |
|
|
};
|
1000 |
|
|
};
|
1001 |
|
|
|
1002 |
|
|
$i=15;
|
1003 |
|
|
while ($i > 0) {@gen_conf = (@gen_conf, "$tmp_mat[$i],");$i--;}
|
1004 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[0]));\n\n");
|
1005 |
|
|
|
1006 |
|
|
|
1007 |
|
|
#### AHB ARBITERS ARRAY
|
1008 |
|
|
|
1009 |
|
|
if ($arbs>0) {
|
1010 |
|
|
@gen_conf = (@gen_conf, "constant arb_matrix: addr_matrix_t($arbs downto 0):= (\n");
|
1011 |
|
|
@gen_signal = (@gen_signal, "signal addr_arb_matrix: addr_matrix_t($arbs downto 0);\n");
|
1012 |
|
|
} elsif ($arbs==0) {
|
1013 |
|
|
@gen_conf = (@gen_conf, "constant arb_matrix: addr_matrix_t(1 downto 0):= (\n");
|
1014 |
|
|
@gen_signal = (@gen_signal, "signal addr_arb_matrix: addr_matrix_t($arbs downto 0);\n");
|
1015 |
|
|
}
|
1016 |
|
|
|
1017 |
|
|
|
1018 |
|
|
if ($arbs==0) {
|
1019 |
|
|
@arb_slave_list = split(' ',$arb[$0]->{"s_list"});
|
1020 |
|
|
$j=15;
|
1021 |
|
|
while ($j>$#arb_slave_list) {$tmp_mat[$j] = ("n_u");$j--;}
|
1022 |
|
|
while ($j>=0) {$tmp_mat[$j] = ("ahb_slv".shift(@arb_slave_list));$j--;}
|
1023 |
|
|
|
1024 |
|
|
$j=15;
|
1025 |
|
|
@gen_conf = (@gen_conf, "(");
|
1026 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1027 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[$0]),\n");
|
1028 |
|
|
$j=15;
|
1029 |
|
|
@gen_conf = (@gen_conf, "(");
|
1030 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1031 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[$0]\)\);\n\n");
|
1032 |
|
|
|
1033 |
|
|
} else {
|
1034 |
|
|
|
1035 |
|
|
$i=$arbs;
|
1036 |
|
|
while ($i>=0) {
|
1037 |
|
|
@arb_slave_list = split(' ',$arb[$i]->{"s_list"});
|
1038 |
|
|
$j=15;
|
1039 |
|
|
while ($j>$#arb_slave_list) {$tmp_mat[$j] = ("n_u");$j--;}
|
1040 |
|
|
while ($j>=0) {$tmp_mat[$j] = ("ahb_slv".shift(@arb_slave_list));$j--;}
|
1041 |
|
|
|
1042 |
|
|
$j=15;
|
1043 |
|
|
@gen_conf = (@gen_conf, "(");
|
1044 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1045 |
|
|
|
1046 |
|
|
if ($i==0) {@gen_conf = (@gen_conf, "$tmp_mat[$0]));\n\n");}
|
1047 |
|
|
else {@gen_conf = (@gen_conf, "$tmp_mat[$0]),\n");}
|
1048 |
|
|
|
1049 |
|
|
$i--;
|
1050 |
|
|
};
|
1051 |
|
|
};
|
1052 |
|
|
|
1053 |
|
|
|
1054 |
|
|
if ($arbs>0) {
|
1055 |
|
|
@gen_conf = (@gen_conf, "constant rarb_matrix: addr_matrix_t($arbs downto 0):= (\n");
|
1056 |
|
|
} elsif ($arbs==0) {
|
1057 |
|
|
@gen_conf = (@gen_conf, "constant rarb_matrix: addr_matrix_t(1 downto 0):= (\n");
|
1058 |
|
|
};
|
1059 |
|
|
|
1060 |
|
|
|
1061 |
|
|
if ($arbs==0) {
|
1062 |
|
|
@arb_slave_list = split(' ',$arb[$0]->{"s_list"});
|
1063 |
|
|
$j=15;
|
1064 |
|
|
while ($j>$#arb_slave_list) {$tmp_mat[$j] = ("n_u");$j--;}
|
1065 |
|
|
while ($j>=0) {$tmp_mat[$j] = ("rahb_slv".shift(@arb_slave_list));$j--;}
|
1066 |
|
|
|
1067 |
|
|
$j=15;
|
1068 |
|
|
@gen_conf = (@gen_conf, "(");
|
1069 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1070 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[$0]),\n");
|
1071 |
|
|
$j=15;
|
1072 |
|
|
@gen_conf = (@gen_conf, "(");
|
1073 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1074 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[$0]\)\);\n\n");
|
1075 |
|
|
|
1076 |
|
|
} else {
|
1077 |
|
|
|
1078 |
|
|
$i=$arbs;
|
1079 |
|
|
while ($i>=0) {
|
1080 |
|
|
|
1081 |
|
|
@arb_slave_list = split(' ',$arb[$i]->{"s_list"});
|
1082 |
|
|
$j=15;
|
1083 |
|
|
while ($j>$#arb_slave_list) {$tmp_mat[$j] = ("n_u");$j--;}
|
1084 |
|
|
while ($j>=0) {$tmp_mat[$j] = ("rahb_slv".shift(@arb_slave_list));$j--;}
|
1085 |
|
|
|
1086 |
|
|
$j=15;
|
1087 |
|
|
@gen_conf = (@gen_conf, "(");
|
1088 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1089 |
|
|
|
1090 |
|
|
if ($i==0) {@gen_conf = (@gen_conf, "$tmp_mat[$0]));\n\n");}
|
1091 |
|
|
else {@gen_conf = (@gen_conf, "$tmp_mat[$0]),\n");}
|
1092 |
|
|
|
1093 |
|
|
$i--;
|
1094 |
|
|
}
|
1095 |
|
|
}
|
1096 |
|
|
|
1097 |
|
|
|
1098 |
|
|
|
1099 |
|
|
#### AHB-AHB BRIDGES ARRAY
|
1100 |
|
|
|
1101 |
|
|
if ($ahbs>0) {
|
1102 |
|
|
@gen_conf = (@gen_conf, "constant ahbbrg_matrix: addr_matrix_t($ahbs downto 0):= (\n");
|
1103 |
|
|
@gen_signal = (@gen_signal, "signal addr_ahbbrg_matrix: addr_matrix_t($ahbs downto 0);\n");
|
1104 |
|
|
} elsif ($ahbs==0) {
|
1105 |
|
|
@gen_conf = (@gen_conf, "constant ahbbrg_matrix: addr_matrix_t(1 downto 0):= (\n");
|
1106 |
|
|
@gen_signal = (@gen_signal, "signal addr_ahbbrg_matrix: addr_matrix_t(1 downto 0);\n");
|
1107 |
|
|
} else {
|
1108 |
|
|
@gen_conf = (@gen_conf,
|
1109 |
|
|
"constant ahbbrg_matrix: addr_matrix_t(1 downto 0) := (
|
1110 |
|
|
(n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u),
|
1111 |
|
|
(n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u));
|
1112 |
|
|
|
1113 |
|
|
constant rahbbrg_matrix: addr_matrix_t(1 downto 0) := (
|
1114 |
|
|
(n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u),
|
1115 |
|
|
(n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u));
|
1116 |
|
|
|
1117 |
|
|
");
|
1118 |
|
|
@gen_signal = (@gen_signal, "signal addr_ahbbrg_matrix: addr_matrix_t(1 downto 0);\n");
|
1119 |
|
|
}
|
1120 |
|
|
|
1121 |
|
|
if ($ahbs==0) {
|
1122 |
|
|
|
1123 |
|
|
@brg_slave_list = split(' ',$ahb[$0]->{"list"});
|
1124 |
|
|
$j=15;
|
1125 |
|
|
while ($j>$#brg_slave_list) {$tmp_mat[$j] = ("n_u");$j--;}
|
1126 |
|
|
while ($j>=0) {$tmp_mat[$j] = ("ahb_slv".shift(@brg_slave_list));$j--;}
|
1127 |
|
|
|
1128 |
|
|
$j=15;
|
1129 |
|
|
@gen_conf = (@gen_conf, "(");
|
1130 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1131 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[$0]),\n");
|
1132 |
|
|
$j=15;
|
1133 |
|
|
@gen_conf = (@gen_conf, "(");
|
1134 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1135 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[$0]\)\);\n\n");
|
1136 |
|
|
|
1137 |
|
|
} else {
|
1138 |
|
|
|
1139 |
|
|
$i=$ahbs;
|
1140 |
|
|
while ($i>=0) {
|
1141 |
|
|
|
1142 |
|
|
@brg_slave_list = split(' ',$ahb[$i]->{"list"});
|
1143 |
|
|
$j=15;
|
1144 |
|
|
while ($j>$#brg_slave_list) {$tmp_mat[$j] = ("n_u");$j--;}
|
1145 |
|
|
while ($j>=0) {$tmp_mat[$j] = ("ahb_slv".shift(@brg_slave_list));$j--;}
|
1146 |
|
|
|
1147 |
|
|
$j=15;
|
1148 |
|
|
@gen_conf = (@gen_conf, "(");
|
1149 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1150 |
|
|
|
1151 |
|
|
if ($i==0) {@gen_conf = (@gen_conf, "$tmp_mat[$0]));\n\n");}
|
1152 |
|
|
else {@gen_conf = (@gen_conf, "$tmp_mat[$0]),\n");}
|
1153 |
|
|
|
1154 |
|
|
$i--;
|
1155 |
|
|
};
|
1156 |
|
|
}
|
1157 |
|
|
|
1158 |
|
|
if ($ahbs>0) {
|
1159 |
|
|
@gen_conf = (@gen_conf, "constant rahbbrg_matrix: addr_matrix_t($ahbs downto 0):= (\n");
|
1160 |
|
|
} elsif ($ahbs==0) {
|
1161 |
|
|
@gen_conf = (@gen_conf, "constant rahbbrg_matrix: addr_matrix_t(1 downto 0):= (\n");
|
1162 |
|
|
};
|
1163 |
|
|
|
1164 |
|
|
if ($ahbs==0) {
|
1165 |
|
|
|
1166 |
|
|
@brg_slave_list = split(' ',$ahb[$0]->{"list"});
|
1167 |
|
|
$j=15;
|
1168 |
|
|
while ($j>$#brg_slave_list) {$tmp_mat[$j] = ("n_u");$j--;}
|
1169 |
|
|
while ($j>=0) {$tmp_mat[$j] = ("rahb_slv".shift(@brg_slave_list));$j--;}
|
1170 |
|
|
|
1171 |
|
|
$j=15;
|
1172 |
|
|
@gen_conf = (@gen_conf, "(");
|
1173 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1174 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[$0]),\n");
|
1175 |
|
|
$j=15;
|
1176 |
|
|
@gen_conf = (@gen_conf, "(");
|
1177 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1178 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[$0]\)\);\n\n");
|
1179 |
|
|
|
1180 |
|
|
} else {
|
1181 |
|
|
|
1182 |
|
|
$i=$ahbs;
|
1183 |
|
|
while ($i>=0) {
|
1184 |
|
|
|
1185 |
|
|
@brg_slave_list = split(' ',$ahb[$i]->{"list"});
|
1186 |
|
|
$j=15;
|
1187 |
|
|
while ($j>$#brg_slave_list) {$tmp_mat[$j] = ("n_u");$j--;}
|
1188 |
|
|
while ($j>=0) {$tmp_mat[$j] = ("rahb_slv".shift(@brg_slave_list));$j--;}
|
1189 |
|
|
|
1190 |
|
|
$j=15;
|
1191 |
|
|
@gen_conf = (@gen_conf, "(");
|
1192 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1193 |
|
|
|
1194 |
|
|
if ($i==0) {@gen_conf = (@gen_conf, "$tmp_mat[$0]));\n\n");}
|
1195 |
|
|
else {@gen_conf = (@gen_conf, "$tmp_mat[$0]),\n");}
|
1196 |
|
|
|
1197 |
|
|
$i--;
|
1198 |
|
|
};
|
1199 |
|
|
};
|
1200 |
|
|
|
1201 |
|
|
#### APB BRIDGES ARRAY
|
1202 |
|
|
|
1203 |
|
|
if ($apbs>0) {
|
1204 |
|
|
@gen_conf = (@gen_conf, "constant apbbrg_matrix: addr_matrix_t($apbs downto 0):= (\n");
|
1205 |
|
|
@gen_signal = (@gen_signal, "signal addr_apbbrg_matrix: addr_matrix_t($apbs downto 0);\n");
|
1206 |
|
|
} elsif ($apbs==0) {
|
1207 |
|
|
@gen_conf = (@gen_conf, "constant apbbrg_matrix: addr_matrix_t(1 downto 0):= (\n");
|
1208 |
|
|
@gen_signal = (@gen_signal, "signal addr_apbbrg_matrix: addr_matrix_t(1 downto 0);\n");
|
1209 |
|
|
} else {
|
1210 |
|
|
@gen_conf = (@gen_conf,
|
1211 |
|
|
"constant apbbrg_matrix: addr_matrix_t(1 downto 0) := (
|
1212 |
|
|
(n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u),
|
1213 |
|
|
(n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u));
|
1214 |
|
|
|
1215 |
|
|
constant rapbbrg_matrix: addr_matrix_t(1 downto 0) := (
|
1216 |
|
|
(n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u),
|
1217 |
|
|
(n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u,n_u));
|
1218 |
|
|
|
1219 |
|
|
");
|
1220 |
|
|
@gen_signal = (@gen_signal, "signal addr_apbbrg_matrix: addr_matrix_t(1 downto 0);\n");
|
1221 |
|
|
};
|
1222 |
|
|
|
1223 |
|
|
if ($apbs==0) {
|
1224 |
|
|
|
1225 |
|
|
@apb_slave_list = split(' ',$apb[$0]->{"list"});
|
1226 |
|
|
$j=15;
|
1227 |
|
|
while ($j>$#apb_slave_list) {$tmp_mat[$j] = ("n_u");$j--;}
|
1228 |
|
|
while ($j>=0) {$tmp_mat[$j] = ("apb_slv".shift(@apb_slave_list));$j--;}
|
1229 |
|
|
|
1230 |
|
|
$j=15;
|
1231 |
|
|
@gen_conf = (@gen_conf, "(");
|
1232 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1233 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[$0]),\n");
|
1234 |
|
|
$j=15;
|
1235 |
|
|
@gen_conf = (@gen_conf, "(");
|
1236 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1237 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[$0]\)\);\n\n");
|
1238 |
|
|
|
1239 |
|
|
} elsif ($apbs>0) {
|
1240 |
|
|
|
1241 |
|
|
$i=$apbs;
|
1242 |
|
|
while ($i>=0) {
|
1243 |
|
|
|
1244 |
|
|
@apb_slave_list = split(' ',$apb[$i]->{"list"});
|
1245 |
|
|
$j=15;
|
1246 |
|
|
while ($j>$#apb_slave_list) {$tmp_mat[$j] = ("n_u");$j--;}
|
1247 |
|
|
while ($j>=0) {$tmp_mat[$j] = ("apb_slv".shift(@apb_slave_list));$j--;}
|
1248 |
|
|
|
1249 |
|
|
$j=15;
|
1250 |
|
|
@gen_conf = (@gen_conf, "(");
|
1251 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1252 |
|
|
|
1253 |
|
|
if ($i==0) {@gen_conf = (@gen_conf, "$tmp_mat[$0]));\n\n");}
|
1254 |
|
|
else {@gen_conf = (@gen_conf, "$tmp_mat[$0]),\n");}
|
1255 |
|
|
|
1256 |
|
|
$i--;
|
1257 |
|
|
};
|
1258 |
|
|
} else {
|
1259 |
|
|
;
|
1260 |
|
|
};
|
1261 |
|
|
|
1262 |
|
|
if ($apbs>0) {
|
1263 |
|
|
@gen_conf = (@gen_conf, "constant rapbbrg_matrix: addr_matrix_t($apbs downto 0):= (\n");
|
1264 |
|
|
} elsif ($apbs==0) {
|
1265 |
|
|
@gen_conf = (@gen_conf, "constant rapbbrg_matrix: addr_matrix_t(1 downto 0):= (\n");
|
1266 |
|
|
};
|
1267 |
|
|
|
1268 |
|
|
if ($apbs==0) {
|
1269 |
|
|
|
1270 |
|
|
@apb_slave_list = split(' ',$apb[$0]->{"list"});
|
1271 |
|
|
$j=15;
|
1272 |
|
|
while ($j>$#apb_slave_list) {$tmp_mat[$j] = ("n_u");$j--;}
|
1273 |
|
|
while ($j>=0) {$tmp_mat[$j] = ("rapb_slv".shift(@apb_slave_list));$j--;}
|
1274 |
|
|
|
1275 |
|
|
$j=15;
|
1276 |
|
|
@gen_conf = (@gen_conf, "(");
|
1277 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1278 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[$0]),\n");
|
1279 |
|
|
$j=15;
|
1280 |
|
|
@gen_conf = (@gen_conf, "(");
|
1281 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1282 |
|
|
@gen_conf = (@gen_conf, "$tmp_mat[$0]\)\);\n\n");
|
1283 |
|
|
|
1284 |
|
|
} elsif ($apbs>0) {
|
1285 |
|
|
|
1286 |
|
|
$i=$apbs;
|
1287 |
|
|
while ($i>=0) {
|
1288 |
|
|
|
1289 |
|
|
@apb_slave_list = split(' ',$apb[$i]->{"list"});
|
1290 |
|
|
$j=15;
|
1291 |
|
|
while ($j>$#apb_slave_list) {$tmp_mat[$j] = ("n_u");$j--;}
|
1292 |
|
|
while ($j>=0) {$tmp_mat[$j] = ("rapb_slv".shift(@apb_slave_list));$j--;}
|
1293 |
|
|
|
1294 |
|
|
$j=15;
|
1295 |
|
|
@gen_conf = (@gen_conf, "(");
|
1296 |
|
|
while ($j>0) {@gen_conf = (@gen_conf, "$tmp_mat[$j],");$j--;}
|
1297 |
|
|
|
1298 |
|
|
if ($i==0) {@gen_conf = (@gen_conf, "$tmp_mat[$0]));\n\n");}
|
1299 |
|
|
else {@gen_conf = (@gen_conf, "$tmp_mat[$0]),\n");}
|
1300 |
|
|
|
1301 |
|
|
$i--;
|
1302 |
|
|
};
|
1303 |
|
|
} else {
|
1304 |
|
|
;
|
1305 |
|
|
};
|
1306 |
|
|
#### END OF FILE
|
1307 |
|
|
|
1308 |
|
|
@gen_conf = (@gen_conf,"
|
1309 |
|
|
|
1310 |
|
|
end;
|
1311 |
|
|
|
1312 |
|
|
package body ahb_configure is
|
1313 |
|
|
end;
|
1314 |
|
|
|
1315 |
|
|
");
|
1316 |
|
|
|
1317 |
|
|
};
|
1318 |
|
|
|
1319 |
|
|
sub master_init {
|
1320 |
|
|
$masters += 1;
|
1321 |
|
|
$master[$masters]{"module"}='ahb_master';
|
1322 |
|
|
$master[$masters]{"name"}='ahb_mst'.$masters;
|
1323 |
|
|
$master[$masters]{"id"}=$masters;
|
1324 |
|
|
$master[$masters]{"fifo_ln"}='8';
|
1325 |
|
|
$master[$masters]{"fifo_he"}='1';
|
1326 |
|
|
$master[$masters]{"fifo_hf"}='7';
|
1327 |
|
|
$master[$masters]{"num_bits_addr"}='4';
|
1328 |
|
|
$master[$masters]{"write_burst"}='0';
|
1329 |
|
|
$master[$masters]{"read_burst"}='0';
|
1330 |
|
|
$master[$masters]{"write_lat"}='2';
|
1331 |
|
|
$master[$masters]{"read_lat"}='2';
|
1332 |
|
|
|
1333 |
|
|
$uut[$masters]{"base_addr"}='2048';
|
1334 |
|
|
};
|
1335 |
|
|
|
1336 |
|
|
sub slave_init {
|
1337 |
|
|
$slaves += 1;
|
1338 |
|
|
$slave[$slaves]{"module"}='ahb_slave';
|
1339 |
|
|
$slave[$slaves]{"name"}='ahb_slv'.$slaves;
|
1340 |
|
|
$slave[$slaves]{"list"}=('SLAVE_LIST');
|
1341 |
|
|
$slave[$slaves]{"id"}=$slaves;
|
1342 |
|
|
$slave[$slaves]{"type"}='wait';
|
1343 |
|
|
$slave[$slaves]{"add_h"}='0';
|
1344 |
|
|
$slave[$slaves]{"add_l"}='0';
|
1345 |
|
|
$slave[$slaves]{"add_hh"}='0';
|
1346 |
|
|
$slave[$slaves]{"add_ll"}='0';
|
1347 |
|
|
$slave[$slaves]{"alg"}=0;
|
1348 |
|
|
$slave[$slaves]{"fifo_ln"}='8';
|
1349 |
|
|
$slave[$slaves]{"fifo_he"}='1';
|
1350 |
|
|
$slave[$slaves]{"fifo_hf"}='7';
|
1351 |
|
|
$slave[$slaves]{"num_bits_addr"}='4';
|
1352 |
|
|
$slave[$slaves]{"write_burst"}='0';
|
1353 |
|
|
$slave[$slaves]{"read_burst"}='0';
|
1354 |
|
|
$slave[$slaves]{"write_lat"}='2';
|
1355 |
|
|
$slave[$slaves]{"read_lat"}='2';
|
1356 |
|
|
};
|
1357 |
|
|
|
1358 |
|
|
sub pslave_init {
|
1359 |
|
|
$pslaves += 1;
|
1360 |
|
|
$pslave[$pslaves]{"module"}='apb_slave';
|
1361 |
|
|
$pslave[$pslaves]{"name"}='apb_slv'.$pslaves;
|
1362 |
|
|
$pslave[$pslaves]{"id"}=$pslaves;
|
1363 |
|
|
$pslave[$pslaves]{"add_h"}='0';
|
1364 |
|
|
$pslave[$pslaves]{"add_l"}='0';
|
1365 |
|
|
$pslave[$pslaves]{"add_hh"}='0';
|
1366 |
|
|
$pslave[$pslaves]{"add_ll"}='0';
|
1367 |
|
|
$pslave[$pslaves]{"num_bits_addr"}='4';
|
1368 |
|
|
};
|
1369 |
|
|
|
1370 |
|
|
sub arb_init {
|
1371 |
|
|
$arbs += 1;
|
1372 |
|
|
$arb[$arbs]{"module"}='ahb_arbiter';
|
1373 |
|
|
$arb[$arbs]{"name"}='ahb_arb'.$arbs;
|
1374 |
|
|
$arb[$arbs]{"id"}=$arbs;
|
1375 |
|
|
$arb[$arbs]{"def"}='DEFAULT_MASTER';
|
1376 |
|
|
$arb[$arbs]{"m_list"}=('MASTER_LIST');
|
1377 |
|
|
$arb[$arbs]{"s_list"}=('SLAVE_LIST');
|
1378 |
|
|
$arb[$arbs]{"alg"}=0;
|
1379 |
|
|
};
|
1380 |
|
|
|
1381 |
|
|
sub ahb_init {
|
1382 |
|
|
$ahbs += 1;
|
1383 |
|
|
$ahb[$ahbs]{"module"}='ahb_bridge';
|
1384 |
|
|
$ahb[$ahbs]{"name"}='ahb_brg'.$ahbs;
|
1385 |
|
|
$ahb[$ahbs]{"id"}=$ahbs;
|
1386 |
|
|
$ahb[$ahbs]{"alg"}=0;
|
1387 |
|
|
$ahb[$ahbs]{"def"}='DEFAULT_SLAVE';
|
1388 |
|
|
$ahb[$ahbs]{"list"}=('SLAVE_LIST');
|
1389 |
|
|
$ahb[$ahbs]{"mst"}='BRIDGE_MASTER';
|
1390 |
|
|
};
|
1391 |
|
|
|
1392 |
|
|
sub apb_init {
|
1393 |
|
|
$apbs += 1;
|
1394 |
|
|
$apb[$apbs]{"module"}='apb_bridge';
|
1395 |
|
|
$apb[$apbs]{"name"}='apb_brg'.$apbs;
|
1396 |
|
|
$apb[$apbs]{"id"}=$apbs;
|
1397 |
|
|
$apb[$apbs]{"num_bits_addr"}='4';
|
1398 |
|
|
$apb[$apbs]{"slv"}='BRIDGE_SLAVE';
|
1399 |
|
|
$apb[$apbs]{"list"}=('SLAVE_LIST');
|
1400 |
|
|
};
|
1401 |
|
|
|
1402 |
|
|
|
1403 |
|
|
# GUI FUNCTIONS
|
1404 |
|
|
|
1405 |
|
|
sub WinGlobalExit {
|
1406 |
|
|
$mw->destroy();
|
1407 |
|
|
};
|
1408 |
|
|
|
1409 |
|
|
|
1410 |
|
|
sub WinAddMaster {
|
1411 |
|
|
$state='WinGlobal';
|
1412 |
|
|
&master_init;
|
1413 |
|
|
|
1414 |
|
|
$mw = MainWindow->new;
|
1415 |
|
|
|
1416 |
|
|
$frame=$mw->Frame(-label=>"New AHB Master");
|
1417 |
|
|
# AHB Master
|
1418 |
|
|
$frame->pack(@pt);
|
1419 |
|
|
$frame->Label(-text => "AHB Master name: ")->pack(@pw);
|
1420 |
|
|
$frame->Entry(-textvariable => \$master[$masters]{"name"})->pack(@pe);
|
1421 |
|
|
|
1422 |
|
|
# id
|
1423 |
|
|
$frame=$mw->Frame();
|
1424 |
|
|
$frame->pack(@pt);
|
1425 |
|
|
$frame->Label(-text => "AHB Master number: ")->pack(@pw);
|
1426 |
|
|
$frame->Entry(-state => 'disabled', -textvariable => \$master[$masters]{"id"})->pack(@pe);
|
1427 |
|
|
|
1428 |
|
|
$frame=$mw->Frame(-label=>"AHB Master internal fifo");
|
1429 |
|
|
# fifo length
|
1430 |
|
|
$frame=$mw->Frame();
|
1431 |
|
|
$frame->pack(@pt);
|
1432 |
|
|
$frame->Label(-text => "Fifo length: ")->pack(@pw);
|
1433 |
|
|
$frame->Entry(-textvariable => \$master[$masters]{"fifo_ln"})->pack(@pe);
|
1434 |
|
|
$frame=$mw->Frame();
|
1435 |
|
|
# fifo half empty
|
1436 |
|
|
$frame=$mw->Frame();
|
1437 |
|
|
$frame->pack(@pt);
|
1438 |
|
|
$frame->Label(-text => "Fifo half-empty level: ")->pack(@pw);
|
1439 |
|
|
$frame->Entry(-textvariable => \$master[$masters]{"fifo_he"})->pack(@pe);
|
1440 |
|
|
$frame=$mw->Frame();
|
1441 |
|
|
# fifo half full
|
1442 |
|
|
$frame=$mw->Frame();
|
1443 |
|
|
$frame->pack(@pt);
|
1444 |
|
|
$frame->Label(-text => "Fifo half-full level: ")->pack(@pw);
|
1445 |
|
|
$frame->Entry(-textvariable => \$master[$masters]{"fifo_hf"})->pack(@pe);
|
1446 |
|
|
$frame=$mw->Frame();
|
1447 |
|
|
|
1448 |
|
|
# number of addressable bits
|
1449 |
|
|
$frame=$mw->Frame();
|
1450 |
|
|
$frame->pack(@pt);
|
1451 |
|
|
$frame->Label(-text => "Number of addr bits: ")->pack(@pw);
|
1452 |
|
|
$frame->Entry(-textvariable => \$master[$masters]{"num_bits_addr"})->pack(@pe);
|
1453 |
|
|
$frame=$mw->Frame();
|
1454 |
|
|
# burst capability in write
|
1455 |
|
|
$frame=$mw->Frame();
|
1456 |
|
|
$frame->pack(@pt);
|
1457 |
|
|
$frame->Label(-text => "Write burst capability: ")->pack(@pw);
|
1458 |
|
|
$a = $frame->Radiobutton ( -variable => \$master[$masters]{"write_burst"}, -text => 'YES', -value => '1')->pack(@pw);
|
1459 |
|
|
$b = $frame->Radiobutton ( -variable => \$master[$masters]{"write_burst"}, -text => 'NO', -value => '0')->pack(@pe);
|
1460 |
|
|
# burst capability in read
|
1461 |
|
|
$frame=$mw->Frame();
|
1462 |
|
|
$frame->pack(@pt);
|
1463 |
|
|
$frame->Label(-text => "Read burst capability: ")->pack(@pw);
|
1464 |
|
|
$c = $frame->Radiobutton ( -variable => \$master[$masters]{"read_burst"}, -text => 'YES', -value => '1')->pack(@pw);
|
1465 |
|
|
$d = $frame->Radiobutton ( -variable => \$master[$masters]{"read_burst"}, -text => 'NO', -value => '0')->pack(@pe);
|
1466 |
|
|
# write latency
|
1467 |
|
|
$frame=$mw->Frame();
|
1468 |
|
|
$frame->pack(@pt);
|
1469 |
|
|
$frame->Label(-text => "Write access latency: ")->pack(@pw);
|
1470 |
|
|
$frame->Entry(-textvariable => \$master[$masters]{"write_lat"})->pack(@pe);
|
1471 |
|
|
$frame=$mw->Frame();
|
1472 |
|
|
# read latency
|
1473 |
|
|
$frame=$mw->Frame();
|
1474 |
|
|
$frame->pack(@pt);
|
1475 |
|
|
$frame->Label(-text => "Read access latency: ")->pack(@pw);
|
1476 |
|
|
$frame->Entry(-textvariable => \$master[$masters]{"read_lat"})->pack(@pe);
|
1477 |
|
|
$frame=$mw->Frame();
|
1478 |
|
|
# UUT base address
|
1479 |
|
|
$frame=$mw->Frame();
|
1480 |
|
|
$frame->pack(@pt);
|
1481 |
|
|
$frame->Label(-text => "UUT Base Address: ")->pack(@pw);
|
1482 |
|
|
$frame->Entry(-textvariable => \$uut[$masters]{"base_addr"})->pack(@pe);
|
1483 |
|
|
$frame=$mw->Frame();
|
1484 |
|
|
|
1485 |
|
|
# exit
|
1486 |
|
|
$frame=$mw->Frame(-label=>"\n");
|
1487 |
|
|
$frame->pack(@pt);
|
1488 |
|
|
$frame->Button(-text => "cancel", -command =>sub {WinGlobalExit(); $state='WinGlobal'; $masters--;})->pack (@pw);
|
1489 |
|
|
$frame->Button(-text => "done", -command =>sub {WinGlobalExit(); $state='WinGlobal';})->pack (@pe);
|
1490 |
|
|
|
1491 |
|
|
MainLoop;
|
1492 |
|
|
};
|
1493 |
|
|
|
1494 |
|
|
|
1495 |
|
|
sub WinAddSlave {
|
1496 |
|
|
$state='WinGlobal';
|
1497 |
|
|
&slave_init;
|
1498 |
|
|
|
1499 |
|
|
$mw = MainWindow->new;
|
1500 |
|
|
|
1501 |
|
|
$frame=$mw->Frame(-label=>"New AHB Slave");
|
1502 |
|
|
# AHB Slave
|
1503 |
|
|
$frame->pack(@pt);
|
1504 |
|
|
$frame->Label(-text => "AHB Slave name: ")->pack(@pw);
|
1505 |
|
|
$frame->Entry(-textvariable => \$slave[$slaves]{"name"})->pack(@pe);
|
1506 |
|
|
|
1507 |
|
|
# type:multi/wait/retry/split
|
1508 |
|
|
$frame=$mw->Frame();
|
1509 |
|
|
$frame->pack(@pt);
|
1510 |
|
|
$frame->Label(-text => "Slave type: ")->pack(@pw);
|
1511 |
|
|
$a = $frame->Radiobutton (-state => 'disabled', -variable => \$slave[$slaves]{"type"}, -text => 'Multi slave', -value => 'multi')->pack(@pw);
|
1512 |
|
|
$b = $frame->Radiobutton ( -variable => \$slave[$slaves]{"type"}, -text => 'Single slave, wait', -value => 'wait')->pack(@pw);
|
1513 |
|
|
$c = $frame->Radiobutton (-state => 'disabled', -variable => \$slave[$slaves]{"type"}, -text => 'Single slave, retry', -value => 'retry')->pack(@pw);
|
1514 |
|
|
$d = $frame->Radiobutton (-state => 'disabled', -variable => \$slave[$slaves]{"type"}, -text => 'Single slave, split', -value => 'split')->pack(@pw);
|
1515 |
|
|
|
1516 |
|
|
# exit
|
1517 |
|
|
$frame=$mw->Frame(-label=>"\n");
|
1518 |
|
|
$frame->pack(@pt);
|
1519 |
|
|
$frame->Button(-text => "cancel", -command =>sub {WinGlobalExit(); $slaves--;})->pack (@pw);
|
1520 |
|
|
$frame->Button(-text => "done", -command =>sub {WinGlobalExit(); WinDefSlave(); })->pack (@pe);
|
1521 |
|
|
|
1522 |
|
|
MainLoop;
|
1523 |
|
|
}
|
1524 |
|
|
|
1525 |
|
|
|
1526 |
|
|
sub WinDefSlave {
|
1527 |
|
|
|
1528 |
|
|
$state='WinGlobal';
|
1529 |
|
|
|
1530 |
|
|
$mw = MainWindow->new;
|
1531 |
|
|
|
1532 |
|
|
if ($slave[$slaves]{"type"} eq 'multi') {
|
1533 |
|
|
|
1534 |
|
|
# slave list: first is default
|
1535 |
|
|
$frame=$mw->Frame();
|
1536 |
|
|
$frame->pack(@pt);
|
1537 |
|
|
$frame->Label(-text => "Slave list: ")->pack(@pw);
|
1538 |
|
|
$frame->Entry(-textvariable => \$slave[$slaves]{"list"})->pack(@pe);
|
1539 |
|
|
$frame=$mw->Frame();
|
1540 |
|
|
# algorithm number: 0,1,2
|
1541 |
|
|
$frame=$mw->Frame();
|
1542 |
|
|
|
1543 |
|
|
$frame->pack(@pt);
|
1544 |
|
|
$frame->Label(-text => "Arbitration type: ")->pack(@pw);
|
1545 |
|
|
$a = $frame->Radiobutton ( -variable => \$slave[$slaves]{"alg"}, -text => 'Fixed ', -value => '0')->pack(@pw);
|
1546 |
|
|
$b = $frame->Radiobutton ( -variable => \$slave[$slaves]{"alg"}, -text => 'Round Robin ', -value => '1')->pack(@pw);
|
1547 |
|
|
$c = $frame->Radiobutton ( -variable => \$slave[$slaves]{"alg"}, -text => 'Pseudo Random', -value => '2')->pack(@pw);
|
1548 |
|
|
$frame=$mw->Frame();
|
1549 |
|
|
|
1550 |
|
|
} else {
|
1551 |
|
|
|
1552 |
|
|
# id
|
1553 |
|
|
$frame=$mw->Frame();
|
1554 |
|
|
$frame->pack(@pt);
|
1555 |
|
|
$frame->Label(-text => "AHB Slave number: ")->pack(@pw);
|
1556 |
|
|
$frame->Entry(-state => 'disabled', -textvariable => \$slave[$slaves]{"id"})->pack(@pe);
|
1557 |
|
|
|
1558 |
|
|
|
1559 |
|
|
if (($slave[$slaves]{"type"} eq 'retry') or ($slave[$slaves]{"type"} eq 'split')) {
|
1560 |
|
|
|
1561 |
|
|
# fifo length
|
1562 |
|
|
$frame=$mw->Frame(-label=>"AHB Slave internal fifo");
|
1563 |
|
|
$frame=$mw->Frame();
|
1564 |
|
|
$frame->pack(@pt);
|
1565 |
|
|
$frame->Label(-text => "Fifo length: ")->pack(@pw);
|
1566 |
|
|
$frame->Entry( -textvariable => \$slave[$slaves]{"fifo_ln"})->pack(@pe);
|
1567 |
|
|
$frame=$mw->Frame();
|
1568 |
|
|
# fifo half empty
|
1569 |
|
|
$frame=$mw->Frame();
|
1570 |
|
|
$frame->pack(@pt);
|
1571 |
|
|
$frame->Label(-text => "Fifo half-empty level: ")->pack(@pw);
|
1572 |
|
|
$frame->Entry( -textvariable => \$slave[$slaves]{"fifo_he"})->pack(@pe);
|
1573 |
|
|
$frame=$mw->Frame();
|
1574 |
|
|
# fifo half full
|
1575 |
|
|
$frame=$mw->Frame();
|
1576 |
|
|
$frame->pack(@pt);
|
1577 |
|
|
$frame->Label(-text => "Fifo half-full level: ")->pack(@pw);
|
1578 |
|
|
$frame->Entry( -textvariable => \$slave[$slaves]{"fifo_hf"})->pack(@pe);
|
1579 |
|
|
$frame=$mw->Frame();
|
1580 |
|
|
|
1581 |
|
|
}
|
1582 |
|
|
|
1583 |
|
|
# add before remap
|
1584 |
|
|
$frame=$mw->Frame(-label=>"ADDRESS before remap");
|
1585 |
|
|
$frame=$mw->Frame();
|
1586 |
|
|
$frame->pack(@pt);
|
1587 |
|
|
$frame->Label(-text => "Add high-low: ")->pack(@pt);
|
1588 |
|
|
$frame->Entry(-textvariable => \$slave[$slaves]{"add_h"})->pack(@pw);
|
1589 |
|
|
$frame->Entry(-textvariable => \$slave[$slaves]{"add_l"})->pack(@pe);
|
1590 |
|
|
|
1591 |
|
|
# add after remap
|
1592 |
|
|
$frame=$mw->Frame(-label=>"ADDRESS after remap");
|
1593 |
|
|
$frame=$mw->Frame();
|
1594 |
|
|
$frame->pack(@pt);
|
1595 |
|
|
$frame->Label(-text => "Add high-low after remap: ")->pack(@pt);
|
1596 |
|
|
$frame->Entry(-textvariable => \$slave[$slaves]{"add_hh"})->pack(@pw);
|
1597 |
|
|
$frame->Entry(-textvariable => \$slave[$slaves]{"add_ll"})->pack(@pe);
|
1598 |
|
|
|
1599 |
|
|
# number of addressable bits
|
1600 |
|
|
$frame=$mw->Frame();
|
1601 |
|
|
$frame->pack(@pt);
|
1602 |
|
|
$frame->Label(-text => "Number of addr bits: ")->pack(@pw);
|
1603 |
|
|
$frame->Entry(-textvariable => \$slave[$slaves]{"num_bits_addr"})->pack(@pe);
|
1604 |
|
|
$frame=$mw->Frame();
|
1605 |
|
|
# burst capability in write
|
1606 |
|
|
$frame=$mw->Frame();
|
1607 |
|
|
$frame->pack(@pt);
|
1608 |
|
|
$frame->Label(-text => "Write burst capability: ")->pack(@pw);
|
1609 |
|
|
$a = $frame->Radiobutton ( -variable => \$slave[$slaves]{"write_burst"}, -text => 'YES', -value => '1')->pack(@pw);
|
1610 |
|
|
$b = $frame->Radiobutton ( -variable => \$slave[$slaves]{"write_burst"}, -text => 'NO', -value => '0')->pack(@pe);
|
1611 |
|
|
# burst capability in read
|
1612 |
|
|
$frame=$mw->Frame();
|
1613 |
|
|
$frame->pack(@pt);
|
1614 |
|
|
$frame->Label(-text => "Read burst capability: ")->pack(@pw);
|
1615 |
|
|
$c = $frame->Radiobutton ( -variable => \$slave[$slaves]{"read_burst"}, -text => 'YES', -value => '1')->pack(@pw);
|
1616 |
|
|
$d = $frame->Radiobutton ( -variable => \$slave[$slaves]{"read_burst"}, -text => 'NO', -value => '0')->pack(@pe);
|
1617 |
|
|
# write latency
|
1618 |
|
|
$frame=$mw->Frame();
|
1619 |
|
|
$frame->pack(@pt);
|
1620 |
|
|
$frame->Label(-text => "Write access latency: ")->pack(@pw);
|
1621 |
|
|
$frame->Entry(-textvariable => \$slave[$slaves]{"write_lat"})->pack(@pe);
|
1622 |
|
|
$frame=$mw->Frame();
|
1623 |
|
|
# read latency
|
1624 |
|
|
$frame=$mw->Frame();
|
1625 |
|
|
$frame->pack(@pt);
|
1626 |
|
|
$frame->Label(-text => "Read access latency: ")->pack(@pw);
|
1627 |
|
|
$frame->Entry(-textvariable => \$slave[$slaves]{"read_lat"})->pack(@pe);
|
1628 |
|
|
$frame=$mw->Frame();
|
1629 |
|
|
|
1630 |
|
|
# exit
|
1631 |
|
|
$frame=$mw->Frame(-label=>"\n");
|
1632 |
|
|
$frame->pack(@pt);
|
1633 |
|
|
$frame->Button(-text => "cancel", -command =>sub {WinGlobalExit(); $slaves--; WinAddSlave();})->pack (@pw);
|
1634 |
|
|
$frame->Button(-text => "done", -command =>sub {WinGlobalExit(); })->pack (@pe);
|
1635 |
|
|
|
1636 |
|
|
MainLoop;
|
1637 |
|
|
}
|
1638 |
|
|
|
1639 |
|
|
};
|
1640 |
|
|
|
1641 |
|
|
|
1642 |
|
|
sub WinAddPslave {
|
1643 |
|
|
|
1644 |
|
|
$state='WinGlobal';
|
1645 |
|
|
&pslave_init;
|
1646 |
|
|
|
1647 |
|
|
$mw = MainWindow->new;
|
1648 |
|
|
|
1649 |
|
|
$frame=$mw->Frame(-label=>"New APB Slave");
|
1650 |
|
|
# APB Slave
|
1651 |
|
|
$frame->pack(@pt);
|
1652 |
|
|
$frame->Label(-text => "APB Salve name: ")->pack(@pw);
|
1653 |
|
|
$frame->Entry(-textvariable => \$pslave[$pslaves]{"name"})->pack(@pe);
|
1654 |
|
|
|
1655 |
|
|
# id
|
1656 |
|
|
$frame=$mw->Frame();
|
1657 |
|
|
$frame->pack(@pt);
|
1658 |
|
|
$frame->Label(-text => "APB Slave number: ")->pack(@pw);
|
1659 |
|
|
$frame->Entry(-state => 'disabled', -textvariable => \$pslave[$pslaves]{"id"})->pack(@pe);
|
1660 |
|
|
|
1661 |
|
|
# add before remap
|
1662 |
|
|
$frame=$mw->Frame(-label=>"ADDRESS before remap");
|
1663 |
|
|
$frame=$mw->Frame();
|
1664 |
|
|
$frame->pack(@pt);
|
1665 |
|
|
$frame->Label(-text => "Add high-low: ")->pack(@pt);
|
1666 |
|
|
$frame->Entry(-textvariable => \$pslave[$pslaves]{"add_h"})->pack(@pw);
|
1667 |
|
|
$frame->Entry(-textvariable => \$pslave[$pslaves]{"add_l"})->pack(@pe);
|
1668 |
|
|
|
1669 |
|
|
# add after remap
|
1670 |
|
|
$frame=$mw->Frame(-label=>"ADDRESS after remap");
|
1671 |
|
|
$frame=$mw->Frame();
|
1672 |
|
|
$frame->pack(@pt);
|
1673 |
|
|
$frame->Label(-text => "Add high-low after remap: ")->pack(@pt);
|
1674 |
|
|
$frame->Entry(-textvariable => \$pslave[$pslaves]{"add_hh"})->pack(@pw);
|
1675 |
|
|
$frame->Entry(-textvariable => \$pslave[$pslaves]{"add_ll"})->pack(@pe);
|
1676 |
|
|
|
1677 |
|
|
# number of addressable bits
|
1678 |
|
|
$frame=$mw->Frame();
|
1679 |
|
|
$frame->pack(@pt);
|
1680 |
|
|
$frame->Label(-text => "Number of addr bits: ")->pack(@pw);
|
1681 |
|
|
$frame->Entry(-textvariable => \$pslave[$pslaves]{"num_bits_addr"})->pack(@pe);
|
1682 |
|
|
$frame=$mw->Frame();
|
1683 |
|
|
|
1684 |
|
|
# exit
|
1685 |
|
|
$frame=$mw->Frame(-label=>"\n");
|
1686 |
|
|
$frame->pack(@pt);
|
1687 |
|
|
$frame->Button(-text => "cancel", -command =>sub {WinGlobalExit(); $pslaves--;})->pack (@pw);
|
1688 |
|
|
$frame->Button(-text => "done", -command =>sub {WinGlobalExit(); })->pack (@pe);
|
1689 |
|
|
|
1690 |
|
|
MainLoop;
|
1691 |
|
|
};
|
1692 |
|
|
|
1693 |
|
|
|
1694 |
|
|
sub WinAddArbiter {
|
1695 |
|
|
$state='WinGlobal';
|
1696 |
|
|
&arb_init;
|
1697 |
|
|
|
1698 |
|
|
$mw = MainWindow->new;
|
1699 |
|
|
|
1700 |
|
|
$frame=$mw->Frame(-label=>"New AHB Arbiter");
|
1701 |
|
|
# AHB Arbiter
|
1702 |
|
|
$frame->pack(@pt);
|
1703 |
|
|
$frame->Label(-text => "AHB Arbiter name: ")->pack(@pw);
|
1704 |
|
|
$frame->Entry(-textvariable => \$arb[$arbs]{"name"})->pack(@pe);
|
1705 |
|
|
|
1706 |
|
|
# id
|
1707 |
|
|
$frame=$mw->Frame();
|
1708 |
|
|
$frame->pack(@pt);
|
1709 |
|
|
$frame->Label(-text => "AHB Arbiter number: ")->pack(@pw);
|
1710 |
|
|
$frame->Entry(-state => 'disabled', -textvariable => \$arb[$arbs]{"id"})->pack(@pe);
|
1711 |
|
|
|
1712 |
|
|
# Default master
|
1713 |
|
|
$frame=$mw->Frame();
|
1714 |
|
|
$frame->pack(@pt);
|
1715 |
|
|
$frame->Label(-text => "Default Master: ")->pack(@pw);
|
1716 |
|
|
$frame->Entry(-textvariable => \$arb[$arbs]{"def"})->pack(@pe);
|
1717 |
|
|
|
1718 |
|
|
# master list: first is default
|
1719 |
|
|
$frame=$mw->Frame();
|
1720 |
|
|
$frame->pack(@pt);
|
1721 |
|
|
$frame->Label(-text => "Master list: ")->pack(@pw);
|
1722 |
|
|
$frame->Entry(-textvariable => \$arb[$arbs]{"m_list"})->pack(@pe);
|
1723 |
|
|
$frame=$mw->Frame();
|
1724 |
|
|
|
1725 |
|
|
# algorithm number: 0,1,2,3,4,5
|
1726 |
|
|
$frame=$mw->Frame();
|
1727 |
|
|
$frame->pack(@pt);
|
1728 |
|
|
$frame->Label(-text => "Arbitration type: ")->pack(@pt);
|
1729 |
|
|
$a = $frame->Radiobutton ( -variable => \$arb[$arbs]{"alg"}, -text => 'Fixed ', -value => '0')->pack(@pw);
|
1730 |
|
|
$b = $frame->Radiobutton ( -variable => \$arb[$arbs]{"alg"}, -text => 'Round Robin ', -value => '1')->pack(@pw);
|
1731 |
|
|
$c = $frame->Radiobutton ( -variable => \$arb[$arbs]{"alg"}, -text => 'Pseudo Random', -value => '2')->pack(@pw);
|
1732 |
|
|
$d = $frame->Radiobutton ( -variable => \$arb[$arbs]{"alg"}, -text => 'Fixed Modif. ', -value => '3')->pack(@pe);
|
1733 |
|
|
$e = $frame->Radiobutton ( -variable => \$arb[$arbs]{"alg"}, -text => 'RR Modif. ', -value => '4')->pack(@pe);
|
1734 |
|
|
$f = $frame->Radiobutton ( -variable => \$arb[$arbs]{"alg"}, -text => 'PR Modif. ', -value => '5')->pack(@pe);
|
1735 |
|
|
$frame=$mw->Frame();
|
1736 |
|
|
|
1737 |
|
|
# slave list
|
1738 |
|
|
$frame=$mw->Frame();
|
1739 |
|
|
$frame->pack(@pt);
|
1740 |
|
|
$frame->Label(-text => "Slave list: ")->pack(@pw);
|
1741 |
|
|
$frame->Entry(-textvariable => \$arb[$arbs]{"s_list"})->pack(@pe);
|
1742 |
|
|
$frame=$mw->Frame();
|
1743 |
|
|
|
1744 |
|
|
# exit
|
1745 |
|
|
$frame=$mw->Frame(-label=>"\n");
|
1746 |
|
|
$frame->pack(@pt);
|
1747 |
|
|
$frame->Button(-text => "cancel", -command =>sub {WinGlobalExit(); $arbs--;})->pack (@pw);
|
1748 |
|
|
$frame->Button(-text => "done", -command =>sub {WinGlobalExit(); })->pack (@pe);
|
1749 |
|
|
|
1750 |
|
|
MainLoop;
|
1751 |
|
|
};
|
1752 |
|
|
|
1753 |
|
|
|
1754 |
|
|
sub WinAddAhb {
|
1755 |
|
|
$state='WinGlobal';
|
1756 |
|
|
&ahb_init;
|
1757 |
|
|
|
1758 |
|
|
$mw = MainWindow->new;
|
1759 |
|
|
|
1760 |
|
|
$frame=$mw->Frame(-label=>"New AHB Bridge");
|
1761 |
|
|
# AHB Bridge
|
1762 |
|
|
$frame->pack(@pt);
|
1763 |
|
|
$frame->Label(-text => "AHB Bridge name: ")->pack(@pw);
|
1764 |
|
|
$frame->Entry(-textvariable => \$ahb[$ahbs]{"name"})->pack(@pe);
|
1765 |
|
|
|
1766 |
|
|
# id
|
1767 |
|
|
$frame=$mw->Frame();
|
1768 |
|
|
$frame->pack(@pt);
|
1769 |
|
|
$frame->Label(-text => "AHB Bridge number: ")->pack(@pw);
|
1770 |
|
|
$frame->Entry(-state => 'disabled', -textvariable => \$ahb[$ahbs]{"id"})->pack(@pe);
|
1771 |
|
|
|
1772 |
|
|
# Default slave
|
1773 |
|
|
$frame=$mw->Frame();
|
1774 |
|
|
$frame->pack(@pt);
|
1775 |
|
|
$frame->Label(-text => "Default Slave: ")->pack(@pw);
|
1776 |
|
|
$frame->Entry(-textvariable => \$ahb[$ahbs]{"def"})->pack(@pe);
|
1777 |
|
|
|
1778 |
|
|
# slave list
|
1779 |
|
|
$frame=$mw->Frame();
|
1780 |
|
|
$frame->pack(@pt);
|
1781 |
|
|
$frame->Label(-text => "Slave list: ")->pack(@pw);
|
1782 |
|
|
$frame->Entry(-textvariable => \$ahb[$ahbs]{"list"})->pack(@pe);
|
1783 |
|
|
$frame=$mw->Frame();
|
1784 |
|
|
|
1785 |
|
|
# master
|
1786 |
|
|
$frame=$mw->Frame();
|
1787 |
|
|
$frame->pack(@pt);
|
1788 |
|
|
$frame->Label(-text => "Master: ")->pack(@pw);
|
1789 |
|
|
$frame->Entry(-textvariable => \$ahb[$ahbs]{"mst"})->pack(@pe);
|
1790 |
|
|
$frame=$mw->Frame();
|
1791 |
|
|
|
1792 |
|
|
# algorithm number: 0,1,2
|
1793 |
|
|
$frame=$mw->Frame();
|
1794 |
|
|
$frame->pack(@pt);
|
1795 |
|
|
$frame->Label(-text => "Arbitration type: ")->pack(@pt);
|
1796 |
|
|
$a = $frame->Radiobutton ( -variable => \$ahb[$ahbs]{"alg"}, -text => 'Fixed ', -value => '0')->pack(@pw);
|
1797 |
|
|
$b = $frame->Radiobutton ( -variable => \$ahb[$ahbs]{"alg"}, -text => 'Round Robin ', -value => '1')->pack(@pw);
|
1798 |
|
|
$c = $frame->Radiobutton ( -variable => \$ahb[$ahbs]{"alg"}, -text => 'Pseudo Random', -value => '2')->pack(@pw);
|
1799 |
|
|
$frame=$mw->Frame();
|
1800 |
|
|
|
1801 |
|
|
# exit
|
1802 |
|
|
$frame=$mw->Frame(-label=>"\n");
|
1803 |
|
|
$frame->pack(@pt);
|
1804 |
|
|
$frame->Button(-text => "cancel", -command =>sub {WinGlobalExit(); $ahbs--;})->pack (@pw);
|
1805 |
|
|
$frame->Button(-text => "done", -command =>sub {WinGlobalExit(); })->pack (@pe);
|
1806 |
|
|
|
1807 |
|
|
MainLoop;
|
1808 |
|
|
};
|
1809 |
|
|
|
1810 |
|
|
|
1811 |
|
|
sub WinAddApb {
|
1812 |
|
|
|
1813 |
|
|
$state='WinGlobal';
|
1814 |
|
|
&apb_init;
|
1815 |
|
|
|
1816 |
|
|
$mw = MainWindow->new;
|
1817 |
|
|
|
1818 |
|
|
$frame=$mw->Frame(-label=>"New APB Bridge");
|
1819 |
|
|
# APB Bridge
|
1820 |
|
|
$frame->pack(@pt);
|
1821 |
|
|
$frame->Label(-text => "APB Bridge name: ")->pack(@pw);
|
1822 |
|
|
$frame->Entry(-textvariable => \$apb[$apbs]{"name"})->pack(@pe);
|
1823 |
|
|
|
1824 |
|
|
# id
|
1825 |
|
|
$frame=$mw->Frame();
|
1826 |
|
|
$frame->pack(@pt);
|
1827 |
|
|
$frame->Label(-text => "AHB Bridge number: ")->pack(@pw);
|
1828 |
|
|
$frame->Entry(-state => 'disabled', -textvariable => \$apb[$apbs]{"id"})->pack(@pe);
|
1829 |
|
|
|
1830 |
|
|
# number of addressable bits
|
1831 |
|
|
$frame=$mw->Frame();
|
1832 |
|
|
$frame->pack(@pt);
|
1833 |
|
|
$frame->Label(-text => "Number of addr bits: ")->pack(@pw);
|
1834 |
|
|
$frame->Entry(-textvariable => \$apb[$apbs]{"num_bits_addr"})->pack(@pe);
|
1835 |
|
|
$frame=$mw->Frame();
|
1836 |
|
|
|
1837 |
|
|
# slave
|
1838 |
|
|
$frame=$mw->Frame();
|
1839 |
|
|
$frame->pack(@pt);
|
1840 |
|
|
$frame->Label(-text => "AHB Slave: ")->pack(@pw);
|
1841 |
|
|
$frame->Entry(-textvariable => \$apb[$apbs]{"slv"})->pack(@pe);
|
1842 |
|
|
|
1843 |
|
|
# slave list
|
1844 |
|
|
$frame=$mw->Frame();
|
1845 |
|
|
$frame->pack(@pt);
|
1846 |
|
|
$frame->Label(-text => "APB Slave list: ")->pack(@pw);
|
1847 |
|
|
$frame->Entry(-textvariable => \$apb[$apbs]{"list"})->pack(@pe);
|
1848 |
|
|
$frame=$mw->Frame();
|
1849 |
|
|
|
1850 |
|
|
# exit
|
1851 |
|
|
$frame=$mw->Frame(-label=>"\n");
|
1852 |
|
|
$frame->pack(@pt);
|
1853 |
|
|
$frame->Button(-text => "cancel", -command =>sub {WinGlobalExit(); $apbs--;})->pack (@pw);
|
1854 |
|
|
$frame->Button(-text => "done", -command =>sub {WinGlobalExit(); })->pack (@pe);
|
1855 |
|
|
|
1856 |
|
|
MainLoop;
|
1857 |
|
|
};
|
1858 |
|
|
|
1859 |
|
|
|
1860 |
|
|
sub WinCheck {
|
1861 |
|
|
|
1862 |
|
|
$mw = MainWindow->new;
|
1863 |
|
|
|
1864 |
|
|
$state='WinGlobal';
|
1865 |
|
|
@gen_signal=();
|
1866 |
|
|
@ass_signal=();
|
1867 |
|
|
@gen_comp=();
|
1868 |
|
|
@gen_tbcomp=();
|
1869 |
|
|
@gen_uut=();
|
1870 |
|
|
$chk=0;
|
1871 |
|
|
@tmp_chk=();
|
1872 |
|
|
|
1873 |
|
|
print "\n*******************************************\n*******************************************\n";
|
1874 |
|
|
# check for masters:
|
1875 |
|
|
if ($masters >= 0) {$chk++;for $j ( 0 .. $masters ) {&gen_master($master[$j]);}} else
|
1876 |
|
|
{
|
1877 |
|
|
$frame=$mw->Frame();
|
1878 |
|
|
$frame->pack(@pt);
|
1879 |
|
|
$frame->Label(-text => "## ERROR: No AHB Masters")->pack(@pt);
|
1880 |
|
|
}
|
1881 |
|
|
|
1882 |
|
|
# check for slaves:
|
1883 |
|
|
if ($slaves >= 0) {$chk++;} else
|
1884 |
|
|
{
|
1885 |
|
|
$frame=$mw->Frame();
|
1886 |
|
|
$frame->pack(@pt);
|
1887 |
|
|
$frame->Label(-text => "## ERROR: No AHB Slaves")->pack(@pt);
|
1888 |
|
|
}
|
1889 |
|
|
|
1890 |
|
|
# check for per slaves:
|
1891 |
|
|
if ($pslaves >= 0) {for $j ( 0 .. $pslaves ) {&gen_pslave($pslave[$j]);}} else {
|
1892 |
|
|
if ($apbs >= 0) {
|
1893 |
|
|
$chk--;
|
1894 |
|
|
$frame=$mw->Frame();
|
1895 |
|
|
$frame->pack(@pt);
|
1896 |
|
|
$frame->Label(-text => "## ERROR: No APB Peripherals")->pack(@pt);
|
1897 |
|
|
}
|
1898 |
|
|
}
|
1899 |
|
|
|
1900 |
|
|
if ($arbs >= 0) {$chk++;for $j ( 0 .. $arbs ) {&gen_arbiter($arb[$j]);}} else
|
1901 |
|
|
{
|
1902 |
|
|
$frame=$mw->Frame();
|
1903 |
|
|
$frame->pack(@pt);
|
1904 |
|
|
$frame->Label(-text => "## ERROR: No AHB Arbiters")->pack(@pt);
|
1905 |
|
|
}
|
1906 |
|
|
|
1907 |
|
|
# CONNECTION CHECKS:
|
1908 |
|
|
# Masters:
|
1909 |
|
|
for $i (0 .. $masters) {$tmp_chk[$i]=0};
|
1910 |
|
|
for $i (0 .. $ahbs) {$tmp_chk[$ahb[$i]{'mst'}]=0};
|
1911 |
|
|
|
1912 |
|
|
for $i (0 .. $arbs) {
|
1913 |
|
|
@tmp_lst=split(' ',$arb[$i]{'m_list'});
|
1914 |
|
|
foreach (@tmp_lst) {
|
1915 |
|
|
if ($_>$#tmp_chk) {
|
1916 |
|
|
$chk--;
|
1917 |
|
|
$frame=$mw->Frame();
|
1918 |
|
|
$frame->pack(@pt);
|
1919 |
|
|
$frame->Label(-text => "## ERROR: MASTER $_ used in ARBITER but not declared!")->pack(@pt);
|
1920 |
|
|
} else {
|
1921 |
|
|
$tmp_chk[$_]++;
|
1922 |
|
|
};
|
1923 |
|
|
};
|
1924 |
|
|
};
|
1925 |
|
|
for $i (0 .. $ahbs) {
|
1926 |
|
|
$tmp_chk[$ahb[$i]{'mst'}]+=10;
|
1927 |
|
|
};
|
1928 |
|
|
for $i (0 .. $#tmp_chk) {
|
1929 |
|
|
if ($tmp_chk[$i]==0) {
|
1930 |
|
|
$chk--;
|
1931 |
|
|
$frame=$mw->Frame();
|
1932 |
|
|
$frame->pack(@pt);
|
1933 |
|
|
$frame->Label(-text => "## ERROR: MASTER $i not connected to any AHB ARBITER!")->pack(@pt);
|
1934 |
|
|
} elsif ($tmp_chk[$i]>1 and $tmp_chk[$i]<10 and $i<=$masters) {
|
1935 |
|
|
$chk--;
|
1936 |
|
|
$frame=$mw->Frame();
|
1937 |
|
|
$frame->pack(@pt);
|
1938 |
|
|
$frame->Label(-text => "## ERROR: MASTER $i connected to more than one AHB ARBITER!")->pack(@pt);
|
1939 |
|
|
} elsif ($tmp_chk[$i]>=10 and $i<=$masters) {
|
1940 |
|
|
$chk--;
|
1941 |
|
|
$frame=$mw->Frame();
|
1942 |
|
|
$frame->pack(@pt);
|
1943 |
|
|
$frame->Label(-text => "## ERROR: MASTER $i cannot be used as AHB BRIDGE master!")->pack(@pt);
|
1944 |
|
|
} elsif ($tmp_chk[$i]>=20 and $i>$masters) {
|
1945 |
|
|
$chk--;
|
1946 |
|
|
$frame=$mw->Frame();
|
1947 |
|
|
$frame->pack(@pt);
|
1948 |
|
|
$frame->Label(-text => "## ERROR: MASTER $i used more than one AHB BRIDGE!")->pack(@pt);
|
1949 |
|
|
};
|
1950 |
|
|
};
|
1951 |
|
|
# Slaves:
|
1952 |
|
|
$#tmp_chk=-1;
|
1953 |
|
|
for $i (0 .. $slaves) {$tmp_chk[$i]=0};
|
1954 |
|
|
for $i (0 .. $arbs) {
|
1955 |
|
|
@tmp_lst=split(' ',$arb[$i]{'s_list'});
|
1956 |
|
|
foreach (@tmp_lst) {
|
1957 |
|
|
if ($_>$slaves) {
|
1958 |
|
|
$chk--;
|
1959 |
|
|
$frame=$mw->Frame();
|
1960 |
|
|
$frame->pack(@pt);
|
1961 |
|
|
$frame->Label(-text => "## ERROR: SLAVE $_ still not declared!")->pack(@pt);
|
1962 |
|
|
} else {
|
1963 |
|
|
$tmp_chk[$_]++;
|
1964 |
|
|
};
|
1965 |
|
|
};
|
1966 |
|
|
};
|
1967 |
|
|
for $i (0 .. $slaves) {
|
1968 |
|
|
if ($tmp_chk[$i]==0) {
|
1969 |
|
|
$chk--;
|
1970 |
|
|
$frame=$mw->Frame();
|
1971 |
|
|
$frame->pack(@pt);
|
1972 |
|
|
$frame->Label(-text => "## ERROR: SLAVE $i not connected to any AHB ARBITER!")->pack(@pt);
|
1973 |
|
|
};
|
1974 |
|
|
};
|
1975 |
|
|
for $i (0 .. $slaves) {$tmp_chk[$i]=0};
|
1976 |
|
|
for $i (0 .. $ahbs) {
|
1977 |
|
|
@tmp_lst=split(' ',$ahb[$i]{'s_list'});
|
1978 |
|
|
foreach (@tmp_lst) {$tmp_chk[$_]++;}
|
1979 |
|
|
};
|
1980 |
|
|
for $i (0 .. $apbs) {
|
1981 |
|
|
if ($i>$slaves) {
|
1982 |
|
|
$chk--;
|
1983 |
|
|
$frame=$mw->Frame();
|
1984 |
|
|
$frame->pack(@pt);
|
1985 |
|
|
$frame->Label(-text => "## ERROR: SLAVE $_ still not declared!")->pack(@pt);
|
1986 |
|
|
} else {
|
1987 |
|
|
$tmp_chk[$apb[$i]{'slv'}]++;
|
1988 |
|
|
};
|
1989 |
|
|
};
|
1990 |
|
|
for $i (0 .. $slaves) {
|
1991 |
|
|
if ($tmp_chk[$i]>1) {
|
1992 |
|
|
$chk--;
|
1993 |
|
|
$frame=$mw->Frame();
|
1994 |
|
|
$frame->pack(@pt);
|
1995 |
|
|
$frame->Label(-text => "## ERROR: SLAVE $i cannot be connected to more than one BRIDGE!")->pack(@pt);
|
1996 |
|
|
};
|
1997 |
|
|
};
|
1998 |
|
|
|
1999 |
|
|
# APB Peripherals:
|
2000 |
|
|
$#tmp_chk=-1;
|
2001 |
|
|
for $i (0 .. $pslaves) {$tmp_chk[$i]=0};
|
2002 |
|
|
for $i (0 .. $apbs) {
|
2003 |
|
|
@tmp_lst=split(' ',$apb[$i]{'list'});
|
2004 |
|
|
foreach (@tmp_lst) {
|
2005 |
|
|
if ($_>$pslaves) {
|
2006 |
|
|
$chk--;
|
2007 |
|
|
$frame=$mw->Frame();
|
2008 |
|
|
$frame->pack(@pt);
|
2009 |
|
|
$frame->Label(-text => "## ERROR: APB Peripheral $_ still not declared!")->pack(@pt);
|
2010 |
|
|
} else {
|
2011 |
|
|
$tmp_chk[$_]++;
|
2012 |
|
|
};
|
2013 |
|
|
};
|
2014 |
|
|
};
|
2015 |
|
|
for $i (0 .. $pslaves) {
|
2016 |
|
|
if ($tmp_chk[$i]==0) {
|
2017 |
|
|
$chk--;
|
2018 |
|
|
$frame=$mw->Frame();
|
2019 |
|
|
$frame->pack(@pt);
|
2020 |
|
|
$frame->Label(-text => "## ERROR: APB Peripheral $i not assigned to any APB master!")->pack(@pt);
|
2021 |
|
|
} elsif ($tmp_chk[$i]>1) {
|
2022 |
|
|
$chk--;
|
2023 |
|
|
$frame=$mw->Frame();
|
2024 |
|
|
$frame->pack(@pt);
|
2025 |
|
|
$frame->Label(-text => "## ERROR: APB Peripheral $i connected more than once!")->pack(@pt);
|
2026 |
|
|
};
|
2027 |
|
|
};
|
2028 |
|
|
|
2029 |
|
|
# WARNINGS on missing AHBAHB and AHBAPB BRIDGES
|
2030 |
|
|
if ($apbs >= 0) {
|
2031 |
|
|
for $j ( 0 .. $apbs ) {&gen_apb($apb[$j]);}
|
2032 |
|
|
} else {
|
2033 |
|
|
$frame=$mw->Frame();
|
2034 |
|
|
$frame->pack(@pt);
|
2035 |
|
|
$frame->Label(-text => "** WARNING: No APB Bridges")->pack(@pt);
|
2036 |
|
|
}
|
2037 |
|
|
|
2038 |
|
|
if ($ahbs >= 0) {for $j ( 0 .. $ahbs ) {&gen_bridge($ahb[$j]);}} else
|
2039 |
|
|
{
|
2040 |
|
|
$frame=$mw->Frame();
|
2041 |
|
|
$frame->pack(@pt);
|
2042 |
|
|
$frame->Label(-text => "** WARNING: No AHB/AHB Bridges")->pack(@pt);
|
2043 |
|
|
}
|
2044 |
|
|
|
2045 |
|
|
|
2046 |
|
|
# number '$chk' should indicate 'all checks OK!!'
|
2047 |
|
|
$done='disabled';
|
2048 |
|
|
if ($chk>=3) {
|
2049 |
|
|
$done='normal';
|
2050 |
|
|
$frame=$mw->Frame();
|
2051 |
|
|
$frame->pack(@pt);
|
2052 |
|
|
$frame->Label(-text => "**** CHECK PASSED ****")->pack(@pt);
|
2053 |
|
|
};
|
2054 |
|
|
# exit
|
2055 |
|
|
$frame=$mw->Frame(-label=>"\n");
|
2056 |
|
|
$frame->pack(@pt);
|
2057 |
|
|
$frame->Button(-text => "done", -command =>sub {WinGlobalExit(); })->pack (@pt);
|
2058 |
|
|
|
2059 |
|
|
MainLoop;
|
2060 |
|
|
};
|
2061 |
|
|
|
2062 |
|
|
|
2063 |
|
|
}
|
2064 |
|
|
|
2065 |
|
|
|
2066 |
|
|
|
2067 |
|
|
|
2068 |
|
|
|
2069 |
|
|
|
2070 |
|
|
# global assignments
|
2071 |
|
|
sub WinGlobal {
|
2072 |
|
|
$mw = MainWindow->new;
|
2073 |
|
|
|
2074 |
|
|
$mw->title ("AHB system generator");
|
2075 |
|
|
$frame=$mw->Frame(-label=>"Main menu\n");
|
2076 |
|
|
$frame->pack(@pt);
|
2077 |
|
|
$frame->Button(
|
2078 |
|
|
# -default=>'normal',
|
2079 |
|
|
# -foreground=>'black',-background=>'grey',
|
2080 |
|
|
# -state=>'active',-activeforeground=>'blue',-activebackground=>'white',
|
2081 |
|
|
# -disabledforeground=>'black',
|
2082 |
|
|
-text=>"add master",-command=>sub {WinGlobalExit(); $state='WinAddMaster';})->pack (@pw);
|
2083 |
|
|
|
2084 |
|
|
$frame->Button(
|
2085 |
|
|
-text=>"add slave",-command=>sub {WinGlobalExit(); $state='WinAddSlave';})->pack (@pw);
|
2086 |
|
|
|
2087 |
|
|
$frame->Button(
|
2088 |
|
|
-text=>"add arbiter",-command=>sub {WinGlobalExit(); $state='WinAddArbiter';})->pack (@pw);
|
2089 |
|
|
|
2090 |
|
|
$frame->Button(-state=>'disabled',
|
2091 |
|
|
-text=>"add per. slave",-command=>sub {WinGlobalExit(); $state='WinAddPslave';})->pack (@pe);
|
2092 |
|
|
|
2093 |
|
|
$frame->Button(-state=>'disabled',
|
2094 |
|
|
-text=>"add apb bridge",-command=>sub {WinGlobalExit(); $state='WinAddApb';})->pack (@pe);
|
2095 |
|
|
|
2096 |
|
|
$frame->Button(-state=>'disabled',
|
2097 |
|
|
-text=>"add ahb bridge",-command=>sub {WinGlobalExit(); $state='WinAddAhb';})->pack (@pe);
|
2098 |
|
|
|
2099 |
|
|
# $frame->Button(
|
2100 |
|
|
# -text=>"add per. slave",-command=>sub {WinGlobalExit(); $state='WinAddPslave';})->pack (@pe);
|
2101 |
|
|
|
2102 |
|
|
# $frame->Button(
|
2103 |
|
|
# -text=>"add apb bridge",-command=>sub {WinGlobalExit(); $state='WinAddApb';})->pack (@pe);
|
2104 |
|
|
|
2105 |
|
|
# $frame->Button(
|
2106 |
|
|
# -text=>"add ahb bridge",-command=>sub {WinGlobalExit(); $state='WinAddAhb';})->pack (@pe);
|
2107 |
|
|
|
2108 |
|
|
|
2109 |
|
|
$frame=$mw->Frame(-label=>"\n");
|
2110 |
|
|
$frame->pack(@pt);
|
2111 |
|
|
$frame->Button(
|
2112 |
|
|
-text=>"RESET conf",-command=>sub {WinGlobalExit(); $state='ResetConf';})->pack (@pt);
|
2113 |
|
|
|
2114 |
|
|
$frame->Button(
|
2115 |
|
|
-text=>"READ conf",-command=>sub {WinGlobalExit(); $state='ReadConf';})->pack (@pt);
|
2116 |
|
|
|
2117 |
|
|
$frame->Button(
|
2118 |
|
|
-text=>"SAVE conf",-command=>sub {WinGlobalExit(); $state='SaveConf';})->pack (@pt);
|
2119 |
|
|
|
2120 |
|
|
# check and elaborate
|
2121 |
|
|
$frame->Button(
|
2122 |
|
|
-text=>"check/generate",-command=>sub {WinGlobalExit(); $state='WinCheck';})->pack (@pt);
|
2123 |
|
|
|
2124 |
|
|
# exit
|
2125 |
|
|
$frame->Button(
|
2126 |
|
|
-state=>$done,-activeforeground=>'red',-activebackground=>'blue',
|
2127 |
|
|
-text=>"done",-command => sub {WinGlobalExit(); $state='quit';})->pack (@pt);
|
2128 |
|
|
|
2129 |
|
|
MainLoop;
|
2130 |
|
|
};
|
2131 |
|
|
|
2132 |
|
|
|
2133 |
|
|
|
2134 |
|
|
# GUI FSM
|
2135 |
|
|
|
2136 |
|
|
sub gui_fsm {
|
2137 |
|
|
$i=1;
|
2138 |
|
|
until ($state eq "quit") {
|
2139 |
|
|
if ($state eq 'WinGlobal') {
|
2140 |
|
|
&WinGlobal;
|
2141 |
|
|
} elsif ($state eq 'WinAddMaster') {
|
2142 |
|
|
&WinAddMaster;
|
2143 |
|
|
} elsif ($state eq 'WinAddSlave') {
|
2144 |
|
|
&WinAddSlave;
|
2145 |
|
|
} elsif ($state eq 'WinAddPslave') {
|
2146 |
|
|
&WinAddPslave;
|
2147 |
|
|
} elsif ($state eq 'WinAddArbiter') {
|
2148 |
|
|
&WinAddArbiter;
|
2149 |
|
|
} elsif ($state eq 'WinAddAhb') {
|
2150 |
|
|
&WinAddAhb;
|
2151 |
|
|
} elsif ($state eq 'WinAddApb') {
|
2152 |
|
|
&WinAddApb;
|
2153 |
|
|
} elsif ($state eq 'WinCheck') {
|
2154 |
|
|
&WinCheck;
|
2155 |
|
|
} elsif ($state eq 'SaveConf') {
|
2156 |
|
|
&SaveConf;
|
2157 |
|
|
} elsif ($state eq 'ReadConf') {
|
2158 |
|
|
&ReadConf;
|
2159 |
|
|
} elsif ($state eq 'ResetConf') {
|
2160 |
|
|
&ResetConf;
|
2161 |
|
|
} else {
|
2162 |
|
|
print "Bye!\n";
|
2163 |
|
|
};
|
2164 |
|
|
};
|
2165 |
|
|
};
|
2166 |
|
|
|
2167 |
|
|
|
2168 |
|
|
sub NoWinCheck {
|
2169 |
|
|
|
2170 |
|
|
@gen_signal=();
|
2171 |
|
|
@ass_signal=();
|
2172 |
|
|
@gen_comp=();
|
2173 |
|
|
@gen_tbcomp=();
|
2174 |
|
|
@gen_uut=();
|
2175 |
|
|
$chk=0;
|
2176 |
|
|
@tmp_chk=();
|
2177 |
|
|
|
2178 |
|
|
print "\n*******************************************\n*******************************************\n";
|
2179 |
|
|
# check for masters:
|
2180 |
|
|
if ($masters >= 0) {$chk++;for $j ( 0 .. $masters ) {&gen_master($master[$j]);}} else
|
2181 |
|
|
{
|
2182 |
|
|
print "## ERROR: No AHB Masters\n\n";
|
2183 |
|
|
}
|
2184 |
|
|
|
2185 |
|
|
# check for slaves:
|
2186 |
|
|
if ($slaves >= 0) {$chk++;} else
|
2187 |
|
|
{
|
2188 |
|
|
print "## ERROR: No AHB Slaves\n\n";
|
2189 |
|
|
}
|
2190 |
|
|
|
2191 |
|
|
# check for per slaves:
|
2192 |
|
|
if ($pslaves >= 0) {for $j ( 0 .. $pslaves ) {
|
2193 |
|
|
&gen_pslave($pslave[$j]);}
|
2194 |
|
|
} else {
|
2195 |
|
|
if ($apbs >= 0) {
|
2196 |
|
|
$chk--;
|
2197 |
|
|
print "## ERROR: No APB Peripheralss\n\n";
|
2198 |
|
|
}
|
2199 |
|
|
}
|
2200 |
|
|
|
2201 |
|
|
if ($arbs >= 0) {$chk++;for $j ( 0 .. $arbs ) {&gen_arbiter($arb[$j]);}} else
|
2202 |
|
|
{
|
2203 |
|
|
print "## ERROR: No AHB Arbiters\n\n";
|
2204 |
|
|
}
|
2205 |
|
|
|
2206 |
|
|
# CONNECTION CHECKS:
|
2207 |
|
|
# Masters:
|
2208 |
|
|
for $i (0 .. $masters) {$tmp_chk[$i]=0};
|
2209 |
|
|
for $i (0 .. $ahbs) {$tmp_chk[$ahb[$i]{'mst'}]=0};
|
2210 |
|
|
|
2211 |
|
|
for $i (0 .. $arbs) {
|
2212 |
|
|
@tmp_lst=split(' ',$arb[$i]{'m_list'});
|
2213 |
|
|
foreach (@tmp_lst) {
|
2214 |
|
|
if ($_>$#tmp_chk) {
|
2215 |
|
|
$chk--;
|
2216 |
|
|
print "## ERROR: MASTER $_ used in ARBITER but not declared!\n\n";
|
2217 |
|
|
} else {
|
2218 |
|
|
$tmp_chk[$_]++;
|
2219 |
|
|
};
|
2220 |
|
|
};
|
2221 |
|
|
};
|
2222 |
|
|
for $i (0 .. $ahbs) {
|
2223 |
|
|
$tmp_chk[$ahb[$i]{'mst'}]+=10;
|
2224 |
|
|
};
|
2225 |
|
|
for $i (0 .. $#tmp_chk) {
|
2226 |
|
|
if ($tmp_chk[$i]==0) {
|
2227 |
|
|
$chk--;
|
2228 |
|
|
print "## ERROR: MASTER $i not connected to any AHB ARBITER!\n\n";
|
2229 |
|
|
} elsif ($tmp_chk[$i]>1 and $tmp_chk[$i]<10 and $i<=$masters) {
|
2230 |
|
|
$chk--;
|
2231 |
|
|
print "## ERROR: MASTER $i connected to more than 1 AHB ARBITER!\n\n";
|
2232 |
|
|
} elsif ($tmp_chk[$i]>=10 and $i<=$masters) {
|
2233 |
|
|
$chk--;
|
2234 |
|
|
print "## ERROR: MASTER $i cannot be used as AHB BRIDGE master!\n\n";
|
2235 |
|
|
} elsif ($tmp_chk[$i]>=20 and $i>$masters) {
|
2236 |
|
|
$chk--;
|
2237 |
|
|
print "## ERROR: MASTER $i used in 2 or more AHB BRIDGE!\n\n";
|
2238 |
|
|
};
|
2239 |
|
|
};
|
2240 |
|
|
# Slaves:
|
2241 |
|
|
$#tmp_chk=-1;
|
2242 |
|
|
for $i (0 .. $slaves) {$tmp_chk[$i]=0};
|
2243 |
|
|
for $i (0 .. $arbs) {
|
2244 |
|
|
@tmp_lst=split(' ',$arb[$i]{'s_list'});
|
2245 |
|
|
foreach (@tmp_lst) {
|
2246 |
|
|
if ($_>$slaves) {
|
2247 |
|
|
$chk--;
|
2248 |
|
|
print "## ERROR: SLAVE $_ still not declared!\n\n";
|
2249 |
|
|
} else {
|
2250 |
|
|
$tmp_chk[$_]++;
|
2251 |
|
|
};
|
2252 |
|
|
};
|
2253 |
|
|
};
|
2254 |
|
|
for $i (0 .. $slaves) {
|
2255 |
|
|
if ($tmp_chk[$i]==0) {
|
2256 |
|
|
$chk--;
|
2257 |
|
|
print "## ERROR: SLAVE $i not connected to any AHB ARBITER!\n\n";
|
2258 |
|
|
};
|
2259 |
|
|
};
|
2260 |
|
|
for $i (0 .. $slaves) {$tmp_chk[$i]=0};
|
2261 |
|
|
for $i (0 .. $ahbs) {
|
2262 |
|
|
@tmp_lst=split(' ',$ahb[$i]{'s_list'});
|
2263 |
|
|
foreach (@tmp_lst) {$tmp_chk[$_]++;}
|
2264 |
|
|
};
|
2265 |
|
|
for $i (0 .. $apbs) {
|
2266 |
|
|
if ($i>$slaves) {
|
2267 |
|
|
$chk--;
|
2268 |
|
|
print "## ERROR: SLAVE $_ still not declared!\n\n";
|
2269 |
|
|
} else {
|
2270 |
|
|
$tmp_chk[$apb[$i]{'slv'}]++;
|
2271 |
|
|
};
|
2272 |
|
|
};
|
2273 |
|
|
for $i (0 .. $slaves) {
|
2274 |
|
|
if ($tmp_chk[$i]>1) {
|
2275 |
|
|
$chk--;
|
2276 |
|
|
print "## ERROR: SLAVE $i cannot be connected to more than 1 BRIDGE!\n\n";
|
2277 |
|
|
};
|
2278 |
|
|
};
|
2279 |
|
|
|
2280 |
|
|
# APB Peripherals:
|
2281 |
|
|
$#tmp_chk=-1;
|
2282 |
|
|
for $i (0 .. $pslaves) {$tmp_chk[$i]=0};
|
2283 |
|
|
for $i (0 .. $apbs) {
|
2284 |
|
|
@tmp_lst=split(' ',$apb[$i]{'list'});
|
2285 |
|
|
foreach (@tmp_lst) {
|
2286 |
|
|
if ($_>$pslaves) {
|
2287 |
|
|
$chk--;
|
2288 |
|
|
print "## ERROR: APB Peripheral $_ still not declared!\n\n";
|
2289 |
|
|
} else {
|
2290 |
|
|
$tmp_chk[$_]++;
|
2291 |
|
|
};
|
2292 |
|
|
};
|
2293 |
|
|
};
|
2294 |
|
|
for $i (0 .. $pslaves) {
|
2295 |
|
|
if ($tmp_chk[$i]==0) {
|
2296 |
|
|
$chk--;
|
2297 |
|
|
print "## ERROR: APB Peripheral $i not assigned to any APB master!\n\n";
|
2298 |
|
|
} elsif ($tmp_chk[$i]>1) {
|
2299 |
|
|
$chk--;
|
2300 |
|
|
print "## ERROR: APB Peripheral $i connected 2 or more times!\n\n";
|
2301 |
|
|
};
|
2302 |
|
|
};
|
2303 |
|
|
|
2304 |
|
|
# WARNINGS on missing AHBAHB and AHBAPB BRIDGES
|
2305 |
|
|
|
2306 |
|
|
if ($apbs >= 0) {
|
2307 |
|
|
for $j ( 0 .. $apbs ) {&gen_apb($apb[$j]);}
|
2308 |
|
|
} else {
|
2309 |
|
|
print "** WARNING: No APB Bridges\n\n";
|
2310 |
|
|
}
|
2311 |
|
|
|
2312 |
|
|
if ($ahbs >= 0) {for $j ( 0 .. $ahbs ) {&gen_bridge($ahb[$j]);}} else
|
2313 |
|
|
{
|
2314 |
|
|
print "** WARNING: No AHB/AHB Bridges\n\n";
|
2315 |
|
|
}
|
2316 |
|
|
|
2317 |
|
|
|
2318 |
|
|
# number '$chk' should indicate 'all checks OK!!'
|
2319 |
|
|
if ($chk>=3) {
|
2320 |
|
|
print "**** CHECK PASSED ****\n\n";
|
2321 |
|
|
} else {
|
2322 |
|
|
print "#### CHECK NOT PASSED!!\n\n"
|
2323 |
|
|
};
|
2324 |
|
|
};
|
2325 |
|
|
|
2326 |
|
|
|
2327 |
|
|
|
2328 |
|
|
|
2329 |
|
|
print "\nAHB system generator version 1.0\n\n";
|
2330 |
|
|
|
2331 |
|
|
#if (!defined($ENV{DSN})) {
|
2332 |
|
|
# die "Env variable DSN should point to project home\n";
|
2333 |
|
|
#}
|
2334 |
|
|
|
2335 |
|
|
#the ahb_system.vhd file is made of header, signal part, component
|
2336 |
|
|
open(file2,">$conffile");
|
2337 |
|
|
#|| die "Cannot open output file Now $conffile\n";
|
2338 |
|
|
open(file3,">$matfile");
|
2339 |
|
|
#|| die "Cannot open output file $matfile\n";
|
2340 |
|
|
open(file4,">$sysfile");
|
2341 |
|
|
#|| die "Cannot open output file $sysfile\n";
|
2342 |
|
|
open(file5,">$tbfile");
|
2343 |
|
|
#|| die "Cannot open output file $tbfile\n";
|
2344 |
|
|
|
2345 |
|
|
|
2346 |
|
|
#USAGE: AHB_SYS_VERIF.pl [-nogui] [filename]
|
2347 |
|
|
# if no file is specified "$DSN/scripts/ahb_generate.conf"
|
2348 |
|
|
#open(file1,"<$infile")|| die "Cannot open ahb configuration input file $infile\n";
|
2349 |
|
|
|
2350 |
|
|
$tmp=shift;
|
2351 |
|
|
if ($tmp eq "-nogui") {
|
2352 |
|
|
$infile = shift;
|
2353 |
|
|
open(file1,"<$infile")|| die "Cannot open ahb configuration input file $infile\n";
|
2354 |
|
|
print "Reading configuration in $infile .....\n\n";
|
2355 |
|
|
&ReadConf;
|
2356 |
|
|
print "Generating configuration read by $infile .....\n\n";
|
2357 |
|
|
&NoWinCheck;
|
2358 |
|
|
} else {
|
2359 |
|
|
if ($tmp ne <undef>) {
|
2360 |
|
|
$infile=$tmp;
|
2361 |
|
|
open(file1,"<$infile")|| die "Cannot open ahb configuration input file $infile\n";
|
2362 |
|
|
print "Reading configuration in $infile .....\n\n";
|
2363 |
|
|
&ReadConf;
|
2364 |
|
|
} else {
|
2365 |
|
|
print "No configuration read; using ahb_generate.conf as output file\n"
|
2366 |
|
|
};
|
2367 |
|
|
&gui_fsm;
|
2368 |
|
|
};
|
2369 |
|
|
|
2370 |
|
|
&gen_lib();
|
2371 |
|
|
&gen_ent();
|
2372 |
|
|
&gen_arrays();
|
2373 |
|
|
|
2374 |
|
|
|
2375 |
|
|
##### GENERATION ON CONFIGURATION FILE
|
2376 |
|
|
print file2 @gen_conf;
|
2377 |
|
|
|
2378 |
|
|
|
2379 |
|
|
##### GENERATION ON AHB_MATRIX FILE
|
2380 |
|
|
print file3 @gen_signal;
|
2381 |
|
|
print file3 "\nbegin\n\n";
|
2382 |
|
|
print file3 @ass_signal;
|
2383 |
|
|
print file3 @gen_comp;
|
2384 |
|
|
print file3 "\nend rtl;\n\n";
|
2385 |
|
|
|
2386 |
|
|
|
2387 |
|
|
|
2388 |
|
|
##### GENERATION ON SLAVE COMPONENTS (in @gen_tbcomp)
|
2389 |
|
|
$cnt=0;
|
2390 |
|
|
foreach $item (@slv_list){
|
2391 |
|
|
if ($item == 1) {&gen_slave($slave[$cnt]);}
|
2392 |
|
|
$cnt++;}
|
2393 |
|
|
#####
|
2394 |
|
|
|
2395 |
|
|
##### GENERATION ON AHB_SYSTEM FILE
|
2396 |
|
|
print file4 @gen_signal;
|
2397 |
|
|
print file4 @gen_ahb_signal;
|
2398 |
|
|
print file4 "
|
2399 |
|
|
signal dma_start : start_type_v($masters downto 0);
|
2400 |
|
|
|
2401 |
|
|
signal m_wrap_out : wrap_out_v($masters downto 0);
|
2402 |
|
|
signal m_wrap_in : wrap_in_v($masters downto 0);
|
2403 |
|
|
signal s_wrap_out : wrap_out_v($slaves downto 0);
|
2404 |
|
|
signal s_wrap_in : wrap_in_v($slaves downto 0);
|
2405 |
|
|
|
2406 |
|
|
signal zero : std_logic;
|
2407 |
|
|
signal no_conf_s : conf_type_t;
|
2408 |
|
|
constant no_conf_c: conf_type_t:= ('0',\"0000\",\"00000000000000000000000000000000\");
|
2409 |
|
|
|
2410 |
|
|
begin
|
2411 |
|
|
|
2412 |
|
|
zero <= '0';
|
2413 |
|
|
no_conf_s <= no_conf_c;
|
2414 |
|
|
|
2415 |
|
|
";
|
2416 |
|
|
|
2417 |
|
|
print file4 @ass_signal;
|
2418 |
|
|
print file4 @gen_comp;
|
2419 |
|
|
print file4 @gen_tbcomp;
|
2420 |
|
|
print file4 "\nend rtl;\n\n";
|
2421 |
|
|
|
2422 |
|
|
|
2423 |
|
|
##### GENERATION ON AHB_TB FILE
|
2424 |
|
|
|
2425 |
|
|
print file5 @gen_signal;
|
2426 |
|
|
print file5 @gen_ahb_signal;
|
2427 |
|
|
print file5 "
|
2428 |
|
|
signal conf : conf_type_v($masters downto 0);
|
2429 |
|
|
signal dma_start : start_type_v($masters downto 0);
|
2430 |
|
|
signal eot_int : std_logic_vector($masters downto 0);
|
2431 |
|
|
signal sim_end : std_logic_vector($masters downto 0);
|
2432 |
|
|
|
2433 |
|
|
signal m_wrap_out : wrap_out_v($masters downto 0);
|
2434 |
|
|
signal m_wrap_in : wrap_in_v($masters downto 0);
|
2435 |
|
|
signal s_wrap_out : wrap_out_v($slaves downto 0);
|
2436 |
|
|
signal s_wrap_in : wrap_in_v($slaves downto 0);
|
2437 |
|
|
|
2438 |
|
|
signal hresetn: std_logic;
|
2439 |
|
|
signal hclk: std_logic;
|
2440 |
|
|
signal remap: std_logic;
|
2441 |
|
|
|
2442 |
|
|
signal zero : std_logic;
|
2443 |
|
|
signal no_conf_s : conf_type_t;
|
2444 |
|
|
constant no_conf_c: conf_type_t:= ('0',\"0000\",\"00000000000000000000000000000000\");
|
2445 |
|
|
";
|
2446 |
|
|
|
2447 |
|
|
for $i (0 .. $masters) {
|
2448 |
|
|
print file5 "constant stim_$i: uut_params_t:= (bits32,retry,master,'0',single,2,4,hprot_posted,$uut[$i]{\"base_addr\"},1,0,'0');\n"
|
2449 |
|
|
}
|
2450 |
|
|
|
2451 |
|
|
print file5 "
|
2452 |
|
|
begin
|
2453 |
|
|
|
2454 |
|
|
zero <= '0';
|
2455 |
|
|
no_conf_s <= no_conf_c;
|
2456 |
|
|
|
2457 |
|
|
";
|
2458 |
|
|
print file5 @ass_signal;
|
2459 |
|
|
print file5 @gen_comp;
|
2460 |
|
|
print file5 @gen_tbcomp;
|
2461 |
|
|
print file5 @gen_uut;
|
2462 |
|
|
|
2463 |
|
|
print file5 "
|
2464 |
|
|
clock_pr:process
|
2465 |
|
|
begin
|
2466 |
|
|
if hclk='1' then
|
2467 |
|
|
hclk <= '0';
|
2468 |
|
|
wait for 5 ns;
|
2469 |
|
|
else
|
2470 |
|
|
hclk <= '1';
|
2471 |
|
|
wait for 5 ns;
|
2472 |
|
|
end if;
|
2473 |
|
|
end process;
|
2474 |
|
|
|
2475 |
|
|
reset_pr:process
|
2476 |
|
|
begin
|
2477 |
|
|
hresetn<= '0';
|
2478 |
|
|
wait for 20 ns;
|
2479 |
|
|
hresetn <= '1';
|
2480 |
|
|
wait;
|
2481 |
|
|
end process;
|
2482 |
|
|
|
2483 |
|
|
remap_pr:process
|
2484 |
|
|
begin
|
2485 |
|
|
remap <= '0';
|
2486 |
|
|
wait for 2000 ns;
|
2487 |
|
|
remap <= '1';
|
2488 |
|
|
wait;
|
2489 |
|
|
end process;
|
2490 |
|
|
|
2491 |
|
|
";
|
2492 |
|
|
|
2493 |
|
|
print file5 "assert (not(";
|
2494 |
|
|
if ($masters >0) {
|
2495 |
|
|
$i = $masters;
|
2496 |
|
|
while ($i > 0) {print file5 "sim_end($i)='1' and ";$i--;}
|
2497 |
|
|
}
|
2498 |
|
|
print file5 "sim_end(0)='1')) report \"*** SIMULATION ENDED ***\" severity failure;\n";
|
2499 |
|
|
print file5 "\nend rtl;\n\n";
|
2500 |
|
|
|
2501 |
|
|
|
2502 |
|
|
exit;
|
2503 |
|
|
|
2504 |
|
|
|
2505 |
|
|
|