OpenRAM/__init__.py

50 lines
1.5 KiB
Python
Raw Normal View History

2022-10-25 21:22:18 +02:00
# See LICENSE for licensing information.
#
2023-01-29 07:56:27 +01:00
# Copyright (c) 2016-2023 Regents of the University of California and The Board
2022-10-25 21:22:18 +02:00
# of Regents for the Oklahoma Agricultural and Mechanical College
# (acting for and on behalf of Oklahoma State University)
# All rights reserved.
#
import os
# Attempt to add the source code to the PYTHONPATH here before running globals.init_openram().
try:
OPENRAM_HOME = os.path.abspath(os.environ.get("OPENRAM_HOME"))
except:
2022-11-22 00:38:49 +01:00
OPENRAM_HOME = os.path.dirname(os.path.abspath(__file__)) + "/compiler"
2022-10-25 21:22:18 +02:00
if not os.path.isdir(OPENRAM_HOME):
assert False
2022-11-27 22:01:20 +01:00
# Make sure that OPENRAM_HOME is an environment variable just in case
if "OPENRAM_HOME" not in os.environ.keys():
os.environ["OPENRAM_HOME"] = OPENRAM_HOME
2022-11-27 22:01:20 +01:00
# Prepend $OPENRAM_HOME to __path__ so that openram will use those modules
__path__.insert(0, OPENRAM_HOME)
2023-01-21 00:34:45 +01:00
# 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")
2022-11-27 22:01:20 +01:00
# Import everything in globals.py
from .globals import *
# Import classes in the "openram" namespace
# sram_config should be imported before sram
from .sram_config import *
from .sram import *
2023-03-08 09:08:43 +01:00
from .rom_config import *
from .rom import *