OpenCores
URL https://opencores.org/ocsvn/openmsp430/openmsp430/trunk

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [bin/] [msp430sim] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 olivier.gi
#!/bin/sh
2
#------------------------------------------------------------------------------
3
# Copyright (C) 2001 Authors
4
#
5
# This source file may be used and distributed without restriction provided
6
# that this copyright statement is not removed from the file and that any
7
# derivative work contains the original copyright notice and the associated
8
# disclaimer.
9
#
10
# This source file is free software; you can redistribute it and/or modify
11
# it under the terms of the GNU Lesser General Public License as published
12
# by the Free Software Foundation; either version 2.1 of the License, or
13
# (at your option) any later version.
14
#
15
# This source is distributed in the hope that it will be useful, but WITHOUT
16
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18
# License for more details.
19
#
20
# You should have received a copy of the GNU Lesser General Public License
21
# along with this source; if not, write to the Free Software Foundation,
22
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23
#
24
#------------------------------------------------------------------------------
25
#
26
# File Name: msp430sim
27
#
28
#------------------------------------------------------------------------------
29
 
30
###############################################################################
31
#                            Parameter Check                                  #
32
###############################################################################
33
EXPECTED_ARGS=1
34
if [ $# -ne $EXPECTED_ARGS ]; then
35
  echo "ERROR    : wrong number of arguments"
36
  echo "USAGE    : msp430sim "
37
  echo "Example  : msp430sim c-jump_jge"
38
  exit 1
39
fi
40
 
41
 
42
###############################################################################
43
#                     Check if the required files exist                       #
44
###############################################################################
45
asmfile=../src/$1.s43;
46
verfile=../src/$1.v;
47
submitfile=../src/submit.f;
48
incfile=../../../rtl/verilog/openMSP430.inc;
49
deffile=../bin/template.def;
50
 
51
if [ ! -e $asmfile ]; then
52
    echo "Assembler file $asmfile doesn't exist: $asmfile"
53
    exit 1
54
fi
55
if [ ! -e $verfile ]; then
56
    echo "Verilog stimulus file $verfile doesn't exist: $verfile"
57
    exit 1
58
fi
59
if [ ! -e $submitfile ]; then
60
    echo "Verilog submit file $submitfile doesn't exist: $submitfile"
61
    exit 1
62
fi
63
if [ ! -e $deffile ]; then
64
    echo "Linker definition file template doesn't exist: $deffile"
65
    exit 1
66
fi
67
 
68
 
69
###############################################################################
70
#                               Cleanup                                       #
71
###############################################################################
72
echo "Cleanup..."
73
rm -rf rom.*
74
rm -rf stimulus.v
75
 
76
 
77
###############################################################################
78
#                              Run simulation                                 #
79
###############################################################################
80
echo " ======================================================="
81
echo "| Start simulation:             $1"
82
echo " ======================================================="
83
 
84
# Create links
85
ln -s $asmfile rom.s43
86
ln -s $verfile stimulus.v
87
 
88
# Make local copy of the openMSP403 configuration file and remove comments
89
cp  $incfile  ./rom.inc
90
sed -i "/^\/\// s,.*,," rom.inc
91
 
92
# Get ROM size
93
romsize=`grep ROM_AWIDTH rom.inc | grep -v ROM_MSB | grep -v ROM_SIZE`
94
romsize=${romsize##* }
95
romsize=$((2<<$romsize))
96
 
97
# Get RAM size
98
ramsize=`grep RAM_AWIDTH rom.inc | grep -v RAM_MSB | grep -v RAM_SIZE`
99
ramsize=${ramsize##* }
100
ramsize=$((2<<$ramsize))
101
 
102
# Compile assembler code
103
echo "Compile, link & generate IHEX file (ROM: $romsize B, RAM: $ramsize B)..."
104
../bin/asm2ihex.sh  rom rom.s43 $deffile $romsize $ramsize
105
 
106
# Generate ROM memory file
107
echo "Convert IHEX file to Verilog MEMH format..."
108
../bin/ihex2mem.tcl -ihex rom.ihex -out rom.mem -mem_size $romsize
109
 
110
# Start verilog simulation
111
echo "Start Verilog simulation..."
112
../bin/rtlsim.sh    stimulus.v rom.mem $submitfile

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.