#!/bin/bash
|
#!/bin/bash
|
|
|
#
|
#
|
# This script runs RTL and gate-level simulation using different simultion tools.
|
# This script runs RTL and gate-level simulation using different simultion tools.
|
# Right now Cadence Verilog-XL and NCSim are supported.
|
# Right now Cadence Verilog-XL and NCSim are supported.
|
#
|
#
|
# Author: Damjan Lampret
|
# Author: Damjan Lampret
|
#
|
#
|
|
|
#
|
#
|
# User definitions
|
# User definitions
|
#
|
#
|
|
|
# Set simulation tool you are using (xl, ncsim, ncver)
|
# Set simulation tool you are using (xl, ncsim, ncver)
|
SIMTOOL=ncver
|
SIMTOOL=ncsim
|
|
|
# Set test bench top module(s)
|
# Set test bench top module(s)
|
TB_TOP="tb_tasks"
|
TB_TOP="tb_tasks"
|
|
|
# Set include directories
|
# Set include directories
|
INCLUDE_DIRS="../../../rtl/verilog/ ../../../bench/verilog/"
|
INCLUDE_DIRS="../../../rtl/verilog/ ../../../bench/verilog/"
|
|
|
# Set test bench files
|
# Set test bench files
|
BENCH_FILES="../../../bench/verilog/*.v"
|
BENCH_FILES="../../../bench/verilog/*.v"
|
|
|
# Set RTL source files
|
# Set RTL source files
|
RTL_FILES="../../../rtl/verilog/*.v"
|
RTL_FILES="../../../rtl/verilog/*.v"
|
|
|
# Set gate-level netlist files
|
# Set gate-level netlist files
|
GATE_FILES="../syn/out/final_gpio.v"
|
GATE_FILES="../syn/out/final_gpio.v"
|
|
|
# Set libraries (standard cell etc.)
|
# Set libraries (standard cell etc.)
|
LIB_FILES="/libs/Virtual_silicon/UMCL18U250D2_2.1/verilog_simulation_models/*.v"
|
LIB_FILES="/libs/Virtual_silicon/UMCL18U250D2_2.1/verilog_simulation_models/*.v"
|
|
|
# Set parameters for simulation tool
|
# Set parameters for simulation tool
|
if [ $SIMTOOL == xl ]; then
|
if [ $SIMTOOL == xl ]; then
|
PARAM="+turbo+3 -q"
|
PARAM="+turbo+3 -q"
|
for i in $INCLUDE_DIRS; do
|
for i in $INCLUDE_DIRS; do
|
INCDIR=$INCDIR" +incdir+$i"
|
INCDIR=$INCDIR" +incdir+$i"
|
done
|
done
|
elif [ $SIMTOOL == ncver ]; then
|
elif [ $SIMTOOL == ncver ]; then
|
NCVER_PARAM=""
|
NCVER_PARAM=""
|
for i in $INCLUDE_DIRS; do
|
for i in $INCLUDE_DIRS; do
|
INCDIR=$INCDIR" +incdir+$i"
|
INCDIR=$INCDIR" +incdir+$i"
|
done
|
done
|
elif [ $SIMTOOL == ncsim ]; then
|
elif [ $SIMTOOL == ncsim ]; then
|
NCPREP_PARAM="-UPDATE +overwrite"
|
NCPREP_PARAM="-UPDATE +overwrite"
|
NCSIM_PARAM="-MESSAGES -NOCOPYRIGHT"
|
NCSIM_PARAM="-MESSAGES -NOCOPYRIGHT"
|
for i in $INCLUDE_DIRS; do
|
for i in $INCLUDE_DIRS; do
|
INCDIR=$INCDIR" +incdir+$i"
|
INCDIR=$INCDIR" +incdir+$i"
|
done
|
done
|
else
|
else
|
echo "$SIMTOOL is unsupported simulation tool."
|
echo "$SIMTOOL is unsupported simulation tool."
|
exit 0
|
exit 0
|
fi
|
fi
|
|
|
#
|
#
|
# Don't change anything below unless you know what you are doing
|
# Don't change anything below unless you know what you are doing
|
#
|
#
|
|
|
# Run simulation in sim directory
|
# Run simulation in sim directory
|
cd ../sim
|
cd ../sim
|
|
|
# Run actual simulation
|
# Run actual simulation
|
|
|
# Cadence Verilog-XL
|
# Cadence Verilog-XL
|
if [ $SIMTOOL == xl ]; then
|
if [ $SIMTOOL == xl ]; then
|
|
|
# RTL simulation
|
# RTL simulation
|
if [ "$1" == rtl ]; then
|
if [ "$1" == rtl ]; then
|
verilog $PARAM $INCDIR $BENCH_FILES $RTL_FILES
|
verilog $PARAM $INCDIR $BENCH_FILES $RTL_FILES
|
|
|
# Gate-level simulation
|
# Gate-level simulation
|
elif [ "$1" == gate ]; then
|
elif [ "$1" == gate ]; then
|
verilog $PARAM $INCDIR $BENCH_FILES $GATE_FILES $LIB_FILES
|
verilog $PARAM $INCDIR $BENCH_FILES $GATE_FILES $LIB_FILES
|
|
|
# Wrong parameter or no parameter
|
# Wrong parameter or no parameter
|
else
|
else
|
echo "Usage: $0 [rtl|gate]"
|
echo "Usage: $0 [rtl|gate]"
|
exit 0
|
exit 0
|
fi
|
fi
|
|
|
# Cadence Ncverilog
|
# Cadence Ncverilog
|
elif [ $SIMTOOL == ncver ]; then
|
elif [ $SIMTOOL == ncver ]; then
|
|
|
# RTL simulation
|
# RTL simulation
|
if [ "$1" == rtl ]; then
|
if [ "$1" == rtl ]; then
|
ncverilog $NCVER_PARAM $INCDIR $BENCH_FILES $RTL_FILES
|
ncverilog $NCVER_PARAM $INCDIR $BENCH_FILES $RTL_FILES
|
cp ncverilog.log ../log
|
cp ncverilog.log ../log
|
|
|
# Gate-level simulation
|
# Gate-level simulation
|
elif [ "$1" == gate ]; then
|
elif [ "$1" == gate ]; then
|
ncverilog $NCVER_PARAM $INCDIR $BENCH_FILES $GATE_FILES $LIB_FILES
|
ncverilog $NCVER_PARAM $INCDIR $BENCH_FILES $GATE_FILES $LIB_FILES
|
cp ncverilog.log ../log
|
cp ncverilog.log ../log
|
|
|
# Wrong parameter or no parameter
|
# Wrong parameter or no parameter
|
else
|
else
|
echo "Usage: $0 [rtl|gate]"
|
echo "Usage: $0 [rtl|gate]"
|
exit 0
|
exit 0
|
fi
|
fi
|
|
|
# Cadence Ncsim
|
# Cadence Ncsim
|
elif [ $SIMTOOL == ncsim ]; then
|
elif [ $SIMTOOL == ncsim ]; then
|
|
|
# RTL simulation
|
# RTL simulation
|
if [ "$1" == rtl ]; then
|
if [ "$1" == rtl ]; then
|
ncprep $NCPREP_PARAM $INCDIR $BENCH_FILES $RTL_FILES
|
ncprep $NCPREP_PARAM $INCDIR $BENCH_FILES $RTL_FILES
|
./RUN_NC
|
./RUN_NC
|
|
|
# Gate-level simulation
|
# Gate-level simulation
|
elif [ "$1" == gate ]; then
|
elif [ "$1" == gate ]; then
|
ncprep $NCPREP_PARAM $INCDIR $BENCH_FILES $GATE_FILES $LIB_FILES
|
ncprep $NCPREP_PARAM $INCDIR $BENCH_FILES $GATE_FILES $LIB_FILES
|
./RUN_NC
|
./RUN_NC
|
|
|
# Wrong parameter or no parameter
|
# Wrong parameter or no parameter
|
else
|
else
|
echo "Usage: $0 [rtl|gate]"
|
echo "Usage: $0 [rtl|gate]"
|
exit 0
|
exit 0
|
fi
|
fi
|
|
|
# Unsupported simulation tool
|
# Unsupported simulation tool
|
else
|
else
|
echo "$SIMTOOL is unsupported simulation tool."
|
echo "$SIMTOOL is unsupported simulation tool."
|
exit 0;
|
exit 0;
|
fi
|
fi
|
|
|