1 |
2 |
ste.fis |
################################################################################
|
2 |
|
|
## This sourcecode is released under BSD license.
|
3 |
|
|
## Please see http://www.opensource.org/licenses/bsd-license.php for details!
|
4 |
|
|
################################################################################
|
5 |
|
|
##
|
6 |
|
|
## Copyright (c) 2010, Stefan Fischer
|
7 |
|
|
## All rights reserved.
|
8 |
|
|
##
|
9 |
|
|
## Redistribution and use in source and binary forms, with or without
|
10 |
|
|
## modification, are permitted provided that the following conditions are met:
|
11 |
|
|
##
|
12 |
|
|
## * Redistributions of source code must retain the above copyright notice,
|
13 |
|
|
## this list of conditions and the following disclaimer.
|
14 |
|
|
## * Redistributions in binary form must reproduce the above copyright notice,
|
15 |
|
|
## this list of conditions and the following disclaimer in the documentation
|
16 |
|
|
## and/or other materials provided with the distribution.
|
17 |
|
|
## * Neither the name of the author nor the names of his contributors may be
|
18 |
|
|
## used to endorse or promote products derived from this software without
|
19 |
|
|
## specific prior written permission.
|
20 |
|
|
##
|
21 |
|
|
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
22 |
|
|
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
23 |
|
|
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
24 |
|
|
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
25 |
|
|
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
26 |
|
|
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
27 |
|
|
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
28 |
|
|
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
29 |
|
|
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
30 |
|
|
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
31 |
|
|
## POSSIBILITY OF SUCH DAMAGE.
|
32 |
|
|
##
|
33 |
|
|
################################################################################
|
34 |
|
|
## filename: picoblaze_wb_gpio_tb.do
|
35 |
|
|
## description: ModelSim (R) do-macro / tcl-script for picoblaze_wb_gpio_tb hdl
|
36 |
|
|
## testbench
|
37 |
|
|
## todo4user: modify working directory and hdl variables
|
38 |
|
|
## version: 0.0.0
|
39 |
|
|
## changelog: - 0.0.0, initial release
|
40 |
|
|
## - ...
|
41 |
|
|
################################################################################
|
42 |
|
|
|
43 |
|
|
# IMPORTANT NOTICE!
|
44 |
|
|
# Verilog (R) simulation flow requires Xilinx (R) ISE (R) to be installed.
|
45 |
|
|
|
46 |
|
|
# user settings: preferred hdl and working directory
|
47 |
9 |
ste.fis |
set wd "e:/home_users/ste.fis/projects/wb4pb/trunk/sim"
|
48 |
2 |
ste.fis |
set isVHDL no
|
49 |
|
|
|
50 |
|
|
# working directory cannot be changed while simulation is running
|
51 |
|
|
if {![string equal -nocase [pwd] $wd]} {
|
52 |
|
|
quit -sim
|
53 |
|
|
cd $wd
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
# creating library work, if not existing
|
57 |
|
|
if {[glob -nocomplain -types d "work"] == {}} {
|
58 |
|
|
vlib work
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
# compiling hdl modules and starting simulator
|
62 |
|
|
if {$isVHDL} {
|
63 |
|
|
|
64 |
|
|
vcom -check_synthesis "../rtl/picoblaze_wb_gpio.vhd"
|
65 |
|
|
vcom -check_synthesis "../rtl/wbm_picoblaze.vhd"
|
66 |
|
|
vcom -check_synthesis "../rtl/wbs_gpio.vhd"
|
67 |
|
|
vcom "../rtl/kcpsm3.vhd"
|
68 |
|
|
vcom "../asm/pbwbgpio.vhd"
|
69 |
|
|
vcom "../sim/hdl/picoblaze_wb_gpio_tb.vhd"
|
70 |
|
|
|
71 |
|
|
vsim picoblaze_wb_gpio_tb behavioral
|
72 |
|
|
|
73 |
|
|
} else {
|
74 |
|
|
|
75 |
|
|
vlog "../rtl/picoblaze_wb_gpio.v"
|
76 |
|
|
vlog "../rtl/wbm_picoblaze.v"
|
77 |
|
|
vlog "../rtl/wbs_gpio.v"
|
78 |
|
|
vlog "../rtl/kcpsm3.v"
|
79 |
|
|
vlog "../asm/pbwbgpio.v"
|
80 |
|
|
vlog "../sim/hdl/picoblaze_wb_gpio_tb.v"
|
81 |
|
|
vlog "$env(XILINX)/verilog/src/glbl.v"
|
82 |
|
|
|
83 |
|
|
vsim picoblaze_wb_gpio_tb glbl
|
84 |
|
|
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
# configuring wave window
|
88 |
|
|
view -undock -x 0 -y 0 -width 1024 -height 640 wave
|
89 |
|
|
|
90 |
|
|
# adding signals of interest
|
91 |
|
|
|
92 |
|
|
proc add_wave_sys_sig? {on_off_n} {
|
93 |
|
|
if {$on_off_n} {
|
94 |
|
|
add wave -divider "SYSTEM SIGNALS"
|
95 |
|
|
add wave sim:/dut/rst
|
96 |
|
|
add wave sim:/dut/clk
|
97 |
|
|
}
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
proc add_wave_wb_sig? {on_off_n} {
|
101 |
|
|
if {$on_off_n} {
|
102 |
|
|
add wave -divider "WISHBONE SIGNALS"
|
103 |
|
|
#add wave sim:/dut/wb_cyc
|
104 |
|
|
add wave sim:/dut/wb_stb
|
105 |
|
|
add wave sim:/dut/wb_we
|
106 |
|
|
add wave -radix hex sim:/dut/wb_adr
|
107 |
|
|
add wave -radix hex sim:/dut/wb_dat_m2s
|
108 |
|
|
add wave -radix hex sim:/dut/wb_dat_s2m
|
109 |
|
|
add wave sim:/dut/wb_ack
|
110 |
|
|
}
|
111 |
|
|
}
|
112 |
|
|
|
113 |
|
|
proc add_wave_pbport_sig? {on_off_n} {
|
114 |
|
|
if {$on_off_n} {
|
115 |
|
|
add wave -divider "PICOBLAZE PORT SIGNALS"
|
116 |
|
|
add wave -radix hex sim:/dut/pb_port_id
|
117 |
|
|
add wave sim:/dut/pb_write_strobe
|
118 |
|
|
add wave -radix hex sim:/dut/pb_out_port
|
119 |
|
|
add wave sim:/dut/pb_read_strobe
|
120 |
|
|
add wave -radix hex sim:/dut/pb_in_port
|
121 |
|
|
}
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
proc add_wave_pbimem_sig? {on_off_n} {
|
125 |
|
|
if {$on_off_n} {
|
126 |
|
|
add wave -divider "PICOBLAZE INSTRUCTION MEMORY SIGNALS"
|
127 |
|
|
add wave -radix hex sim:/dut/address
|
128 |
|
|
add wave -radix hex sim:/dut/instruction
|
129 |
|
|
}
|
130 |
|
|
}
|
131 |
|
|
|
132 |
|
|
proc add_wave_gpio_sig? {on_off_n} {
|
133 |
|
|
if {$on_off_n} {
|
134 |
|
|
add wave -divider "GPIO SIGNALS"
|
135 |
|
|
add wave -radix hex sim:/dut/gpio_in
|
136 |
|
|
add wave -radix hex sim:/dut/gpio_out
|
137 |
|
|
add wave -radix hex sim:/dut/gpio_oe
|
138 |
|
|
add wave -radix hex sim:/dut/p_gpio_io
|
139 |
|
|
}
|
140 |
|
|
}
|
141 |
|
|
|
142 |
|
|
# selecting active signal groups
|
143 |
|
|
add_wave_sys_sig? yes
|
144 |
|
|
add_wave_wb_sig? yes
|
145 |
|
|
add_wave_pbport_sig? yes
|
146 |
|
|
add_wave_pbimem_sig? no
|
147 |
|
|
add_wave_gpio_sig? yes
|
148 |
|
|
|
149 |
|
|
# setting simulation runtime
|
150 |
|
|
run 10 us
|
151 |
|
|
|
152 |
|
|
# zooming to time area of interest
|
153 |
|
|
wave zoomfull
|