2018-05-11 16:32:00 -07:00
|
|
|
#!/usr/bin/env python3
|
2019-04-26 12:21:50 -07:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
#
|
2023-01-28 22:56:27 -08:00
|
|
|
# Copyright (c) 2016-2023 Regents of the University of California and The Board
|
2019-06-14 08:43:41 -07:00
|
|
|
# of Regents for the Oklahoma Agricultural and Mechanical College
|
|
|
|
|
# (acting for and on behalf of Oklahoma State University)
|
|
|
|
|
# All rights reserved.
|
2019-04-26 12:21:50 -07:00
|
|
|
#
|
2016-11-08 09:57:35 -08:00
|
|
|
"""
|
|
|
|
|
SRAM Compiler
|
|
|
|
|
|
|
|
|
|
The output files append the given suffixes to the output name:
|
|
|
|
|
a spice (.sp) file for circuit simulation
|
|
|
|
|
a GDS2 (.gds) file containing the layout
|
|
|
|
|
a LEF (.lef) file for preliminary P&R (real one should be from layout)
|
|
|
|
|
a Liberty (.lib) file for timing analysis/optimization
|
|
|
|
|
"""
|
|
|
|
|
|
2019-10-02 23:26:02 +00:00
|
|
|
import sys
|
2022-11-27 13:01:20 -08:00
|
|
|
import os
|
2016-11-08 09:57:35 -08:00
|
|
|
import datetime
|
2023-02-23 15:05:26 -08:00
|
|
|
|
|
|
|
|
# You don't need the next two lines if you're sure that openram package is installed
|
|
|
|
|
from common import *
|
|
|
|
|
make_openram_package()
|
|
|
|
|
import openram
|
2016-11-08 09:57:35 -08:00
|
|
|
|
2022-11-18 11:16:28 -08:00
|
|
|
(OPTS, args) = openram.parse_args()
|
2018-02-09 09:53:28 -08:00
|
|
|
|
|
|
|
|
# Check that we are left with a single configuration file as argument.
|
|
|
|
|
if len(args) != 1:
|
2022-11-18 11:16:28 -08:00
|
|
|
print(openram.USAGE)
|
2018-02-09 09:53:28 -08:00
|
|
|
sys.exit(2)
|
|
|
|
|
|
2017-11-14 13:24:14 -08:00
|
|
|
|
2016-11-08 09:57:35 -08:00
|
|
|
# These depend on arguments, so don't load them until now.
|
2022-11-27 13:01:20 -08:00
|
|
|
from openram import debug
|
2016-11-08 09:57:35 -08:00
|
|
|
|
2019-11-26 13:54:37 -08:00
|
|
|
# Parse config file and set up all the options
|
2022-11-21 14:52:57 -08:00
|
|
|
openram.init_openram(config_file=args[0])
|
2018-02-09 09:53:28 -08:00
|
|
|
|
2019-11-26 13:54:37 -08:00
|
|
|
# Ensure that the right bitcell exists or use the parameterised one
|
2022-11-18 11:16:28 -08:00
|
|
|
openram.setup_bitcell()
|
2019-11-26 13:54:37 -08:00
|
|
|
|
2018-02-08 12:47:19 -08:00
|
|
|
# Only print banner here so it's not in unit tests
|
2022-11-18 11:16:28 -08:00
|
|
|
openram.print_banner()
|
2016-11-08 09:57:35 -08:00
|
|
|
|
2018-12-07 15:50:18 -08:00
|
|
|
# Keep track of running stats
|
|
|
|
|
start_time = datetime.datetime.now()
|
2022-11-18 11:16:28 -08:00
|
|
|
openram.print_time("Start", start_time)
|
2018-12-07 15:50:18 -08:00
|
|
|
|
2018-02-09 09:53:28 -08:00
|
|
|
# Output info about this run
|
2022-11-18 11:16:28 -08:00
|
|
|
openram.report_status()
|
2016-11-08 09:57:35 -08:00
|
|
|
|
2022-11-29 10:33:32 -08:00
|
|
|
debug.print_raw("Words per row: {}".format(OPTS.words_per_row))
|
2018-12-06 13:11:47 -08:00
|
|
|
|
2020-07-03 06:55:35 -07:00
|
|
|
output_extensions = ["lvs", "sp", "v", "lib", "py", "html", "log"]
|
2019-04-01 09:58:59 -07:00
|
|
|
# Only output lef/gds if back-end
|
2018-08-27 14:33:02 -07:00
|
|
|
if not OPTS.netlist_only:
|
2019-10-02 23:26:02 +00:00
|
|
|
output_extensions.extend(["lef", "gds"])
|
2020-11-03 06:29:17 -08:00
|
|
|
|
2019-10-02 23:26:02 +00:00
|
|
|
output_files = ["{0}{1}.{2}".format(OPTS.output_path,
|
|
|
|
|
OPTS.output_name, x)
|
|
|
|
|
for x in output_extensions]
|
2019-01-13 14:34:46 -08:00
|
|
|
debug.print_raw("Output files are: ")
|
2019-10-02 23:26:02 +00:00
|
|
|
for path in output_files:
|
2019-01-13 14:34:46 -08:00
|
|
|
debug.print_raw(path)
|
2018-02-26 08:54:35 -08:00
|
|
|
|
2022-11-29 10:33:32 -08:00
|
|
|
# Create an SRAM (we can also pass sram_config, see documentation/tutorials for details)
|
2022-12-02 15:28:06 -08:00
|
|
|
from openram import sram
|
2022-11-29 10:33:32 -08:00
|
|
|
s = sram()
|
2016-11-08 09:57:35 -08:00
|
|
|
|
|
|
|
|
# Output the files for the resulting SRAM
|
2018-07-12 10:35:38 -07:00
|
|
|
s.save()
|
2016-11-08 09:57:35 -08:00
|
|
|
|
2018-02-08 12:47:19 -08:00
|
|
|
# Delete temp files etc.
|
2022-11-18 11:16:28 -08:00
|
|
|
openram.end_openram()
|
|
|
|
|
openram.print_time("End", datetime.datetime.now(), start_time)
|
2016-11-08 09:57:35 -08:00
|
|
|
|