URL
https://opencores.org/ocsvn/openmsp430/openmsp430/trunk
Subversion Repositories openmsp430
[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [bin/] [msp430sim] - Rev 111
Go to most recent revision | Compare with Previous | Blame | View Log
#!/bin/bash#------------------------------------------------------------------------------# Copyright (C) 2001 Authors## This source file may be used and distributed without restriction provided# that this copyright statement is not removed from the file and that any# derivative work contains the original copyright notice and the associated# disclaimer.## This source file is free software; you can redistribute it and/or modify# it under the terms of the GNU Lesser General Public License as published# by the Free Software Foundation; either version 2.1 of the License, or# (at your option) any later version.## This source is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public# License for more details.## You should have received a copy of the GNU Lesser General Public License# along with this source; if not, write to the Free Software Foundation,# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA##------------------------------------------------------------------------------## File Name: msp430sim## Author(s):# - Olivier Girard, olgirard@gmail.com##------------------------------------------------------------------------------# $Rev: 111 $# $LastChangedBy: olivier.girard $# $LastChangedDate: 2011-05-20 22:39:02 +0200 (Fri, 20 May 2011) $#------------------------------------------------------------------------------################################################################################ Parameter Check ################################################################################EXPECTED_ARGS=1if [ $# -ne $EXPECTED_ARGS ]; thenecho "ERROR : wrong number of arguments"echo "USAGE : msp430sim <test name>"echo "Example : msp430sim c-jump_jge"echo ""echo "In order to switch the verilog simulator, the MYVLOG environment"echo "variable can be set to the following values:"echo ""echo " - iverilog : Icarus Verilog (default)"echo " - cver : CVer"echo " - verilog : Verilog-XL"echo " - ncverilog : NC-Verilog"echo " - vcs : VCS"echo " - vsim : Modelsim"echo ""exit 1fi################################################################################ Check if the required files exist ################################################################################asmfile=../src/$1.s43;verfile=../src/$1.v;submitfile=../src/submit.f;incfile=../../../rtl/verilog/openMSP430_defines.v;deffile=../bin/template.def;if [ ! -e $asmfile ]; thenecho "Assembler file $asmfile doesn't exist: $asmfile"exit 1fiif [ ! -e $verfile ]; thenecho "Verilog stimulus file $verfile doesn't exist: $verfile"exit 1fiif [ ! -e $submitfile ]; thenecho "Verilog submit file $submitfile doesn't exist: $submitfile"exit 1fiif [ ! -e $deffile ]; thenecho "Linker definition file template doesn't exist: $deffile"exit 1fi################################################################################ Cleanup ################################################################################echo "Cleanup..."rm -rf *.vcdrm -rf *.vpdrm -rf *.trnrm -rf *.dsnrm -rf pmem.*rm -rf stimulus.v################################################################################ Run simulation ################################################################################echo " ======================================================="echo "| Start simulation: $1"echo " ======================================================="# Create linksln -s $asmfile pmem.s43ln -s $verfile stimulus.v# Make local copy of the openMSP403 configuration file and remove commentscp $incfile ./pmem.incsed -i "/^\/\// s,.*,," pmem.inc# Get Program Memory sizepmemunit=`grep PMEM_SIZE_ pmem.inc | grep -v ifdef | grep -v "//" | cut -d'_' -f4`pmemsize=`grep PMEM_SIZE_ pmem.inc | grep -v ifdef | grep -v "//" | cut -d'_' -f3`pmemsize=${pmemsize/p/.}if [ $pmemunit == "KB" ]thenpmemsize=`echo "pmemsize=$pmemsize * 1024; pmemsize /= 1; pmemsize" | bc`fi# Get Data Memory sizedmemunit=`grep DMEM_SIZE_ pmem.inc | grep -v ifdef | grep -v "//" | cut -d'_' -f4`dmemsize=`grep DMEM_SIZE_ pmem.inc | grep -v ifdef | grep -v "//" | cut -d'_' -f3`dmemsize=${dmemsize/p/.}if [ $dmemunit == "KB" ]thendmemsize=`echo "dmemsize=$dmemsize * 1024; dmemsize /= 1; dmemsize" | bc`fi# Get Peripheral Address space sizeperunit=`grep PER_SIZE_ pmem.inc | grep -v ifdef | grep -v "//" | cut -d'_' -f4`persize=`grep PER_SIZE_ pmem.inc | grep -v ifdef | grep -v "//" | cut -d'_' -f3`persize=${persize/p/.}if [ $perunit == "KB" ]thenpersize=`echo "persize=$persize * 1024; persize /= 1; persize" | bc`fi# Compile assembler codeecho "Compile, link & generate IHEX file (Program Memory: $pmemsize B, Data Memory: $dmemsize B, Peripheral Space: $persize B)..."../bin/asm2ihex.sh pmem pmem.s43 $deffile $pmemsize $dmemsize $persize# Generate Program memory fileecho "Convert IHEX file to Verilog MEMH format..."../bin/ihex2mem.tcl -ihex pmem.ihex -out pmem.mem -mem_size $pmemsize# Start verilog simulationecho "Start Verilog simulation..."../bin/rtlsim.sh stimulus.v pmem.mem $submitfile
Go to most recent revision | Compare with Previous | Blame | View Log
