OpenRAM/compiler/characterizer/__init__.py

59 lines
2.0 KiB
Python
Raw Normal View History

# 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
2019-06-14 17:43:41 +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
2022-11-27 22:01:20 +01:00
from openram import debug
from openram import OPTS, find_exe, get_tool
from .lib import *
from .delay import *
from .elmore import *
from .linear_regression import *
from .neural_network import *
from .setup_hold import *
from .functional import *
from .simulation import *
from .measurements import *
from .model_check import *
from .analytical_util import *
2021-02-10 21:10:04 +01:00
debug.info(1, "Initializing characterizer...")
OPTS.spice_exe = ""
if not OPTS.analytical_delay:
if OPTS.spice_name:
# Capitalize Xyce
if OPTS.spice_name == "xyce":
OPTS.spice_name = "Xyce"
OPTS.spice_exe=find_exe(OPTS.spice_name)
if OPTS.spice_exe=="" or OPTS.spice_exe==None:
2021-02-10 21:10:04 +01:00
debug.error("{0} not found. Unable to perform characterization.".format(OPTS.spice_name), 1)
else:
2021-05-21 21:05:10 +02:00
(OPTS.spice_name, OPTS.spice_exe) = get_tool("spice", ["Xyce", "ngspice", "ngspice.exe", "hspice", "xa"])
2021-05-18 23:58:57 +02:00
if OPTS.spice_name in ["Xyce", "xyce"]:
2021-05-14 20:45:37 +02:00
(OPTS.mpi_name, OPTS.mpi_exe) = get_tool("mpi", ["mpirun"])
OPTS.hier_seperator = ":"
2021-05-14 20:45:37 +02:00
else:
OPTS.mpi_name = None
OPTS.mpi_exe = ""
2020-11-03 15:29:17 +01:00
# set the input dir for spice files if using ngspice
if OPTS.spice_name == "ngspice":
os.environ["NGSPICE_INPUT_DIR"] = "{0}".format(OPTS.openram_temp)
2020-11-03 15:29:17 +01:00
if not OPTS.spice_exe:
2021-02-10 21:10:04 +01:00
debug.error("No recognizable spice version found. Unable to perform characterization.", 1)
else:
debug.info(1, "Finding spice simulator: {} ({})".format(OPTS.spice_name, OPTS.spice_exe))
if OPTS.mpi_name:
debug.info(1, "MPI for spice simulator: {} ({})".format(OPTS.mpi_name, OPTS.mpi_exe))
debug.info(1, "Simulation threads: {}".format(OPTS.num_sim_threads))
else:
2021-02-10 21:10:04 +01:00
debug.info(1, "Analytical model enabled.")