2018-05-12 01:32:00 +02:00
|
|
|
#!/usr/bin/env python3
|
2016-11-08 18:57:35 +01: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
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import sys,os
|
|
|
|
|
import datetime
|
|
|
|
|
import re
|
|
|
|
|
import importlib
|
2018-02-08 21:47:19 +01:00
|
|
|
from globals import *
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2018-02-09 18:53:28 +01:00
|
|
|
(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)
|
|
|
|
|
|
2017-11-14 22:24:14 +01:00
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
# These depend on arguments, so don't load them until now.
|
|
|
|
|
import debug
|
|
|
|
|
|
2018-02-09 18:53:28 +01:00
|
|
|
|
|
|
|
|
init_openram(config_file=args[0], is_unit_test=False)
|
|
|
|
|
|
2018-02-08 21:47:19 +01:00
|
|
|
# Only print banner here so it's not in unit tests
|
|
|
|
|
print_banner()
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2018-02-09 18:53:28 +01:00
|
|
|
# Output info about this run
|
|
|
|
|
report_status()
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2018-02-08 21:47:19 +01:00
|
|
|
# Start importing design modules after we have the config file
|
2017-11-14 23:59:14 +01:00
|
|
|
import verify
|
2018-08-31 21:03:28 +02:00
|
|
|
from sram import sram
|
|
|
|
|
from sram_config import sram_config
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2018-08-27 23:33:02 +02:00
|
|
|
output_extensions = ["sp","v","lib"]
|
|
|
|
|
if not OPTS.netlist_only:
|
|
|
|
|
output_extensions.extend(["gds","lef"])
|
|
|
|
|
output_files = ["{0}.{1}".format(OPTS.output_name,x) for x in output_extensions]
|
2018-07-12 19:35:38 +02:00
|
|
|
print("Output files are: ")
|
|
|
|
|
print(*output_files,sep="\n")
|
2018-02-26 17:54:35 +01:00
|
|
|
|
2018-02-08 21:47:19 +01:00
|
|
|
# Keep track of running stats
|
2017-11-14 22:24:14 +01:00
|
|
|
start_time = datetime.datetime.now()
|
2018-02-08 22:11:18 +01:00
|
|
|
print_time("Start",start_time)
|
2018-02-08 21:47:19 +01:00
|
|
|
|
2018-09-04 19:47:24 +02:00
|
|
|
# Configure the SRAM organization
|
2018-08-31 21:03:28 +02:00
|
|
|
c = sram_config(word_size=OPTS.word_size,
|
2018-09-04 19:47:24 +02:00
|
|
|
num_words=OPTS.num_words)
|
2018-08-31 21:03:28 +02:00
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
# import SRAM test generation
|
2018-09-04 19:47:24 +02:00
|
|
|
s = sram(sram_config=c,
|
|
|
|
|
name=OPTS.output_name)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
# Output the files for the resulting SRAM
|
2018-07-12 19:35:38 +02:00
|
|
|
s.save()
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2018-02-08 21:47:19 +01:00
|
|
|
# Delete temp files etc.
|
|
|
|
|
end_openram()
|
|
|
|
|
print_time("End",datetime.datetime.now(), start_time)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
|