| 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 |
31 |
ste.fis |
## and/or other materials provided with the distribution.
|
| 17 |
2 |
ste.fis |
##
|
| 18 |
|
|
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 19 |
|
|
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 20 |
|
|
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 21 |
|
|
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
| 22 |
|
|
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
| 23 |
|
|
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
| 24 |
|
|
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
| 25 |
|
|
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
| 26 |
|
|
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
| 27 |
|
|
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
| 28 |
|
|
## POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
|
|
##
|
| 30 |
|
|
################################################################################
|
| 31 |
|
|
## filename: picoblaze_wb_gpio_tb.do
|
| 32 |
|
|
## description: ModelSim (R) do-macro / tcl-script for picoblaze_wb_gpio_tb hdl
|
| 33 |
|
|
## testbench
|
| 34 |
|
|
## todo4user: modify working directory and hdl variables
|
| 35 |
|
|
## version: 0.0.0
|
| 36 |
|
|
## changelog: - 0.0.0, initial release
|
| 37 |
|
|
## - ...
|
| 38 |
|
|
################################################################################
|
| 39 |
|
|
|
| 40 |
|
|
# IMPORTANT NOTICE!
|
| 41 |
|
|
# Verilog (R) simulation flow requires Xilinx (R) ISE (R) to be installed.
|
| 42 |
|
|
|
| 43 |
25 |
ste.fis |
# user settings: preferred hdl, working directory and Xilinx (R) ISE (R)
|
| 44 |
|
|
# installation path (needed for Verilog (R) simulation)
|
| 45 |
|
|
set wd "d:/projects/wb4pb/sim"
|
| 46 |
20 |
ste.fis |
set isVHDL yes
|
| 47 |
25 |
ste.fis |
set XILINX_ISE_PATH "c:/xilinx/13.1"
|
| 48 |
2 |
ste.fis |
|
| 49 |
|
|
# working directory cannot be changed while simulation is running
|
| 50 |
|
|
if {![string equal -nocase [pwd] $wd]} {
|
| 51 |
|
|
quit -sim
|
| 52 |
|
|
cd $wd
|
| 53 |
|
|
}
|
| 54 |
|
|
|
| 55 |
|
|
# creating library work, if not existing
|
| 56 |
|
|
if {[glob -nocomplain -types d "work"] == {}} {
|
| 57 |
|
|
vlib work
|
| 58 |
|
|
}
|
| 59 |
|
|
|
| 60 |
|
|
# compiling hdl modules and starting simulator
|
| 61 |
|
|
if {$isVHDL} {
|
| 62 |
|
|
|
| 63 |
|
|
vcom -check_synthesis "../rtl/picoblaze_wb_gpio.vhd"
|
| 64 |
|
|
vcom -check_synthesis "../rtl/wbm_picoblaze.vhd"
|
| 65 |
|
|
vcom -check_synthesis "../rtl/wbs_gpio.vhd"
|
| 66 |
|
|
vcom "../rtl/kcpsm3.vhd"
|
| 67 |
|
|
vcom "../asm/pbwbgpio.vhd"
|
| 68 |
|
|
vcom "../sim/hdl/picoblaze_wb_gpio_tb.vhd"
|
| 69 |
|
|
|
| 70 |
|
|
vsim picoblaze_wb_gpio_tb behavioral
|
| 71 |
|
|
|
| 72 |
|
|
} else {
|
| 73 |
|
|
|
| 74 |
|
|
vlog "../rtl/picoblaze_wb_gpio.v"
|
| 75 |
|
|
vlog "../rtl/wbm_picoblaze.v"
|
| 76 |
|
|
vlog "../rtl/wbs_gpio.v"
|
| 77 |
|
|
vlog "../rtl/kcpsm3.v"
|
| 78 |
|
|
vlog "../asm/pbwbgpio.v"
|
| 79 |
|
|
vlog "../sim/hdl/picoblaze_wb_gpio_tb.v"
|
| 80 |
25 |
ste.fis |
vlog "${XILINX_ISE_PATH}/ise_ds/ise/verilog/src/glbl.v"
|
| 81 |
2 |
ste.fis |
|
| 82 |
|
|
vsim picoblaze_wb_gpio_tb glbl
|
| 83 |
|
|
|
| 84 |
|
|
}
|
| 85 |
|
|
|
| 86 |
|
|
# configuring wave window
|
| 87 |
|
|
view -undock -x 0 -y 0 -width 1024 -height 640 wave
|
| 88 |
|
|
|
| 89 |
|
|
# adding signals of interest
|
| 90 |
|
|
|
| 91 |
|
|
proc add_wave_sys_sig? {on_off_n} {
|
| 92 |
|
|
if {$on_off_n} {
|
| 93 |
|
|
add wave -divider "SYSTEM SIGNALS"
|
| 94 |
|
|
add wave sim:/dut/rst
|
| 95 |
|
|
add wave sim:/dut/clk
|
| 96 |
|
|
}
|
| 97 |
|
|
}
|
| 98 |
|
|
|
| 99 |
|
|
proc add_wave_wb_sig? {on_off_n} {
|
| 100 |
|
|
if {$on_off_n} {
|
| 101 |
|
|
add wave -divider "WISHBONE SIGNALS"
|
| 102 |
|
|
#add wave sim:/dut/wb_cyc
|
| 103 |
|
|
add wave sim:/dut/wb_stb
|
| 104 |
|
|
add wave sim:/dut/wb_we
|
| 105 |
|
|
add wave -radix hex sim:/dut/wb_adr
|
| 106 |
|
|
add wave -radix hex sim:/dut/wb_dat_m2s
|
| 107 |
|
|
add wave -radix hex sim:/dut/wb_dat_s2m
|
| 108 |
|
|
add wave sim:/dut/wb_ack
|
| 109 |
|
|
}
|
| 110 |
|
|
}
|
| 111 |
|
|
|
| 112 |
|
|
proc add_wave_pbport_sig? {on_off_n} {
|
| 113 |
|
|
if {$on_off_n} {
|
| 114 |
|
|
add wave -divider "PICOBLAZE PORT SIGNALS"
|
| 115 |
|
|
add wave -radix hex sim:/dut/pb_port_id
|
| 116 |
|
|
add wave sim:/dut/pb_write_strobe
|
| 117 |
|
|
add wave -radix hex sim:/dut/pb_out_port
|
| 118 |
|
|
add wave sim:/dut/pb_read_strobe
|
| 119 |
|
|
add wave -radix hex sim:/dut/pb_in_port
|
| 120 |
|
|
}
|
| 121 |
|
|
}
|
| 122 |
|
|
|
| 123 |
|
|
proc add_wave_pbimem_sig? {on_off_n} {
|
| 124 |
|
|
if {$on_off_n} {
|
| 125 |
|
|
add wave -divider "PICOBLAZE INSTRUCTION MEMORY SIGNALS"
|
| 126 |
|
|
add wave -radix hex sim:/dut/address
|
| 127 |
|
|
add wave -radix hex sim:/dut/instruction
|
| 128 |
|
|
}
|
| 129 |
|
|
}
|
| 130 |
|
|
|
| 131 |
|
|
proc add_wave_gpio_sig? {on_off_n} {
|
| 132 |
|
|
if {$on_off_n} {
|
| 133 |
|
|
add wave -divider "GPIO SIGNALS"
|
| 134 |
|
|
add wave -radix hex sim:/dut/gpio_in
|
| 135 |
|
|
add wave -radix hex sim:/dut/gpio_out
|
| 136 |
|
|
add wave -radix hex sim:/dut/gpio_oe
|
| 137 |
|
|
add wave -radix hex sim:/dut/p_gpio_io
|
| 138 |
|
|
}
|
| 139 |
|
|
}
|
| 140 |
|
|
|
| 141 |
|
|
# selecting active signal groups
|
| 142 |
|
|
add_wave_sys_sig? yes
|
| 143 |
|
|
add_wave_wb_sig? yes
|
| 144 |
|
|
add_wave_pbport_sig? yes
|
| 145 |
|
|
add_wave_pbimem_sig? no
|
| 146 |
|
|
add_wave_gpio_sig? yes
|
| 147 |
|
|
|
| 148 |
|
|
# setting simulation runtime
|
| 149 |
|
|
run 10 us
|
| 150 |
|
|
|
| 151 |
|
|
# zooming to time area of interest
|
| 152 |
|
|
wave zoomfull
|