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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [icarus_version/] [scripts/] [configure_gpu.pl] - Blame information for rev 214

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 177 diegovalve
$NumberOfBanks = $ARGV[1];
24 195 diegovalve
$MaxVertexBufferSize = $ARGV[2];
25
$MaxTextureBufferSize = $ARGV[3];
26 169 diegovalve
 
27 177 diegovalve
 
28
 
29 195 diegovalve
 
30 169 diegovalve
die "\nusage:\nconfigure_gpu.pl number_of_cores width height\n\n" if (not defined $NumberOfCores );
31 177 diegovalve
 
32
 
33
if (not defined $NumberOfBanks)
34
{
35
  $NumberOfBanks = $NumberOfCores;
36 195 diegovalve
  print "Number of TMEM banks not specified, making default to Number of execution cores ($NumberOfCores)\n";;
37 177 diegovalve
}
38 195 diegovalve
if (not defined $MaxVertexBufferSize)
39
{
40
        $MaxVertexBufferSize = 7000;
41
        print "Vertex Buffer Size was no defined\n, making vertex buffer size default value of $MaxVertexBufferSize Bytes\n";
42
}
43
if (not defined $MaxTextureBufferSize)
44
{
45
        print "Texture Buffer Size was no defined\n, making texture buffer big enough to store 256x256 textures\n";
46
        $MaxTextureBufferSize = 256*256*3;
47
}
48 177 diegovalve
 
49 169 diegovalve
$DefsPath = "../rtl/aDefinitions.v";
50
$TopPath = "../rtl/Theia.v";
51 195 diegovalve
 
52 169 diegovalve
$TestBenchPath = "../rtl/TestBench_THEIA.v";
53
$RCOMMIT_O = "assign RCOMMIT_O = wRCommited[0]";
54
$HDL_O = "assign HDL_O = wHostDataLatched[0]";
55
$DONE_O = "assign DONE_O = wDone[0]";
56
$index=$NumberOfCores-1;
57
$BankRequest = "iRequest( {wBankReadRequest[$index][Bank]";
58
$SELECT_ALL_CORES = "define SELECT_ALL_CORES `MAX_CORES'b1";
59
 
60
$Scale = 17;
61
 
62
print
63
"
64 177 diegovalve
Applying configuration for:
65
    $NumberOfCores execution cores
66
        $NumberOfBanks TMEM banks
67 169 diegovalve
";
68
 
69
#------------------------------------------------------------------
70
for ($i = 1; $i < $NumberOfCores; $i++)
71
{
72
        $RCOMMIT_O .= " & wRCommited[$i]";
73
        $HDL_O .= " &  wHostDataLatched[$i]";
74
        $DONE_O .= " & wDone[$i]";
75
        $index=$NumberOfCores-$i-1;
76
        #print "$NumberOfCores $i: $index\n";
77
        $BankRequest .= ",wBankReadRequest[$index][Bank]";
78
        $SELECT_ALL_CORES .= "1";
79
}
80
 
81
 
82
tie my @array, 'Tie::File', $DefsPath or die "Can't open $DefsPath: $!";
83
foreach (@array)
84
{
85
    s/define MAX_CORES .*(\/\/.*)/define MAX_CORES $NumberOfCores \t\t$1/;
86 177 diegovalve
        s/define MAX_TMEM_BANKS .*(\/\/.*)/define MAX_TMEM_BANKS $NumberOfBanks \t\t$1/;
87
        $MaxCoreBits = log( $NumberOfCores ) / log(2);
88
        $MaxBankBits = log( $NumberOfBanks ) / log(2);
89 195 diegovalve
        $MaxParamSize = (19 + 3*2*$NumberOfCores);
90
 
91 177 diegovalve
        s/define MAX_CORE_BITS .*(\/\/.*)/define MAX_CORE_BITS $MaxCoreBits \t\t$1/;
92 169 diegovalve
        s/define SELECT_ALL_CORES .*(\/\/.*)/$SELECT_ALL_CORES \t\t$1/;
93 177 diegovalve
        s/define MAX_TMEM_BITS .*(\/\/.*)/define MAX_TMEM_BITS $MaxBankBits \t\t$1/;
94 195 diegovalve
        s/define PARAMS_ARRAY_SIZE .*(\/\/.*)/define PARAMS_ARRAY_SIZE $MaxParamSize \t\t$1/;
95
        s/define VERTEX_ARRAY_SIZE .*(\/\/.*)/define VERTEX_ARRAY_SIZE $MaxVertexBufferSize \t\t$1/;
96
        s/define TEXTURE_BUFFER_SIZE .*(\/\/.*)/define TEXTURE_BUFFER_SIZE $MaxTextureBufferSize \t\t$1/;
97 169 diegovalve
}
98
untie @array;
99
 
100
 
101
 
102
tie my @array, 'Tie::File', $TopPath or die "Can't open $TopPath: $!";
103
foreach (@array)
104
{
105
    s/assign RCOMMIT_O =.*/$RCOMMIT_O;/;
106
        s/assign HDL_O =.*/$HDL_O;/;
107
        s/assign DONE_O =.*/$DONE_O;/;
108
        s/iRequest\(\s*{wBankReadRequest.*/$BankRequest}\),/;
109
 
110
}
111
untie @array;
112
 
113
$MaxFileLines = 96 + 3*2*$NumberOfCores;
114
tie my @array, 'Tie::File', $TestBenchPath or die "Can't open $TestBenchPath: $!";
115
foreach (@array)
116
{
117
    s/reg\s+\[31\:0\]\s+rSceneParameters.*/reg [31:0] rSceneParameters[$MaxFileLines:0];/;
118
}
119
untie @array;
120
 

powered by: WebSVN 2.1.0

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