Restoring CLI script, now starting to work again!
@@ -5,7 +5,10 @@ import sys
import logging
import argparse
import os
+import re
import json
+import sys
+import importlib.resources
#Shorten siliconcompiler as sc
import siliconcompiler as sc
@@ -68,7 +71,7 @@ def cmdline():
help=def_cfg[key1]['syn'][key2]['help'],
default = argparse.SUPPRESS)
#Command line on/off switches
- elif def_cfg[key1]['type'] is "bool":
+ elif def_cfg[key1]['type'] == "bool":
parser.add_argument(def_cfg[key1]['switch'],
dest=key1,
action='store_true',
@@ -126,6 +129,7 @@ def cmdline():
if 'value' not in cfg:
cfg[param] = {}
cfg[param]['value'] = all_vals
+
else:
cfg[param]['value'].extend(all_vals)
@@ -135,23 +139,30 @@ def cmdline():
###########################
def main():
+ scriptdir = os.path.dirname(os.path.abspath(__file__))
+ rootdir = re.sub("siliconcompiler/siliconcompiler", "siliconcompiler", scriptdir, 1)
+ pdkcfg = rootdir + "/pdklib/virtual/nangate45/nangate45.json"
+ ipcfg = rootdir + "/iplib/virtual/nangate45/NangateOpenCellLibrary.json"
+ edacfg = rootdir + "/edalib/asic/sc_asicflow.json"
+
+
#Command line inputs, read once
cmdlinecfg = cmdline()
#Create one (or many...) instances of Chip class
mychip = sc.Chip()
- # Iterative over nested dict recursively to get environment variables
- mychip.readenv()
-
- # Read files sourced from command line
- #for filename in cmdargs['sc_cfgfile']:
- # mychip.loadcfg(file=filename)
+ # Reading in default config files unless cfg file is set
+ if 'nangate45' in cmdlinecfg['sc_target']['value']:
+ mychip.readcfg(edacfg)
+ mychip.readcfg(pdkcfg)
+ mychip.readcfg(ipcfg)
- # Copy a cfg dictionary into Chip.cfg
- #print(json.dumps(cmdlinecfg, sort_keys=True, indent=4))
+ # Reading in user variables
+ mychip.readenv()
- mychip.mergecfg(cmdlinecfg,"cmdline")
+ # Reading in command line arguments
+ mychip.mergecfg(cmdlinecfg)
#Resolve as absolute paths (should be a switch)
mychip.abspath()
@@ -165,19 +176,10 @@ def main():
#Printing out run-config
mychip.writecfg("sc_setup.json")
- #Compilation
- #for stage in mychip.get('sc_stages'):
-
- mychip.cfg['sc_tool']['import']['exe']['value'].extend(["verilator"])
- mychip.cfg['sc_tool']['import']['opt']['value'].extend(["--lint-only", "--debug"])
+ all_stages = mychip.get('sc_stages')
+ for stage in all_stages:
+ mychip.run(stage)
- mychip.run("import")
- #mychip.run("syn")
- #mychip.run("place")
- #mychip.run("cts")
- #mychip.run("route")
- #mychip.run("signoff")
- #mychip.run("export")
#########################
if __name__ == "__main__":
