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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [icarus_version/] [scripts/] [configure_params.pl] - Blame information for rev 196

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

Line No. Rev Author Line
1 169 diegovalve
#!/usr/bin/perl
2
################################################################
3
#Theia, Ray Cast Programable graphic Processing Unit.
4
#Copyright (C) 2010  Diego Valverde (diego.valverde.g@gmail.com)
5
#
6
#This program is free software; you can redistribute it and/or
7
#modify it under the terms of the GNU General Public License
8
#as published by the Free Software Foundation; either version 2
9
#of the License, or (at your option) any later version.
10
#
11
#This program is distributed in the hope that it will be useful,
12
#but WITHOUT ANY WARRANTY; without even the implied warranty of
13
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
#GNU General Public License for more details.
15
#
16
#You should have received a copy of the GNU General Public #License
17
#along with this program; if not, write to the Free Software
18
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  #02110-1301, USA.
19
################################################################
20
 
21
use Tie::File;
22
$NumberOfCores = $ARGV[0];
23
$Widht = $ARGV[1];
24
$Height = $ARGV[2];
25
 
26
die "\nusage:\nconfigure_gpu.pl number_of_cores [width height]\n\n" if (not defined $NumberOfCores);
27
$ParamsFile = "Params.mem";
28
$index=$NumberOfCores-1;
29
 
30
$Scale = 17;
31
 
32
 
33
 
34
#------------------------------------------------------------------
35
tie my @array, 'Tie::File', $ParamsFile or die "Can't open $ParamsFile: $!";
36
$size = @array;
37
 
38
for ($i = 7; $i < $size; $i++) {$array[$i] = "";}
39
if (not defined $Widht and not defined $Height)
40
{
41
        print $array[5];
42
        $array[5] =~ m/(\w+)\s+(\w+).*/g;
43
        $Widht = hex($1) / (2 ** $Scale);
44
        $Height = hex($2) / (2 ** $Scale)
45 195 diegovalve
} else {
46
 
47
        $array[5] = hex($Widht*2)."0000 ".hex($Height*2)."0000 0";
48
 
49 169 diegovalve
}
50
 
51
print
52
"
53
Scene resolution: $Widht x $Height
54
";
55
 
56
 
57
        $ScaledWidht  = sprintf('%X', $Widht * (2 ** $Scale));
58
        $ScaledHeight = sprintf('%X', $Height *(2 ** $Scale));
59
        $Delta = $Height / $NumberOfCores;
60
        print "Separating proyection plane into $NumberOfCores blocks of $Delta rows\n";
61
        $array[0] = sprintf('%X',3*(6+$NumberOfCores*2));
62
        $array[5] = "$ScaledWidht $ScaledHeight 0\t//<Width>, <Height>,<NULL>";
63
        for ($i = 0,$k = 0; $i < $NumberOfCores; $i++,$k+=2)
64
        {
65
                $InitialRow = sprintf('%X', $i*$Delta *(2 ** $Scale));
66
                $FinalRow   = sprintf('%X', ($i+1)*$Delta *(2 ** $Scale));
67
                $array[7+$k]   = "0 $InitialRow 0\t\t //Core $i Start";
68
                $array[7+$k+1] = "$ScaledWidht $FinalRow 0\t\t //Core $i End";
69
        }
70
 
71
 
72
untie @array;

powered by: WebSVN 2.1.0

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