OpenCores
URL https://opencores.org/ocsvn/sdhc-sc-core/sdhc-sc-core/trunk

Subversion Repositories sdhc-sc-core

[/] [sdhc-sc-core/] [trunk/] [sim/] [sim.tcl] - Blame information for rev 185

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 164 rkastl
# SDHC-SC-Core
2
# Secure Digital High Capacity Self Configuring Core
3
# 
4 170 rkastl
# (C) Copyright 2010, Rainer Kastl
5
# All rights reserved.
6 164 rkastl
# 
7 170 rkastl
# Redistribution and use in source and binary forms, with or without
8
# modification, are permitted provided that the following conditions are met:
9
#     * Redistributions of source code must retain the above copyright
10
#       notice, this list of conditions and the following disclaimer.
11
#     * Redistributions in binary form must reproduce the above copyright
12
#       notice, this list of conditions and the following disclaimer in the
13
#       documentation and/or other materials provided with the distribution.
14
#     * Neither the name of the <organization> nor the
15
#       names of its contributors may be used to endorse or promote products
16
#       derived from this software without specific prior written permission.
17 164 rkastl
# 
18 170 rkastl
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  "AS IS" AND
19
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
22
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 164 rkastl
# 
29
# File        : sim.tcl
30
# Owner       : Rainer Kastl
31
# Description : Script for simulation
32
# Links       : 
33
# 
34 128 rkastl
 
35 164 rkastl
 
36 128 rkastl
proc compileWithPsl {fname grp en psl} {
37
        upvar $psl mpsl
38
 
39
        if [info exists mpsl($en)] {
40
                set pslfile "../../../grp$grp/unit$en/src/$mpsl($en).psl"
41
                if [file isfile $pslfile] {
42
                        vcom $fname -pslfile $pslfile
43
                } else {
44
                        echo "pslfile $pslfile not found"
45
                        vcom $fname
46
                }
47
        } else {
48
                vcom $fname
49
        }
50
};
51
 
52
proc compileUnit {grp en arch tpsl} {
53
        upvar $tpsl psl
54 79 rkastl
        set prefix ../../../grp$grp/unit$en/src
55
        if [file isfile $prefix/$en-e.vhdl] {
56 128 rkastl
                compileWithPsl "$prefix/$en-e.vhdl" $grp $en psl
57 79 rkastl
                if [file isfile $prefix/$en-$arch-a.vhdl] {
58
                        vcom "$prefix/$en-$arch-a.vhdl"
59
                }
60
        } elseif [file isfile $prefix/$en-$arch-ea.vhdl] {
61 128 rkastl
                compileWithPsl "$prefix/$en-$arch-ea.vhdl" $grp $en psl
62 79 rkastl
        } else {
63
                echo "Unit $grp $en $arch not found!"
64
        }
65
};
66
 
67 128 rkastl
 
68 79 rkastl
proc compileTb {grp en arch} {
69
        set prefix ../../../grp$grp/unit$en/src
70
                if [file isfile $prefix/tb$en-e.vhdl] {
71
                        vcom "$prefix/tb$en-e.vhdl"
72 128 rkastl
                        if [file isfile $prefix/tb$en-$arch-a.vhdl] {
73
                                vcom "$prefix/tb$en-$arch-a.vhdl"
74
                        }
75 79 rkastl
                } elseif [file isfile $prefix/tb$en-$arch-ea.vhdl] {
76
                        vcom "$prefix/tb$en-$arch-ea.vhdl"
77
                } else {
78
                        echo "Testbench $grp $en $arch not found!"
79
                }
80
};
81
 
82
vlib work
83
vmap work work
84
 
85 123 rkastl
if [info exists libs] {
86
        foreach {lib} $libs {
87
                vmap $lib ../../../lib$lib/sim/$lib
88
        }
89
}
90
 
91 79 rkastl
if [info exists pkgs] {
92
        foreach {grp pkg} $pkgs {
93
                set fname ../../../grp$grp/pkg$pkg/src/$pkg-p.vhdl
94
                        if [file isfile $fname] {
95
                                vcom "$fname"
96
                        } else {
97
                                echo "Pkg $grp $pkg not found!"
98
                        }
99
        }
100
}
101
 
102
if [info exists units] {
103
        foreach {grp en arch} $units {
104 128 rkastl
                compileUnit $grp $en $arch psl
105 79 rkastl
        }
106
}
107
 
108 128 rkastl
 
109
 
110 86 rkastl
if [info exists tbunits] {
111
        foreach {grp en arch} $tbunits {
112 137 rkastl
                if ![info exists psl] {
113
                        array set psl [list]
114
                }
115
                compileUnit $grp $en $arch psl
116 86 rkastl
        }
117
}
118
 
119 79 rkastl
if [info exists tb] {
120
        foreach {grp en arch} $tb {
121
                compileTb $grp $en $arch
122
 
123 85 rkastl
                set top tb$en
124
        }
125
}
126 79 rkastl
 
127 120 rkastl
if [info exists svtb] {
128
        foreach {grp unit} $svtb {
129
                set fname ../../../grp$grp/unit$unit/src/tb$unit.sv
130
                if [file isfile $fname] {
131
                        vlog $fname
132
                } else {
133
                        echo "Svunit $grp $unit not found! ($fname)"
134
                }
135
        }
136
}
137
 
138 85 rkastl
if [info exists svunits] {
139
        foreach {grp unit} $svunits {
140
                set fname ../../../grp$grp/unit$unit/src/$unit.sv
141
                if [file isfile $fname] {
142 135 rkastl
                        if [info exists sysvlogparams] {
143
                                vlog $fname $sysvlogparams
144
                        } else {
145
                                vlog $arg
146
                        }
147 85 rkastl
                } else {
148
                        echo "Svunit $grp $unit not found! ($fname)"
149 79 rkastl
                }
150 85 rkastl
        }
151
}
152 79 rkastl
 
153 85 rkastl
if ([info exists top]) {
154 106 rkastl
        if ([info exists vsimargs]) {
155
                vsim $vsimargs $top
156
        } else {
157
                vsim $top
158
        }
159 85 rkastl
 
160
        if [file isfile wave.do] {
161
                do wave.do
162
        }
163
 
164
        if [info exists simtime] {
165
                run $simtime
166
        } else {
167 79 rkastl
                run -all
168
        }
169
}

powered by: WebSVN 2.1.0

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