mirror of https://github.com/VLSIDA/OpenRAM.git
Use conda to install the tools needed
This commit is contained in:
parent
5816c669f3
commit
ca03da8d95
|
|
@ -17,6 +17,7 @@ compiler/tests/results/
|
|||
open_pdks/
|
||||
dist/
|
||||
openram.egg-info/
|
||||
miniconda/
|
||||
sky130A/
|
||||
sky130B/
|
||||
skywater-pdk/
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ include Makefile
|
|||
include openram.mk
|
||||
include setpaths.sh
|
||||
include requirements.txt
|
||||
include install_conda.sh
|
||||
include docker/*
|
||||
recursive-include compiler *
|
||||
recursive-include technology *
|
||||
|
|
|
|||
15
__init__.py
15
__init__.py
|
|
@ -23,6 +23,21 @@ if "OPENRAM_HOME" not in os.environ.keys():
|
|||
# Prepend $OPENRAM_HOME to __path__ so that openram will use those modules
|
||||
__path__.insert(0, OPENRAM_HOME)
|
||||
|
||||
|
||||
# Find the conda installation directory
|
||||
if os.path.exists(OPENRAM_HOME + "/install_conda.sh"):
|
||||
CONDA_HOME = OPENRAM_HOME + "/miniconda"
|
||||
elif os.path.exists(OPENRAM_HOME + "/../install_conda.sh"):
|
||||
CONDA_HOME = os.path.abspath(OPENRAM_HOME + "/../miniconda")
|
||||
|
||||
# Add CONDA_HOME to environment variables
|
||||
try:
|
||||
os.environ["CONDA_HOME"] = CONDA_HOME
|
||||
except:
|
||||
from openram import debug
|
||||
debug.warning("Couldn't find install_conda.sh")
|
||||
|
||||
|
||||
# Import everything in globals.py
|
||||
from .globals import *
|
||||
# Import classes in the "openram" namespace
|
||||
|
|
|
|||
|
|
@ -196,6 +196,8 @@ def init_openram(config_file, is_unit_test=False):
|
|||
|
||||
read_config(config_file, is_unit_test)
|
||||
|
||||
install_conda()
|
||||
|
||||
import_tech()
|
||||
|
||||
set_default_corner()
|
||||
|
|
@ -230,6 +232,19 @@ def init_openram(config_file, is_unit_test=False):
|
|||
CHECKPOINT_OPTS = copy.copy(OPTS)
|
||||
|
||||
|
||||
def install_conda():
|
||||
""" Setup conda for default tools. """
|
||||
|
||||
# Don't setup conda if not used
|
||||
if not OPTS.use_conda or OPTS.is_unit_test:
|
||||
return
|
||||
|
||||
debug.info(1, "Creating conda setup...");
|
||||
|
||||
from openram import CONDA_HOME
|
||||
subprocess.call("./install_conda.sh", cwd=os.path.abspath(CONDA_HOME + "/.."))
|
||||
|
||||
|
||||
def setup_bitcell():
|
||||
"""
|
||||
Determine the correct custom or parameterized bitcell for the design.
|
||||
|
|
|
|||
|
|
@ -121,6 +121,9 @@ class options(optparse.Values):
|
|||
###################
|
||||
# Tool options
|
||||
###################
|
||||
# Use conda to install the default tools
|
||||
# (existing tools will be used if disabled)
|
||||
use_conda = True
|
||||
# Variable to select the variant of spice
|
||||
spice_name = None
|
||||
# The spice executable being used which is derived from the user PATH.
|
||||
|
|
|
|||
|
|
@ -29,6 +29,21 @@ def run_script(cell_name, script="lvs"):
|
|||
|
||||
scriptpath = '{0}run_{1}.sh'.format(OPTS.openram_temp, script)
|
||||
|
||||
# Wrap with conda activate & conda deactivate
|
||||
if OPTS.use_conda:
|
||||
from openram import CONDA_HOME
|
||||
with open(scriptpath, "r") as f:
|
||||
script_content = f.readlines()
|
||||
with open(scriptpath, "w") as f:
|
||||
# First line is shebang
|
||||
f.write(script_content[0] + "\n")
|
||||
# Activate conda using the activate script
|
||||
f.write("source {}/bin/activate\n".format(CONDA_HOME))
|
||||
for line in script_content[1:]:
|
||||
f.write(line + "\n")
|
||||
# Deactivate conda at the end
|
||||
f.write("conda deactivate\n")
|
||||
|
||||
debug.info(2, "Starting {}".format(scriptpath))
|
||||
start = time.time()
|
||||
with open(outfile, 'wb') as fo, open(errfile, 'wb') as fe:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
CONDA_INSTALLER_URL="https://repo.anaconda.com/miniconda/Miniconda3-py38_22.11.1-1-Linux-x86_64.sh"
|
||||
CONDA_INSTALLER_FILE="miniconda_installer_py38.sh"
|
||||
CONDA_BASE="miniconda"
|
||||
|
||||
TOOLS="klayout magic netgen ngspice trilinos xyce"
|
||||
|
||||
# Install miniconda if not installed
|
||||
if [ ! -d "miniconda" ]
|
||||
then
|
||||
curl -s -o ${CONDA_INSTALLER_FILE} ${CONDA_INSTALLER_URL}
|
||||
/bin/bash ${CONDA_INSTALLER_FILE} -b -p ${CONDA_BASE}
|
||||
rm ${CONDA_INSTALLER_FILE}
|
||||
source ${CONDA_BASE}/bin/activate
|
||||
|
||||
# Install iverilog from conda-eda
|
||||
conda install -y -c litex-hub iverilog
|
||||
|
||||
# Install rest of the tools from vlsida-eda
|
||||
for tool in ${TOOLS}
|
||||
do
|
||||
conda install -y -c vlsida-eda ${tool}
|
||||
done
|
||||
|
||||
conda deactivate
|
||||
fi
|
||||
|
||||
# TODO: Check if all tools are installed in case the miniconda is already installed
|
||||
|
||||
#SEARCH_PATTERN=$(echo "${TOOLS}" | tr -s '[:blank:]' '|')
|
||||
#INSTALLED_TOOLS=$(conda list | grep -o -E "${SEARCH_PATTERN}")
|
||||
#echo "${SEARCH_PATTERN}"
|
||||
#echo "${INSTALLED_TOOLS}"
|
||||
Loading…
Reference in New Issue