#!/usr/bin/env python
|
#!/usr/bin/env python3
|
#
|
#
|
# This script sets up the environment to run ModelSim on each module.
|
# This script sets up the environment to run ModelSim on each module.
|
#
|
#
|
# It sets up a relative path to your specific directory mapping by creating
|
# It sets up a relative path to your specific directory mapping by creating
|
# a file "mgc_location_map". We use the loction mapping so all paths to source
|
# a file "mgc_location_map". We use the loction mapping so all paths to source
|
# files are relative.
|
# files are relative.
|
#
|
#
|
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
# Copyright (C) 2014 Goran Devic
|
# Copyright (C) 2014 Goran Devic
|
#
|
#
|
# This program is free software; you can redistribute it and/or modify it
|
# This program is free software; you can redistribute it and/or modify it
|
# under the terms of the GNU General Public License as published by the Free
|
# under the terms of the GNU General Public License as published by the Free
|
# Software Foundation; either version 2 of the License, or (at your option)
|
# Software Foundation; either version 2 of the License, or (at your option)
|
# any later version.
|
# any later version.
|
#
|
#
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
# more details.
|
# more details.
|
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
import os
|
import os
|
|
|
def setup():
|
def setup():
|
# Create mgc_location_map with relative path mapping
|
# Create mgc_location_map with relative path mapping
|
# Assumes this directory hierarchy:
|
# Assumes this directory hierarchy:
|
# $ROOT/<block>/<module>/simulation/modelsim/work/<this script>.py
|
# $ROOT/<block>/<module>/simulation/modelsim/work/<this script>.py
|
with open("mgc_location_map", "w") as f:
|
with open("mgc_location_map", "w") as f:
|
f.write("$ROOT\n")
|
f.write("$ROOT\n")
|
path = os.path.abspath("../../../.")
|
path = os.path.abspath("../../../.")
|
f.write(os.path.dirname(path))
|
f.write(os.path.dirname(path))
|
|
print ("Setting up", os.getcwd())
|
|
|
# Return to our current directory after each module has been visited
|
# Return to our current directory after each module has been visited
|
abspath = os.path.abspath(__file__)
|
abspath = os.path.abspath(__file__)
|
dname = os.path.dirname(abspath)
|
dname = os.path.dirname(abspath)
|
|
|
# Visit each ModelSim project directory...
|
# Visit each ModelSim project directory...
|
os.chdir("cpu/alu/simulation/modelsim")
|
os.chdir("cpu/alu/simulation/modelsim")
|
setup()
|
setup()
|
os.chdir(dname)
|
os.chdir(dname)
|
|
|
os.chdir("cpu/bus/simulation/modelsim")
|
os.chdir("cpu/bus/simulation/modelsim")
|
setup()
|
setup()
|
os.chdir(dname)
|
os.chdir(dname)
|
|
|
os.chdir("cpu/control/simulation/modelsim")
|
os.chdir("cpu/control/simulation/modelsim")
|
setup()
|
setup()
|
os.chdir(dname)
|
os.chdir(dname)
|
|
|
os.chdir("cpu/registers/simulation/modelsim")
|
os.chdir("cpu/registers/simulation/modelsim")
|
setup()
|
setup()
|
os.chdir(dname)
|
os.chdir(dname)
|
|
|
os.chdir("cpu/toplevel/simulation/modelsim")
|
os.chdir("cpu/toplevel/simulation/modelsim")
|
setup()
|
setup()
|
os.chdir(dname)
|
os.chdir(dname)
|
|
|
os.chdir("host/basic/simulation/modelsim")
|
os.chdir("host/basic_de1/simulation/modelsim")
|
setup()
|
|
os.chdir(dname)
|
|
|
|
os.chdir("host/basic/uart/modelsim")
|
|
setup()
|
setup()
|
os.chdir(dname)
|
os.chdir(dname)
|
|
|