-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathRS_ENC_LANE_QUATUS_vsim_script.tcl
More file actions
153 lines (133 loc) · 4.67 KB
/
RS_ENC_LANE_QUATUS_vsim_script.tcl
File metadata and controls
153 lines (133 loc) · 4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#########################################################################
#########################################################################
## Description : Generic script to be customized by Megawizard
## for running RTL, vital or IP Functional simulation in Modelsim
##
## ALTERA Proprietary
## Copyright 2008 (c) Altera Corporation
## All rights reserved
##
#########################################################################
#########################################################################
set megacore_lib_dir {f:/intelfpga/18.0/ip/altera/reed_solomon/lib/}
set design_name "RS_ENC_LANE_QUATUS"
set rs_arch "ENC"
set hdl_extension ".v"
global env
if ![info exists env(QUARTUS_ROOTDIR)] {
puts "Expected Enviroment variable QUARTUS_ROOTDIR pointing to a valid Quartus installation"
exit
}
set q_sim_lib [file join $env(QUARTUS_ROOTDIR) eda sim_lib]
quit -sim
set megacore_wrapper_dir [pwd]
onbreak {resume}
set test_bench_location $megacore_lib_dir
if {[info exists megacore_wrapper_dir]} {
set vsim_working_dir $megacore_wrapper_dir
} else {
puts "Error: megacore_wrapper_dir variable is not defined and not development mode identified: Exiting"
exit
}
if {![info exists use_ipfs]} {
set use_ipfs 1
}
if {![info exists rs_arch]} {
set rs_arch "DEC"
}
if {![info exists bypass_MW]} {
set bypass_MW "NO"
}
cd $vsim_working_dir
set st [string tolower $rs_arch]
set quartus_libs [list \
altera_mf {altera_mf_components altera_mf} {altera_mf} "$q_sim_lib" \
lpm {220pack 220model} {220model} "$q_sim_lib" \
sgate {sgate_pack sgate} {sgate} "$q_sim_lib" ]
if {[file exists ${design_name}.vho]} {
puts "Info: IPFS file ${design_name}.vho found"
set ext_ipfs "vho"
set use_ipfs 1
} elseif {[file exists ${design_name}.vo]} {
puts "Info: IPFS file ${design_name}.vo found"
set ext_ipfs "vo"
set use_ipfs 1
} else {
puts "Info: No IPFS model found. Simulating with ModelSim development library"
set use_ipfs 0
}
if {($use_ipfs == 1) && ([vsimAuth] != "ALTERA")} {
foreach {lib file_vhdl_list file_verilog_list src_files_loc} $quartus_libs {
vlib $lib
vmap $lib $lib
if {[string match "vho" $ext_ipfs]} {
foreach file_item $file_vhdl_list {
catch {vcom -explicit -93 -work $lib [file join $src_files_loc ${file_item}.vhd]} err_msg
if {![string match "" $err_msg]} {return $err_msg}
}
} elseif {[string match "vo" $ext_ipfs]} {
foreach file_item $file_verilog_list {
catch {vlog -work $lib [file join $src_files_loc ${file_item}.v]} err_msg
if {![string match "" $err_msg]} {return $err_msg}
}
}
}
}
catch {
vdel -lib rs_work -all
}
catch {
vlib rs_work
vmap rs_work [file join $vsim_working_dir rs_work]
}
catch {
if {$use_ipfs == 1} {
if {[string match "vho" $ext_ipfs]} {
vcom -explicit -93 -work rs_work [file join $vsim_working_dir ${design_name}.vho]
} elseif {[string match "vo" $ext_ipfs]} {
vlog -work rs_work [file join $vsim_working_dir ${design_name}.vo]
}
}
if {[string match ".vhd" $hdl_extension]} {
if {[string match -nocase "NO" $bypass_MW] && $use_ipfs==0} {
vcom -explicit -93 -work rs_work [file join $vsim_working_dir ${design_name}.vhd]
}
vcom -explicit -93 -work rs_work [file join $test_bench_location Bench_rs_${st}_atl_ent.vhd]
vcom -explicit -93 -work rs_work [file join $test_bench_location Bench_rs_${st}_atl_arc_ben.vhd]
vcom -explicit -93 -work rs_work [file join $vsim_working_dir ${design_name}_testbench.vhd]
} elseif {[string match ".v" $hdl_extension]} {
if {[string match -nocase "NO" $bypass_MW] && $use_ipfs==0} {
vlog -work rs_work [file join $vsim_working_dir ${design_name}.v]
}
vlog -vlog01compat -work rs_work [file join $test_bench_location Bench_rs_${st}_atl.v]
vlog -vlog01compat -work rs_work [file join $vsim_working_dir ${design_name}_testbench.v]
}
}
set timing_resolution "1ns"
if {$use_ipfs == 1} {
set timing_resolution "1ps"
}
if {[info exists run_ModelSim_vho]} {
if {[string match "YES" $run_ModelSim_vho]} {
set timing_resolution "1ps"
}
}
set vsim_cmd vsim
if {[vsimAuth] == "ALTERA"} {
lappend vsim_cmd "-L" "Sgate_ver" "-L" "altera_mf_ver" "-L" "lpm_ver"
} elseif {[vsimAuth] != "ALTERA"} {
lappend vsim_cmd "-L" "Sgate" "-L" "altera_mf" "-L" "lpm"
}
lappend vsim_cmd "rs_work.testbench"
lappend vsim_cmd "-t"
lappend vsim_cmd "$timing_resolution"
catch {
eval $vsim_cmd
add wave sim:/testbench/test_controller/sink_???
add wave sim:/testbench/test_controller/source_???
add wave sim:/testbench/test_controller/clk
add wave sim:/testbench/test_controller/reset
add wave sim:/testbench/test_controller/???????_2_bench
add wave sim:/testbench/test_controller/bench_2_???????
} vsim_msg
catch {run -all} run_msg