This commit is contained in:
Matt Guthaus 2018-02-09 10:20:56 -08:00
commit 489faaba99
2 changed files with 44 additions and 29 deletions

View File

@ -16,7 +16,7 @@ USAGE = "Usage: openram.py [options] <config file>\nUse -h for help.\n"
# Anonymous object that will be the options
OPTS = options.options()
def parse_args(is_unit_test=True):
def parse_args():
""" Parse the optional arguments for OpenRAM """
global OPTS
@ -59,12 +59,6 @@ def parse_args(is_unit_test=True):
if OPTS.tech_name == "scmos":
OPTS.tech_name = "scn3me_subm"
# Check that we have a single configuration file as argument.
OPTS.is_unit_test=is_unit_test
if not OPTS.is_unit_test and len(args) < 1:
print(USAGE)
sys.exit(2)
return (options, args)
def print_banner():
@ -83,19 +77,28 @@ def print_banner():
print("|=========" + "VLSI Computer Architecture Research Group".center(60) + "=========|")
print("|=========" + "Oklahoma State University ECE Department".center(60) + "=========|")
print("|=========" + " ".center(60) + "=========|")
print("|=========" + OPTS.openram_temp.center(60) + "=========|")
user_info = "Usage help: openram-user-group@ucsc.edu"
print("|=========" + user_info.center(60) + "=========|")
dev_info = "Development help: openram-dev-group@ucsc.edu"
print("|=========" + dev_info.center(60) + "=========|")
temp_info = "Temp dir: {}".format(OPTS.openram_temp)
print("|=========" + temp_info.center(60) + "=========|")
print("|==============================================================================|")
def check_versions():
""" check that we are not using version 3 and at least 2.7 """
""" Run some checks of required software versions. """
# check that we are not using version 3 and at least 2.7
major_python_version = sys.version_info.major
minor_python_version = sys.version_info.minor
if not (major_python_version == 2 and minor_python_version >= 7):
debug.error("Python 2.7 is required.",-1)
def init_openram(config_file):
# FIXME: Check versions of other tools here??
# or, this could be done in each module (e.g. verify, characterizer, etc.)
def init_openram(config_file, is_unit_test=True):
"""Initialize the technology, paths, simulators, etc."""
check_versions()
@ -103,11 +106,10 @@ def init_openram(config_file):
setup_paths()
read_config(config_file)
read_config(config_file, is_unit_test)
import_tech()
report_status()
def get_tool(tool_type, preferences):
@ -129,7 +131,7 @@ def get_tool(tool_type, preferences):
def read_config(config_file):
def read_config(config_file, is_unit_test=True):
"""
Read the configuration file that defines a few parameters. The
config file is just a Python file that defines some config
@ -167,6 +169,15 @@ def read_config(config_file):
OPTS.output_path += "/"
debug.info(1, "Output saved in " + OPTS.output_path)
OPTS.is_unit_test=is_unit_test
# If config didn't set output name, make a reasonable default.
if (OPTS.output_name == ""):
OPTS.output_name = "sram_{0}_{1}_{2}_{3}".format(OPTS.word_size,
OPTS.num_words,
OPTS.num_banks,
OPTS.OPTS.tech_name)
# Don't delete the output dir, it may have other files!
# make the directory if it doesn't exist
try:
@ -302,17 +313,11 @@ def report_status():
if not OPTS.tech_name:
debug.error("Tech name must be specified in config file.")
if (OPTS.output_name == ""):
OPTS.output_name = "sram_{0}_{1}_{2}_{3}".format(OPTS.word_size,
OPTS.num_words,
OPTS.num_banks,
OPTS.OPTS.tech_name)
if not OPTS.is_unit_test:
print("Output files are " + OPTS.output_name + ".(sp|gds|v|lib|lef)")
print("Technology: {0}".format(OPTS.tech_name))
print("Word size: {0}\nWords: {1}\nBanks: {2}".format(OPTS.word_size,
OPTS.num_words,
OPTS.num_banks))
if not OPTS.check_lvsdrc:
print("DRC/LVS/PEX checking is disabled.")
print("Output files are " + OPTS.output_name + ".(sp|gds|v|lib|lef)")
print("Technology: {0}".format(OPTS.tech_name))
print("Word size: {0}\nWords: {1}\nBanks: {2}".format(OPTS.word_size,
OPTS.num_words,
OPTS.num_banks))
if not OPTS.check_lvsdrc:
print("DRC/LVS/PEX checking is disabled.")

View File

@ -16,15 +16,25 @@ import re
import importlib
from globals import *
(OPTS, args) = parse_args(is_unit_test=False)
(OPTS, args) = parse_args()
# Check that we are left with a single configuration file as argument.
if len(args) != 1:
print(USAGE)
sys.exit(2)
# These depend on arguments, so don't load them until now.
import debug
init_openram(config_file=args[0], is_unit_test=False)
# Only print banner here so it's not in unit tests
print_banner()
init_openram(args[0])
# Output info about this run
report_status()
# Start importing design modules after we have the config file
import verify