1 |
5 |
ghutchis |
#!/usr/bin/env python
|
2 |
|
|
# Copyright (c) 2004 Guy Hutchison (ghutchis@opencores.org)
|
3 |
|
|
#
|
4 |
|
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
5 |
|
|
# copy of this software and associated documentation files (the "Software"),
|
6 |
|
|
# to deal in the Software without restriction, including without limitation
|
7 |
|
|
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
|
|
# and/or sell copies of the Software, and to permit persons to whom the
|
9 |
|
|
# Software is furnished to do so, subject to the following conditions:
|
10 |
|
|
#
|
11 |
|
|
# The above copyright notice and this permission notice shall be included
|
12 |
|
|
# in all copies or substantial portions of the Software.
|
13 |
|
|
#
|
14 |
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15 |
|
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16 |
|
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17 |
|
|
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18 |
|
|
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19 |
|
|
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20 |
|
|
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21 |
|
|
|
22 |
16 |
ghutchis |
import sys, os, getopt
|
23 |
5 |
ghutchis |
|
24 |
16 |
ghutchis |
def print_help ():
|
25 |
|
|
print "Usage: run [-dh] "
|
26 |
|
|
print " -d : instruction decode"
|
27 |
|
|
print " -h : option help (this list)"
|
28 |
|
|
sys.exit(0)
|
29 |
|
|
|
30 |
|
|
# parse command line options
|
31 |
|
|
# d : instruction trace
|
32 |
|
|
# h : help
|
33 |
|
|
(options, args) = getopt.getopt (sys.argv[1:], "dh")
|
34 |
|
|
if len(args) == 0:
|
35 |
|
|
print_help()
|
36 |
|
|
testname = args[0]
|
37 |
5 |
ghutchis |
simulator = "cver"
|
38 |
|
|
|
39 |
|
|
filelist = " -f env/tb.vf"
|
40 |
|
|
testdef = " +incdir+env -l logs/%s.log +define+DUMPFILE_NAME=\\\"logs/%s.dump\\\" +define+ROM_FILE=\\\"tests/%s.vmem\\\" +define+RAM_FILE=\\\"tests/%s.vmem\\\"" % (testname, testname, testname+"_rom", testname+"_ram")
|
41 |
|
|
|
42 |
16 |
ghutchis |
for option in options:
|
43 |
|
|
if option[0] == "-d":
|
44 |
|
|
print "Adding TV80_INSTRUCTION_DECODE"
|
45 |
|
|
testdef += " +define+TV80_INSTRUCTION_DECODE=1"
|
46 |
|
|
if option[0] == "-h":
|
47 |
|
|
print_help()
|
48 |
|
|
|
49 |
5 |
ghutchis |
os.chdir ("tests")
|
50 |
|
|
os.system ("make %s.vmem" % testname)
|
51 |
|
|
os.chdir ("..")
|
52 |
|
|
|
53 |
|
|
command = simulator + filelist + testdef
|
54 |
|
|
|
55 |
|
|
print "command:",command
|
56 |
|
|
os.system (command)
|
57 |
|
|
|