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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [xilinx_diligent_s3board/] [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 leds"
38
  exit 1
39
fi
40
 
41
 
42
###############################################################################
43
#                     Check if the required files exist                       #
44
###############################################################################
45
softdir=../../../software/$1;
46
elffile=../../../software/$1/$1.elf;
47
verfile=../src/$1.v;
48
submitfile=../src/submit.f;
49
incfile=../../../rtl/verilog/openMSP430.inc;
50
 
51
if [ ! -e $softdir ]; then
52
    echo "Software directory doesn't exist: $softdir"
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
 
64
 
65
###############################################################################
66
#                               Cleanup                                       #
67
###############################################################################
68
echo "Cleanup..."
69
rm -rf rom.*
70
rm -rf stimulus.v
71
 
72
 
73
###############################################################################
74
#                              Run simulation                                 #
75
###############################################################################
76
echo " ======================================================="
77
echo "| Start simulation:             $1"
78
echo " ======================================================="
79
 
80
# Make C program
81
cd $softdir
82
make
83
cd ../../sim/rtl_sim/run/
84
 
85
# Create links
86
ln -s $elffile rom.elf
87
ln -s $verfile stimulus.v
88
 
89
# Make local copy of the openMSP403 configuration file and remove comments
90
cp  $incfile  ./rom.inc
91
sed -i "/^\/\// s,.*,," rom.inc
92
 
93
# Get ROM size
94
romsize=`grep ROM_AWIDTH rom.inc | grep -v ROM_MSB | grep -v ROM_SIZE`
95
romsize=${romsize##* }
96
romsize=$((2<<$romsize))
97
 
98
# Create IHEX file from ELF
99
echo "Convert ELF file to IHEX format..."
100
msp430-objcopy -O ihex  rom.elf rom.ihex
101
 
102
# Generate ROM memory file
103
echo "Convert IHEX file to Verilog MEMH format..."
104
../bin/ihex2mem.tcl -ihex rom.ihex -out rom.mem -mem_size $romsize
105
 
106
# Start verilog simulation
107
echo "Start Verilog simulation..."
108
../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.